Skip to content

Commit

Permalink
win32u: Use font AA flags when querying glyph outline with GGO_METRICS.
Browse files Browse the repository at this point in the history
CW-Bug-Id: #22992
  • Loading branch information
Paul Gofman authored and ivyl committed Feb 15, 2024
1 parent fdfa017 commit 7a43389
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dlls/win32u/freetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -3469,6 +3469,7 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT
FT_Int load_flags;
FT_Matrix transform_matrices[3], *matrices = NULL;
BOOL vertical_metrics;
UINT effective_format = format;

TRACE("%p, %04x, %08x, %p, %08x, %p, %p\n", font, glyph, format, lpgm, buflen, buf, lpmat);

Expand All @@ -3478,14 +3479,22 @@ static UINT freetype_get_glyph_outline( struct gdi_font *font, UINT glyph, UINT

matrices = get_transform_matrices( font, tategaki, lpmat, transform_matrices );

if ((format & ~GGO_GLYPH_INDEX) == GGO_METRICS)
effective_format = font->aa_flags | (format & GGO_GLYPH_INDEX);
vertical_metrics = (tategaki && FT_HAS_VERTICAL(ft_face));
/* there is a freetype bug where vertical metrics are only
properly scaled and correct in 2.4.0 or greater */
if (vertical_metrics && FT_SimpleVersion < FT_VERSION_VALUE(2, 4, 0))
vertical_metrics = FALSE;
load_flags = get_load_flags(format, vertical_metrics, !!matrices);
load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices);

err = pFT_Load_Glyph(ft_face, glyph, load_flags);
if (err && format != effective_format)
{
WARN("Failed to load glyph %#x, retrying with GGO_METRICS. Error %#x.\n", glyph, err);
load_flags = get_load_flags(effective_format, vertical_metrics, !!matrices);
err = pFT_Load_Glyph(ft_face, glyph, load_flags);
}
if (err && !(load_flags & FT_LOAD_NO_HINTING))
{
WARN("Failed to load glyph %#x, retrying without hinting. Error %#x.\n", glyph, err);
Expand Down

0 comments on commit 7a43389

Please sign in to comment.