https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/ns-wingdi-taglog...
The following situations do not support ClearType antialiasing:
The font has tuned embedded bitmaps, for any font sizes that contain the embedded bitmaps. For example, this occurs commonly in East Asian fonts.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=28009 Signed-off-by: Byeongsik Jeon bsjeon@hanmail.net --- [1] This patch affects the WineTahoma rendering. This is a normal operation. Instead of loading the embedded bitmap, the metrics returns to normal.
[2] This is a different topic from the use of get_gasp_flags in freetype_SelectFont. This determines whether to load the embedded bitmap.
This issue has been an issue for a long time in the Windows CJK legacy builtin fonts. For some wrong programs, these fonts are programmed under the assumption that they are rendered as bitmap. Ex. Space Funeral.
[3] If the font with embedded bitmap has gasp DO_GRAY bits set, does not use the bitmap. Ex. Calibri.
dlls/gdi32/freetype.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index d3d9e391f7..45709a0a92 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7608,6 +7608,38 @@ static DWORD get_ggo_glyph_from_bitmap( FT_GlyphSlot glyph, UINT format, FT_BBox return needed; }
+static FT_Int get_embedded_bitmap_load_flags( UINT format, GdiFont *font, BOOL needsTransform ) +{ + FT_Int load_flags = 0; + WORD gasp_flags; + + if ( needsTransform ) + return FT_LOAD_NO_BITMAP; + + switch (format) + { + case GGO_BITMAP: + break; + case GGO_GRAY2_BITMAP: + case GGO_GRAY4_BITMAP: + case GGO_GRAY8_BITMAP: + case GGO_NATIVE: + case GGO_BEZIER: + load_flags = FT_LOAD_NO_BITMAP; + break; + case WINE_GGO_GRAY16_BITMAP: + case WINE_GGO_HRGB_BITMAP: + case WINE_GGO_HBGR_BITMAP: + case WINE_GGO_VRGB_BITMAP: + case WINE_GGO_VBGR_BITMAP: + if (get_gasp_flags( font, &gasp_flags ) && (gasp_flags & GASP_DOGRAY)) + load_flags = FT_LOAD_NO_BITMAP; + break; + } + + return load_flags; +} + static FT_Int get_load_flags( UINT format, BOOL ggo_unhinted, BOOL natural_width ) { FT_Int load_flags = FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; @@ -7700,7 +7732,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, vertical_metrics = FALSE;
load_flags = get_load_flags( format, ggo_unhinted, natural_width ); - if (needsTransform || format != GGO_BITMAP) load_flags |= FT_LOAD_NO_BITMAP; + load_flags |= get_embedded_bitmap_load_flags( format, font, needsTransform ); if (vertical_metrics) load_flags |= FT_LOAD_VERTICAL_LAYOUT;
err = pFT_Load_Glyph(ft_face, glyph_index, load_flags);