summaryrefslogtreecommitdiff
path: root/pango/pangofc-font.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-05-22 20:10:08 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-05-22 20:10:08 +0000
commitec8d35bf511a8dcdd612850917e1e9ae9b36e1d0 (patch)
treef53a6154f829fc6ff81f278d7176c84ce4c290af /pango/pangofc-font.c
parentf9697a634b7267fa0743e47561c28b3ca3ae226b (diff)
downloadpango-ec8d35bf511a8dcdd612850917e1e9ae9b36e1d0.tar.gz
New function pango_font_describe_with_absolute_size().
2006-05-22 Behdad Esfahbod <behdad@gnome.org> * pango/pango-font.h, pango/fonts.c: New function pango_font_describe_with_absolute_size(). * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): * pango/pangocairo-win32font.c (create_metrics_for_context): * pango/pangofc-font.c (pango_fc_font_class_init), (pango_fc_font_describe_absolute), (pango_fc_font_create_metrics_for_context): * pango/pangowin32.c (pango_win32_font_class_init), (pango_win32_font_get_metrics), (pango_win32_font_describe), (pango_win32_font_describe_absolute): Implement and use PangoFontClass->describe_absolute.
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r--pango/pangofc-font.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index e31155a0..da9b9754 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -83,6 +83,7 @@ static PangoFontMetrics * pango_fc_font_get_metrics (PangoFont *font,
PangoLanguage *language);
static PangoFontMap * pango_fc_font_get_font_map (PangoFont *font);
static PangoFontDescription *pango_fc_font_describe (PangoFont *font);
+static PangoFontDescription *pango_fc_font_describe_absolute (PangoFont *font);
#define PANGO_FC_FONT_LOCK_FACE(font) (PANGO_FC_FONT_GET_CLASS (font)->lock_face (font))
@@ -103,6 +104,7 @@ pango_fc_font_class_init (PangoFcFontClass *class)
object_class->finalize = pango_fc_font_finalize;
object_class->set_property = pango_fc_font_set_property;
font_class->describe = pango_fc_font_describe;
+ font_class->describe_absolute = pango_fc_font_describe_absolute;
font_class->find_shaper = pango_fc_font_find_shaper;
font_class->get_coverage = pango_fc_font_get_coverage;
font_class->get_metrics = pango_fc_font_get_metrics;
@@ -227,6 +229,19 @@ pango_fc_font_describe (PangoFont *font)
return pango_font_description_copy (fcfont->description);
}
+static PangoFontDescription *
+pango_fc_font_describe_absolute (PangoFont *font)
+{
+ PangoFcFont *fcfont = (PangoFcFont *)font;
+ PangoFontDescription *desc = pango_font_description_copy (fcfont->description);
+ double size;
+
+ if (FcPatternGetDouble (fcfont->font_pattern, FC_PIXEL_SIZE, 0, &size) == FcResultMatch)
+ pango_font_description_set_absolute_size (desc, size * PANGO_SCALE);
+
+ return desc;
+}
+
static PangoMap *
pango_fc_get_shaper_map (PangoLanguage *language)
{
@@ -401,13 +416,15 @@ pango_fc_font_create_metrics_for_context (PangoFcFont *fcfont,
PangoRectangle extents;
PangoLanguage *language = pango_context_get_language (context);
const char *sample_str = pango_language_get_sample_string (language);
+ PangoFontDescription *desc = pango_font_describe_with_absolute_size (fcfont);
metrics = pango_font_metrics_new ();
get_face_metrics (fcfont, metrics);
layout = pango_layout_new (context);
- pango_layout_set_font_description (layout, fcfont->description);
+ pango_layout_set_font_description (layout, desc);
+ pango_font_description_free (desc);
pango_layout_set_text (layout, sample_str, -1);
pango_layout_get_extents (layout, NULL, &extents);