Re: Pango, Cairo, Scale, and Ink Rectangles
- From: Behdad Esfahbod <behdad behdad org>
- To: Yclept Nemo <orbisvicis gmail com>
- Cc: gtk-i18n-list gnome org
- Subject: Re: Pango, Cairo, Scale, and Ink Rectangles
- Date: Tue, 25 Nov 2014 10:34:22 -0800
On 14-11-24 07:13 PM, Yclept Nemo wrote:
On Mon, Nov 24, 2014 at 5:12 PM, Behdad Esfahbod <behdad behdad org
<mailto:behdad behdad org>> wrote:
On 14-11-23 11:15 AM, Yclept Nemo wrote:
> This seems impossible if the glyph width/height ratios vary with scale/dpi.
Turn hinting off. Like this:
https://git.gnome.org/browse/pango/tree/examples/cairotwisted.c#n477
Thanks,
It is a necessary suggestion, but unfortunately the glyph width/height ratios
continue to vary.
Continue to vary in the exact same way? Or varies, but much much closer to
eachother? Please attach full C test code as well as a pointer to the font,
with actual and expected output.
I'm pretty sure I've followed the example correctly:
Using Pango resolution:
cairo_fontoptions = cairo.FontOptions()
cairo_fontoptions.set_hint_metrics(cairo.HINT_METRICS_OFF)
cairo_fontoptions.set_hint_style(cairo.HINT_STYLE_NONE)
ctx.set_font_options(cairo_fontoptions)
ctx.identity_matrix()
pango_context = PangoCairo.create_context(ctx)
PangoCairo.context_set_resolution(pango_context, dpi)
l1 = Pango.Layout(pango_context)
l1.set_font_description(font_description)
l1.set_text("8",1)
e1 = l1.get_extents()[0]
print(e1.x / Pango.SCALE, ...)
Using Cairo transformations:
cairo_fontoptions = cairo.FontOptions()
cairo_fontoptions.set_hint_metrics(cairo.HINT_METRICS_OFF)
cairo_fontoptions.set_hint_style(cairo.HINT_STYLE_NONE)
ctx.set_font_options(cairo_fontoptions)
ctx.identity_matrix()
ctx.scale(*(scale,)*2)
layout = PangoCairo.create_layout(ctx)
layout.set_font_description(font_description)
layout.set_text("8",1)
e1 = layout.get_extents()[0]
print(e1.x / Pango.SCALE, ...)
Sincerely,
--
behdad
http://behdad.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]