[libgxps: 1/2] Fixes font scaling issue when converting xps to pdf



commit 3b57ea41f746f7dc8172eea7a43e18f58079c5ed
Author: Ignazio Pillai <ignazp amazon com>
Date:   Wed May 30 15:06:10 2018 +0200

    Fixes font scaling issue when converting xps to pdf
    
    The glyph alignment changes at different resolutions due to the quantization of font metrics, so on some 
scales the text can be misaligned.
    As reported in cairo documentation (see cairo_hint_metrics_t), doing this improves the consistency of 
letter and line spacing, however it also means that text will be laid out differently at different zoom 
factors.
    To disable the quantization CAIRO_HINT_METRICS_OFF has been used.
    
    Closes #1
    https://gitlab.gnome.org/GNOME/libgxps/issues/1

 libgxps/gxps-page.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/libgxps/gxps-page.c b/libgxps/gxps-page.c
index 3333505..8d7ab3f 100644
--- a/libgxps/gxps-page.c
+++ b/libgxps/gxps-page.c
@@ -989,6 +989,7 @@ render_end_element (GMarkupParseContext  *context,
 
                font_options = cairo_font_options_create ();
                cairo_get_font_options (ctx->cr, font_options);
+               cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
 
                cairo_matrix_init_identity (&font_matrix);
                cairo_matrix_scale (&font_matrix, glyphs->em_size, glyphs->em_size);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]