diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2022-02-12 23:28:53 -0600 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2022-02-13 14:34:24 -0600 |
commit | a62eea4aeca62318984065eeb0673293515ac0e3 (patch) | |
tree | 1b30bf6432096e27a932426f0735efa779807b7a /src/cairo-user-font.c | |
parent | c90faeb7492b1b778d18a796afe5c2e4b32a6356 (diff) | |
download | cairo-a62eea4aeca62318984065eeb0673293515ac0e3.tar.gz |
[user-font] Implement subpixel-positioning
See:
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033118545
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1033125311
https://github.com/harfbuzz/harfbuzz/pull/3411#issuecomment-1037765840
Basically the code in cairo-image-compositor.c:composite_glyphs()
is flooring glyph positions and putting some phase in the glyph-id.
This was being lost in the user-font backend. Fetch that and put it
in the recording-surface's device-transform translation, to be applied.
Diffstat (limited to 'src/cairo-user-font.c')
-rw-r--r-- | src/cairo-user-font.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c index 76f64ebfb..b2a05d67d 100644 --- a/src/cairo-user-font.c +++ b/src/cairo-user-font.c @@ -195,8 +195,11 @@ _cairo_user_scaled_glyph_init (void *abstract_font, if (recording_surface) cairo_surface_destroy (recording_surface); recording_surface = _cairo_user_scaled_font_create_recording_surface (scaled_font, FALSE); + recording_surface->device_transform.x0 = .25 * _cairo_scaled_glyph_xphase (scaled_glyph); + recording_surface->device_transform.y0 = .25 * _cairo_scaled_glyph_yphase (scaled_glyph); cr = _cairo_user_scaled_font_create_recording_context (scaled_font, recording_surface, FALSE); + status = face->scaled_font_methods.render_glyph ((cairo_scaled_font_t *)scaled_font, _cairo_scaled_glyph_index(scaled_glyph), cr, &extents); |