summaryrefslogtreecommitdiff
path: root/pango/pangocairo-fcfont.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-01-04 19:35:56 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-01-04 19:35:56 +0000
commit143def0d70b166251c5971eabb61c901343502c9 (patch)
treec1402594c509e908efcc7225710af3e53a66fd21 /pango/pangocairo-fcfont.c
parentcbf5f1e8a747ce6b9d6a0b03a7febd6c6c55b0ca (diff)
downloadpango-143def0d70b166251c5971eabb61c901343502c9.tar.gz
Part of Bug 332266 – gdk_draw_layout fails for coordinates >= 2^21
2007-01-04 Behdad Esfahbod <behdad@gnome.org> Part of Bug 332266 – gdk_draw_layout fails for coordinates >= 2^21 * pango/pango-types.h: * pango/pango-matrix.c: New public API: pango_matrix_transform_distance() pango_matrix_transform_point() pango_matrix_transform_rectangle() pango_matrix_transform_pixel_rectangle() * pango/pango-utils.h: * pango/pango-utils.c: New public API: pango_units_from_double() pango_units_to_double() pango_extents_to_pixels() * pango/pango-layout.c (pango_layout_get_pixel_extents), (pango_layout_line_get_pixel_extents): Use pango_extents_to_pixels(). * pango/pangocairo-fcfont.c: (pango_cairo_fc_font_glyph_extents_cache_init), (compute_glyph_extents): Use pango_units_from_double(). * examples/renderdemo.c (do_output): Use pango_matrix_transform_pixel_rectangle(); * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/glyphs.sgml: Update. svn path=/trunk/; revision=2126
Diffstat (limited to 'pango/pangocairo-fcfont.c')
-rw-r--r--pango/pangocairo-fcfont.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index 0854a032..1d90ab48 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -46,8 +46,6 @@ typedef struct _GlyphExtentsCacheEntry GlyphExtentsCacheEntry;
#define GLYPH_CACHE_NUM_ENTRIES 256 /* should be power of two */
#define GLYPH_CACHE_MASK (GLYPH_CACHE_NUM_ENTRIES - 1)
-#define PANGO_UNITS(Double) ((int)floor((Double) * PANGO_SCALE + 0.5))
-
/* An entry in the fixed-size cache for the glyph -> ink_rect mapping.
* The cache is indexed by the lower N bits of the glyph (see
* GLYPH_CACHE_NUM_ENTRIES). For scripts with few glyphs,
@@ -296,20 +294,20 @@ pango_cairo_fc_font_glyph_extents_cache_init (PangoCairoFcFont *cffont)
cffont->font_extents.x = 0;
cffont->font_extents.width = 0;
- cffont->font_extents.height = PANGO_UNITS (font_extents.ascent + font_extents.descent);
+ cffont->font_extents.height = pango_units_from_double (font_extents.ascent + font_extents.descent);
switch (cffont->gravity)
{
default:
case PANGO_GRAVITY_AUTO:
case PANGO_GRAVITY_SOUTH:
- cffont->font_extents.y = - PANGO_UNITS (font_extents.ascent);
+ cffont->font_extents.y = - pango_units_from_double (font_extents.ascent);
break;
case PANGO_GRAVITY_NORTH:
- cffont->font_extents.y = - PANGO_UNITS (font_extents.descent);
+ cffont->font_extents.y = - pango_units_from_double (font_extents.descent);
break;
case PANGO_GRAVITY_EAST:
case PANGO_GRAVITY_WEST:
- cffont->font_extents.y = - PANGO_UNITS ((font_extents.ascent + font_extents.descent) * 0.5);
+ cffont->font_extents.y = - pango_units_from_double ((font_extents.ascent + font_extents.descent) * 0.5);
}
cffont->glyph_extents_cache = g_new0 (GlyphExtentsCacheEntry, GLYPH_CACHE_NUM_ENTRIES);
@@ -335,11 +333,11 @@ compute_glyph_extents (PangoCairoFcFont *cffont,
&cairo_glyph, 1, &extents);
entry->glyph = glyph;
- entry->width = PANGO_UNITS (extents.x_advance);
- entry->ink_rect.x = PANGO_UNITS (extents.x_bearing);
- entry->ink_rect.y = PANGO_UNITS (extents.y_bearing);
- entry->ink_rect.width = PANGO_UNITS (extents.width);
- entry->ink_rect.height = PANGO_UNITS (extents.height);
+ entry->width = pango_units_from_double (extents.x_advance);
+ entry->ink_rect.x = pango_units_from_double (extents.x_bearing);
+ entry->ink_rect.y = pango_units_from_double (extents.y_bearing);
+ entry->ink_rect.width = pango_units_from_double (extents.width);
+ entry->ink_rect.height = pango_units_from_double (extents.height);
}
static GlyphExtentsCacheEntry *