[prev in list] [next in list] [prev in thread] [next in thread]
List: cairo
Subject: [cairo] Font pixel height
From: Andreas Falkenhahn <andreas () falkenhahn ! com>
Date: 2022-08-09 10:10:23
Message-ID: 1745228449.20220809121023 () falkenhahn ! com
[Download RAW message or body]
Hi,
strictly speaking this question is about Pango but since I didn't find a Pango \
mailing list and I use Cairo to render my Pango layouts I hope it's ok to ask this \
question here :)
I want to create a font that uses a specific pixel height, so I do something like \
this:
fontmap = pango_cairo_font_map_new();
fontdesc = pango_font_description_from_string("Liberation 144px");
context = pango_font_map_create_context(fontmap);
font = pango_font_map_load_font(fontmap, context, fontdesc);
m = pango_font_get_metrics(font, NULL);
height = pango_font_metrics_get_height(m) / PANGO_SCALE;
Surprisingly, "height" is now 167 even though I requested a font height of 144 \
pixels. Is there any way to create a font whose pixel height is exactly or at least \
closely what I requested? Currently, there seems to be a rather significant deviation \
from the requested pixel size and the actual pixel height, e.g. I'm getting a font \
whose height is 167 pixels when requesting a 144 pixel font.
Thanks!
--
Best regards,
Andreas Falkenhahn mailto:andreas@falkenhahn.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic