gdi32: Correct the font family values returned in the text metrics.

This commit is contained in:
Huw Davies 2009-02-11 13:49:52 +00:00 committed by Alexandre Julliard
parent 3c68ba1bad
commit 8ab829a68a
2 changed files with 99 additions and 16 deletions

View File

@ -5420,31 +5420,54 @@ UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
else
TM.tmPitchAndFamily = 0;
switch(pOS2->panose[PAN_FAMILYTYPE_INDEX]) {
switch(pOS2->panose[PAN_FAMILYTYPE_INDEX])
{
case PAN_FAMILY_SCRIPT:
TM.tmPitchAndFamily |= FF_SCRIPT;
break;
break;
case PAN_FAMILY_DECORATIVE:
case PAN_FAMILY_PICTORIAL:
TM.tmPitchAndFamily |= FF_DECORATIVE;
break;
break;
case PAN_ANY:
case PAN_NO_FIT:
case PAN_FAMILY_TEXT_DISPLAY:
case PAN_FAMILY_PICTORIAL: /* symbol fonts get treated as if they were text */
/* which is clearly not what the panose spec says. */
default:
if(TM.tmPitchAndFamily == 0) /* fixed */
TM.tmPitchAndFamily = FF_MODERN;
else {
switch(pOS2->panose[PAN_SERIFSTYLE_INDEX]) {
case PAN_SERIF_NORMAL_SANS:
case PAN_SERIF_OBTUSE_SANS:
case PAN_SERIF_PERP_SANS:
TM.tmPitchAndFamily |= FF_SWISS;
break;
default:
TM.tmPitchAndFamily |= FF_ROMAN;
}
else
{
switch(pOS2->panose[PAN_SERIFSTYLE_INDEX])
{
case PAN_ANY:
case PAN_NO_FIT:
default:
TM.tmPitchAndFamily |= FF_DONTCARE;
break;
case PAN_SERIF_COVE:
case PAN_SERIF_OBTUSE_COVE:
case PAN_SERIF_SQUARE_COVE:
case PAN_SERIF_OBTUSE_SQUARE_COVE:
case PAN_SERIF_SQUARE:
case PAN_SERIF_THIN:
case PAN_SERIF_BONE:
case PAN_SERIF_EXAGGERATED:
case PAN_SERIF_TRIANGLE:
TM.tmPitchAndFamily |= FF_ROMAN;
break;
case PAN_SERIF_NORMAL_SANS:
case PAN_SERIF_OBTUSE_SANS:
case PAN_SERIF_PERP_SANS:
TM.tmPitchAndFamily |= FF_SWISS;
break;
}
}
break;
default:
TM.tmPitchAndFamily |= FF_DONTCARE;
}
if(FT_IS_SCALABLE(ft_face))

View File

@ -2019,6 +2019,14 @@ typedef struct
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24))
#define MS_OS2_TAG MS_MAKE_TAG('O','S','/','2')
static void expect_ff(const TEXTMETRICW *tmW, const TT_OS2_V2 *os2, WORD family, const char *name)
{
ok((tmW->tmPitchAndFamily & 0xf0) == family, "%s: expected family %02x got %02x. panose %d-%d-%d-%d-...\n",
name, family, tmW->tmPitchAndFamily, os2->panose.bFamilyType, os2->panose.bSerifStyle,
os2->panose.bWeight, os2->panose.bProportion);
}
static void test_text_metrics(const LOGFONTA *lf)
{
HDC hdc;
@ -2130,6 +2138,58 @@ static void test_text_metrics(const LOGFONTA *lf)
tmW.tmDigitizedAspectX, ret);
}
/* test FF_ values */
switch(tt_os2.panose.bFamilyType)
{
case PAN_ANY:
case PAN_NO_FIT:
case PAN_FAMILY_TEXT_DISPLAY:
case PAN_FAMILY_PICTORIAL:
default:
if((tmW.tmPitchAndFamily & 1) == 0) /* fixed */
{
expect_ff(&tmW, &tt_os2, FF_MODERN, font_name);
break;
}
switch(tt_os2.panose.bSerifStyle)
{
case PAN_ANY:
case PAN_NO_FIT:
default:
expect_ff(&tmW, &tt_os2, FF_DONTCARE, font_name);
break;
case PAN_SERIF_COVE:
case PAN_SERIF_OBTUSE_COVE:
case PAN_SERIF_SQUARE_COVE:
case PAN_SERIF_OBTUSE_SQUARE_COVE:
case PAN_SERIF_SQUARE:
case PAN_SERIF_THIN:
case PAN_SERIF_BONE:
case PAN_SERIF_EXAGGERATED:
case PAN_SERIF_TRIANGLE:
expect_ff(&tmW, &tt_os2, FF_ROMAN, font_name);
break;
case PAN_SERIF_NORMAL_SANS:
case PAN_SERIF_OBTUSE_SANS:
case PAN_SERIF_PERP_SANS:
case PAN_SERIF_FLARED:
case PAN_SERIF_ROUNDED:
expect_ff(&tmW, &tt_os2, FF_SWISS, font_name);
break;
}
break;
case PAN_FAMILY_SCRIPT:
expect_ff(&tmW, &tt_os2, FF_SCRIPT, font_name);
break;
case PAN_FAMILY_DECORATIVE:
expect_ff(&tmW, &tt_os2, FF_DECORATIVE, font_name);
break;
}
test_negative_width(hdc, lf);
end_of_test: