From 489265e7744fca785e883c2512659b7770ed4e55 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Tue, 24 Aug 2004 17:29:00 +0000 Subject: [PATCH] - Load also the last font file in the font directory. svn path=/trunk/; revision=10670 --- reactos/subsys/win32k/objects/text.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/reactos/subsys/win32k/objects/text.c b/reactos/subsys/win32k/objects/text.c index 2d1f24a649e..49346170f32 100644 --- a/reactos/subsys/win32k/objects/text.c +++ b/reactos/subsys/win32k/objects/text.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: text.c,v 1.109 2004/08/21 02:22:45 navaraf Exp $ */ +/* $Id: text.c,v 1.110 2004/08/24 17:29:00 navaraf Exp $ */ #include #include @@ -213,9 +213,8 @@ IntLoadSystemFonts(VOID) break; } - for (DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer; - DirInfo->NextEntryOffset != 0; - DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset)) + DirInfo = (PFILE_DIRECTORY_INFORMATION)DirInfoBuffer; + while (1) { TempString.Buffer = DirInfo->FileName; TempString.Length = @@ -223,6 +222,9 @@ IntLoadSystemFonts(VOID) RtlCopyUnicodeString(&FileName, &Directory); RtlAppendUnicodeStringToString(&FileName, &TempString); IntGdiAddFontResource(&FileName, 0); + if (DirInfo->NextEntryOffset == 0) + break; + DirInfo = (PFILE_DIRECTORY_INFORMATION)((ULONG_PTR)DirInfo + DirInfo->NextEntryOffset); } bRestartScan = FALSE; @@ -380,7 +382,8 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics) /* FIXME: Complete text metrics */ FontGDI->TextMetric.tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above baseline */ FontGDI->TextMetric.tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units below baseline */ - FontGDI->TextMetric.tmHeight = FontGDI->TextMetric.tmAscent + FontGDI->TextMetric.tmDescent; + FontGDI->TextMetric.tmHeight = (Face->size->metrics.ascender - + Face->size->metrics.descender) >> 6; DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name); DPRINT("Num glyphs: %u\n", Face->num_glyphs); @@ -815,7 +818,6 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, } pPost = FT_Get_Sfnt_Table(FontGDI->face, ft_sfnt_post); /* we can live with this failing */ - IntUnLockFreeType; Otm->otmSize = Needed; @@ -963,6 +965,8 @@ IntGetOutlineTextMetrics(PFONTGDI FontGDI, UINT Size, Otm->otmsUnderscorePosition = (FT_MulFix(pPost->underlinePosition, YScale) + 32) >> 6; } + IntUnLockFreeType; + /* otmp* members should clearly have type ptrdiff_t, but M$ knows best */ Cp = (char*) Otm + sizeof(OUTLINETEXTMETRICW); Otm->otmpFamilyName = (LPSTR)(Cp - (char*) Otm); @@ -1893,11 +1897,11 @@ NtGdiExtTextOut( if (NULL == Dx) { - TextLeft += glyph->advance.x; + TextLeft += glyph->advance.x; } else { - TextLeft += Dx[i] << 6; + TextLeft += Dx[i] << 6; } previous = glyph_index; @@ -2860,7 +2864,7 @@ FindBestFontFromList(HFONT *Font, UINT *MatchScore, LOGFONTW *LogFont, continue; } Score = GetFontScore(LogFont, FaceName, FontGDI); - if (*MatchScore < Score) + if (*MatchScore == 0 || *MatchScore < Score) { *Font = CurrentEntry->hFont; *MatchScore = Score; -- 2.17.1