Long live Dejavu font, Long live Dejavu font

This commit fixed the charwidth calculation that was wrong for unicode font. That mean we can last using dejavu font in cmd. 
Now anyone whant we can delete the bitstream font from reactos please test see if it any apps still using bitstream font. 
I can not found any apps in reactos using it anylonger. I give the pleasuer delete the bitstream font for anyone whant 
doing that. 


svn path=/trunk/; revision=26304
This commit is contained in:
Magnus Olsen 2007-04-10 17:05:23 +00:00
parent 7848c88917
commit c9fb4f777b
2 changed files with 29 additions and 15 deletions

View file

@ -599,7 +599,7 @@ GuiConsoleUseDefaults(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCSRSS_
* init guidata with default properties * init guidata with default properties
*/ */
wcscpy(GuiData->FontName, L"Bitstream Vera Sans Mono"); wcscpy(GuiData->FontName, L"DejaVu Sans Mono");
GuiData->FontSize = 0x0008000C; // font is 8x12 GuiData->FontSize = 0x0008000C; // font is 8x12
GuiData->FontWeight = FW_NORMAL; GuiData->FontWeight = FW_NORMAL;
GuiData->HistoryNoDup = FALSE; GuiData->HistoryNoDup = FALSE;

View file

@ -284,6 +284,8 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
PFONT_ENTRY Entry; PFONT_ENTRY Entry;
PSECTION_OBJECT SectionObject; PSECTION_OBJECT SectionObject;
ULONG ViewSize = 0; ULONG ViewSize = 0;
//FT_Fixed XScale, YScale;
/* Open the font file */ /* Open the font file */
@ -363,10 +365,21 @@ IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristics)
FontGDI->face = Face; FontGDI->face = Face;
/* FIXME: Complete text metrics */ /* FIXME: Complete text metrics */
FontGDI->TextMetric.tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above baseline */ XScale = Face->size->metrics.x_scale;
FontGDI->TextMetric.tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units below baseline */ YScale = Face->size->metrics.y_scale;
FontGDI->TextMetric.tmHeight = (Face->size->metrics.ascender -
Face->size->metrics.descender) >> 6; #if 0 /* This (Wine) code doesn't seem to work correctly for us */
FontGDI->TextMetric.tmAscent = (FT_MulFix(Face->size->metrics.ascender, YScale) + 32) >> 6;
FontGDI->TextMetric.tmDescent = (FT_MulFix(Face->size->metrics.descender, YScale) + 32) >> 6;
FontGDI->TextMetric.tmHeight = (FT_MulFix(Face->size->metrics.ascender, YScale) -
FT_MulFix(Face->size->metrics.descender, YScale)) >> 6;
#else
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 = (Face->size->metrics.ascender - Face->size->metrics.descender) >> 6;
#endif
DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name); DPRINT("Font loaded: %s (%s)\n", Face->family_name, Face->style_name);
DPRINT("Num glyphs: %u\n", Face->num_glyphs); DPRINT("Num glyphs: %u\n", Face->num_glyphs);
@ -490,8 +503,8 @@ TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont)
memcpy(&TextObj->logfont, lf, sizeof(LOGFONTW)); memcpy(&TextObj->logfont, lf, sizeof(LOGFONTW));
if (lf->lfEscapement != lf->lfOrientation) if (lf->lfEscapement != lf->lfOrientation)
{ {
/* this should really depend on whether GM_ADVANCED is set */ /* this should really depend on whether GM_ADVANCED is set */
TextObj->logfont.lfOrientation = TextObj->logfont.lfEscapement; TextObj->logfont.lfOrientation = TextObj->logfont.lfEscapement;
} }
TEXTOBJ_UnlockText(TextObj); TEXTOBJ_UnlockText(TextObj);
} }
@ -596,7 +609,7 @@ NtGdiCreateScalableFontResource(DWORD Hidden,
LPCWSTR FontFile, LPCWSTR FontFile,
LPCWSTR CurrentPath) LPCWSTR CurrentPath)
{ {
DPRINT1("NtGdiCreateScalableFontResource - is unimplemented, have a nice day and keep going"); DPRINT1("NtGdiCreateScalableFontResource - is unimplemented, have a nice day and keep going");
return FALSE; return FALSE;
} }
@ -702,17 +715,16 @@ FillTM(TEXTMETRICW *TM, FT_Face Face, TT_OS2 *pOS2, TT_HoriHeader *pHori)
Descent = pOS2->usWinDescent; Descent = pOS2->usWinDescent;
} }
#if 0 /* This (Wine) code doesn't seem to work correctly for us */ #if 0 /* This (Wine) code doesn't seem to work correctly for us, cmd issue */
TM->tmAscent = (FT_MulFix(Ascent, YScale) + 32) >> 6; TM->tmAscent = (FT_MulFix(Ascent, YScale) + 32) >> 6;
TM->tmDescent = (FT_MulFix(Descent, YScale) + 32) >> 6; TM->tmDescent = (FT_MulFix(Descent, YScale) + 32) >> 6;
#else #else /* This (ros) code doesn't seem to work correctly for us for it miss 2-3 pixel draw of the font*/
TM->tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above baseline */ TM->tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* units above baseline */
TM->tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units below baseline */ TM->tmDescent = (32 - Face->size->metrics.descender) >> 6; /* units below baseline */
#endif #endif
TM->tmInternalLeading = (FT_MulFix(Ascent + Descent
- Face->units_per_EM, YScale) + 32) >> 6;
TM->tmHeight = TM->tmAscent + TM->tmDescent; TM->tmInternalLeading = (FT_MulFix(Ascent + Descent - Face->units_per_EM, YScale) + 32) >> 6;
TM->tmHeight = TM->tmAscent + TM->tmDescent; // we need add 1 height more after scale it right
/* MSDN says: /* MSDN says:
* el = MAX(0, LineGap - ((WinAscent + WinDescent) - (Ascender - Descender))) * el = MAX(0, LineGap - ((WinAscent + WinDescent) - (Ascender - Descender)))
@ -727,8 +739,10 @@ FillTM(TEXTMETRICW *TM, FT_Face Face, TT_OS2 *pOS2, TT_HoriHeader *pHori)
{ {
TM->tmAveCharWidth = 1; TM->tmAveCharWidth = 1;
} }
TM->tmMaxCharWidth = (FT_MulFix(Face->bbox.xMax - Face->bbox.xMin,
XScale) + 32) >> 6; /* Correct forumla to get the maxcharwidth from unicode and ansi font */
TM->tmMaxCharWidth = (FT_MulFix(Face->max_advance_width, XScale) + 32) >> 6;
TM->tmWeight = pOS2->usWeightClass; TM->tmWeight = pOS2->usWeightClass;
TM->tmOverhang = 0; TM->tmOverhang = 0;
TM->tmDigitizedAspectX = 300; TM->tmDigitizedAspectX = 300;