Pango Fc Shaper gives incorrect geometry information
- From: Simon Cozens <simon simon-cozens org>
- To: gtk-i18n-list gnome org
- Subject: Pango Fc Shaper gives incorrect geometry information
- Date: Thu, 04 Sep 2014 16:34:29 +0100
I've had some bug reports about my SILE typesetter providing badly
letter-spaced output on Linux, when the output looks fine in OS X. I've
tracked this down to pango_shape returning geometries which are being
(erroneously) quantized to integer multiples of PANGO_UNITS.
For instance, the code below on OS X (using the pango-basic-coretext module)
returns the correct answer, 7.070312. On Linux, it reports the width of a 12pt
Gentium "z" as 7.000000pts. The width of an "m" is 12.851562pt on OS X, but
12.000000pts on Linux.
I'm not sure what to do (other than shift to harfbuzz for shaping...) to get
the correct results. Is it something inside Pango quantizing the geometries,
or something inside FreeType?
#include <pango/pangocairo.h>
int main() {
PangoFontMap * fm = pango_cairo_font_map_get_default ();
PangoContext * pango = pango_font_map_create_context(fm);
PangoAttrList * pal = pango_attr_list_new();
PangoAttribute * pa1 = pango_attr_family_new("Gentium");
PangoAttribute * pa2 = pango_attr_size_new(PANGO_SCALE * 12);
PangoItem* charitem;
PangoGlyphString* pgs = pango_glyph_string_new();
PangoGlyphInfo g;
pango_attr_list_insert(pal, pa1);
pango_attr_list_insert(pal, pa2);
charitem = pango_itemize(pango, "m", 0, 1, pal, NULL)->data;
pango_shape("m", 1, &(charitem->analysis), pgs);
g = (pgs->glyphs)[0];
printf("%f\n",g.geometry.width/(double)PANGO_SCALE);
}
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]