Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dziobian:gasp
cairo
gasp.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gasp.patch of Package cairo
From https://lists.cairographics.org/archives/cairo/2012-January/022676.html TrueType/OpenType fonts can have a GASP table, which controls whether or not a font is rendered with hinting or antialiasing at a specific ppem. For some unknown reason, this table isn't automatically applied by FreeType. If the FreeType clients don't do this themselves, fonts will render incorrectly. So whenever a font's scale is set, cache away the GASP value for that ppem and whenever a glyph is loaded, apply the GASP value as necessary. GASP tables also have flags that apply to ClearType rendering. These flags should be used instead of the above mentioned hinting and antialising flags if the font is being subpixel rendered. However, there doesn't appear to be any way to pass these flags on to FreeType, so they're ignored completely. Signed-off-by: Nicholas Miell <nmiell at gmail.com> --- src/cairo-ft-font.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 5790395..4ae5db5 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -56,6 +56,7 @@ #include FT_BITMAP_H #include FT_TRUETYPE_TABLES_H #include FT_XFREE86_H +#include FT_GASP_H #include FT_MULTIPLE_MASTERS_H #if HAVE_FT_GLYPHSLOT_EMBOLDEN #include FT_SYNTHESIS_H @@ -152,6 +153,7 @@ struct _cairo_ft_unscaled_font { cairo_matrix_t current_scale; double x_scale; /* Extracted X scale factor */ double y_scale; /* Extracted Y scale factor */ + FT_Int gasp; /* Cached GASP value for current scale */ cairo_bool_t have_shape; /* true if the current scale has a non-scale component*/ cairo_matrix_t current_shape; FT_Matrix Current_Shape; @@ -829,6 +831,8 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled, if (error) return _cairo_error (_cairo_ft_to_cairo_error (error)); + unscaled->gasp = FT_Get_Gasp(unscaled->face, unscaled->face->size->metrics.y_ppem); + return CAIRO_STATUS_SUCCESS; } @@ -2157,6 +2161,15 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, vertical_layout = TRUE; } + if (unscaled->gasp != FT_GASP_NO_TABLE) { + if (!(unscaled->gasp & FT_GASP_DO_GRIDFIT)) + load_flags |= FT_LOAD_NO_HINTING; + if (!(unscaled->gasp & FT_GASP_DO_GRAY)) { + load_flags &= ~FT_LOAD_TARGET_(0); + load_flags |= FT_LOAD_TARGET_MONO; + } + } + /* Metrics will always be requested when a scaled glyph is created */ if (info & CAIRO_SCALED_GLYPH_INFO_METRICS) { status = _cairo_ft_scaled_glyph_init_metrics (scaled_font, -- 1.7.7.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor