Index: reactos/win32ss/gdi/eng/engobjects.h =================================================================== --- reactos/win32ss/gdi/eng/engobjects.h (revision 74192) +++ reactos/win32ss/gdi/eng/engobjects.h (working copy) @@ -132,6 +132,7 @@ BYTE OriginalItalic; LONG OriginalWeight; BYTE CharSet; + BOOL IsFixedPitch; } FONTGDI, *PFONTGDI; typedef struct _PATHGDI { Index: reactos/win32ss/gdi/ntgdi/freetype.c =================================================================== --- reactos/win32ss/gdi/ntgdi/freetype.c (revision 74192) +++ reactos/win32ss/gdi/ntgdi/freetype.c (working copy) @@ -727,6 +727,7 @@ FT_UShort os2_version; FT_ULong os2_ulCodePageRange1; FT_UShort os2_usWeightClass; + PS_FontInfoRec PS; if (SharedFace == NULL && CharSetIndex == -1) { @@ -813,6 +814,34 @@ return 0; } + /* We trust PS table's is_fixed_pitch rather than FT_IS_FIXED_WIDTH. */ + IntLockFreeType; + Error = FT_Get_PS_Font_Info(Face, &PS); + IntUnLockFreeType; + if (!Error) + { + if (!!FT_IS_FIXED_WIDTH(Face) != !!PS.is_fixed_pitch) + { + DPRINT("FT_IS_FIXED_WIDTH and is_fixed_pitch are different."); + } + FontGDI->IsFixedPitch = !!PS.is_fixed_pitch; + } + else + { + FontGDI->IsFixedPitch = FT_IS_FIXED_WIDTH(Face); + } + + if (!FontGDI->IsFixedPitch) + { + /* hack */ + if (strstr(AnsiFaceName.Buffer, "Mono") != NULL || + strstr(AnsiFaceName.Buffer, "HW") != NULL) + { + DPRINT("FIXME: SourceHanSans.ttc and NotoSansCJK.ttc won't set the fixed-pitch value correctly\n"); + FontGDI->IsFixedPitch = TRUE; + } + } + os2_version = 0; IntLockFreeType; pOS2 = (TT_OS2 *)FT_Get_Sfnt_Table(Face, FT_SFNT_OS2); @@ -866,6 +895,10 @@ /* FIXME: CharSet is invalid on Marlett */ if (RtlEqualUnicodeString(&Entry->FaceName, &MarlettW, TRUE)) { + if (FontGDI->CharSet != SYMBOL_CHARSET) + { + DPRINT("WARNING: Marlett CharSet was %d\n", FontGDI->CharSet); + } FontGDI->CharSet = SYMBOL_CHARSET; } @@ -873,6 +906,10 @@ DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name); DPRINT("Num glyphs: %d\n", Face->num_glyphs); DPRINT("CharSet: %d\n", FontGDI->CharSet); + if (FontGDI->IsFixedPitch) + DPRINT("FIXED_PITCH\n"); + else + DPRINT("VARIABLE_PITCH\n"); /* Add this font resource to the font table */ Entry->Font = FontGDI; @@ -1356,14 +1393,7 @@ TM->tmStruckOut = (FontGDI->RequestStrikeOut ? 0xFF : 0); } - if (!FT_IS_FIXED_WIDTH(Face)) - { - TM->tmPitchAndFamily = _TMPF_VARIABLE_PITCH; - } - else - { - TM->tmPitchAndFamily = 0; - } + TM->tmPitchAndFamily = (FontGDI->IsFixedPitch ? 0 : _TMPF_VARIABLE_PITCH); switch (pOS2->panose[PAN_FAMILYTYPE_INDEX]) { @@ -1379,9 +1409,9 @@ 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. */ - if (TM->tmPitchAndFamily == 0) /* Fixed */ + if (FontGDI->IsFixedPitch) { - TM->tmPitchAndFamily = FF_MODERN; + TM->tmPitchAndFamily |= FF_MODERN; } else { @@ -1823,7 +1853,13 @@ Lf->lfWidth = TM->tmAveCharWidth; Lf->lfWeight = TM->tmWeight; Lf->lfItalic = TM->tmItalic; - Lf->lfPitchAndFamily = (TM->tmPitchAndFamily & 0xf1) + 1; + + if (TM->tmPitchAndFamily & _TMPF_VARIABLE_PITCH) + Lf->lfPitchAndFamily = VARIABLE_PITCH; + else + Lf->lfPitchAndFamily = FIXED_PITCH; + Lf->lfPitchAndFamily |= (TM->tmPitchAndFamily & 0xF0); + Lf->lfCharSet = TM->tmCharSet; Lf->lfOutPrecision = OUT_OUTLINE_PRECIS; Lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; @@ -3710,7 +3746,7 @@ break; } - Byte = (LogFont->lfPitchAndFamily & 0x0F); + Byte = (LogFont->lfPitchAndFamily & 0x03); if (Byte == DEFAULT_PITCH) Byte = VARIABLE_PITCH; if (fFixedSys) @@ -3739,7 +3775,7 @@ } } - Byte = (LogFont->lfPitchAndFamily & 0x0F); + Byte = (LogFont->lfPitchAndFamily & 0x03); if (Byte == DEFAULT_PITCH) { if (!(TM->tmPitchAndFamily & _TMPF_VARIABLE_PITCH))