diff options
author | Owen Taylor <otaylor@redhat.com> | 2005-04-07 19:37:24 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2005-04-07 19:37:24 +0000 |
commit | 0c5ab1f6e0322689bbbed382a079a5e82e0c0be1 (patch) | |
tree | ac5660775082f24212cd0360a510ebcfa26ce294 | |
parent | 545c18d269ec738dce4f30affb265440bec27574 (diff) | |
download | pango-0c5ab1f6e0322689bbbed382a079a5e82e0c0be1.tar.gz |
Test for renamed cairo_win32_scaled_font_select_font().
2005-04-07 Owen Taylor <otaylor@redhat.com>
* configure.in: Test for renamed
cairo_win32_scaled_font_select_font().
* pango/pangocairo-win32font.c: Fix various compilation errors.
* pango/pangocairo-fcfont.c pango/pangocairo-win32font.c
pango/pangocairo-fontmap.c: Use new matrix API.
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 10 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | pango/pangocairo-fcfont.c | 54 | ||||
-rw-r--r-- | pango/pangocairo-fontmap.c | 9 | ||||
-rw-r--r-- | pango/pangocairo-win32font.c | 66 |
6 files changed, 71 insertions, 80 deletions
@@ -1,5 +1,15 @@ 2005-04-07 Owen Taylor <otaylor@redhat.com> + * configure.in: Test for renamed + cairo_win32_scaled_font_select_font(). + + * pango/pangocairo-win32font.c: Fix various compilation errors. + + * pango/pangocairo-fcfont.c pango/pangocairo-win32font.c + pango/pangocairo-fontmap.c: Use new matrix API. + +2005-04-07 Owen Taylor <otaylor@redhat.com> + * pango/pangocairo-fcfont.c pango/pangocairo-win32font.c pango/pangocairo-render.c: Update to new Cairo font API. diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 40c02a72..9958767e 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,5 +1,15 @@ 2005-04-07 Owen Taylor <otaylor@redhat.com> + * configure.in: Test for renamed + cairo_win32_scaled_font_select_font(). + + * pango/pangocairo-win32font.c: Fix various compilation errors. + + * pango/pangocairo-fcfont.c pango/pangocairo-win32font.c + pango/pangocairo-fontmap.c: Use new matrix API. + +2005-04-07 Owen Taylor <otaylor@redhat.com> + * pango/pangocairo-fcfont.c pango/pangocairo-win32font.c pango/pangocairo-render.c: Update to new Cairo font API. diff --git a/configure.in b/configure.in index f927fe52..8d280440 100644 --- a/configure.in +++ b/configure.in @@ -279,7 +279,7 @@ PKG_CHECK_MODULES(CAIRO, cairo >= 0.2.0, have_cairo=true, :) if $have_cairo ; then pango_save_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS $CAIRO_LIBS" - AC_CHECK_LIB(cairo, cairo_win32_font_select_font, have_cairo_win32=true, :) + AC_CHECK_LIB(cairo, cairo_win32_scaled_font_select_font, have_cairo_win32=true, :) if $have_cairo_win32 && $have_win32; then AC_DEFINE(HAVE_CAIRO_WIN32, 1, [Whether Cairo uses the Win32 GDI for fonts]) else diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c index 19076cf8..27a20e0e 100644 --- a/pango/pangocairo-fcfont.c +++ b/pango/pangocairo-fcfont.c @@ -48,8 +48,8 @@ struct _PangoCairoFcFont cairo_font_face_t *font_face; cairo_scaled_font_t *scaled_font; - cairo_matrix_t *font_matrix; - cairo_matrix_t *ctm; + cairo_matrix_t font_matrix; + cairo_matrix_t ctm; }; struct _PangoCairoFcFontClass @@ -96,8 +96,8 @@ pango_cairo_fc_font_get_scaled_font (PangoCairoFont *font) font_face = pango_cairo_fc_font_get_font_face (font); cffont->scaled_font = cairo_scaled_font_create (font_face, - cffont->font_matrix, - cffont->ctm); + &cffont->font_matrix, + &cffont->ctm); /* Failure of the above should only occur for out of memory, * we can't proceed at that point @@ -121,7 +121,7 @@ pango_cairo_fc_font_install (PangoCairoFont *font, cairo_set_font_face (cr, pango_cairo_fc_font_get_font_face (font)); - cairo_transform_font (cr, cffont->font_matrix); + cairo_transform_font (cr, &cffont->font_matrix); } static void @@ -143,9 +143,6 @@ pango_cairo_fc_font_finalize (GObject *object) if (cffont->scaled_font) cairo_scaled_font_destroy (cffont->scaled_font); - cairo_matrix_destroy (cffont->font_matrix); - cairo_matrix_destroy (cffont->ctm); - G_OBJECT_CLASS (pango_cairo_fc_font_parent_class)->finalize (object); } @@ -382,44 +379,37 @@ _pango_cairo_fc_font_new (PangoCairoFcFontMap *cffontmap, "pattern", pattern, NULL); - cffont->font_matrix = cairo_matrix_create (); - if (FcPatternGetMatrix (pattern, FC_MATRIX, 0, &fc_matrix) == FcResultMatch) { - cairo_matrix_t *tmp_matrix; - - tmp_matrix = cairo_matrix_create (); - cairo_matrix_set_affine (tmp_matrix, - fc_matrix->xx, - - fc_matrix->yx, - - fc_matrix->xy, - fc_matrix->yy, - 0., 0.); - - cairo_matrix_multiply (cffont->font_matrix, - cffont->font_matrix, tmp_matrix); - cairo_matrix_destroy (tmp_matrix); + cairo_matrix_init (&cffont->font_matrix, + fc_matrix->xx, + - fc_matrix->yx, + - fc_matrix->xy, + fc_matrix->yy, + 0., 0.); } + else + cairo_matrix_init_identity (&cffont->font_matrix); if (pango_font_description_get_size_is_absolute (desc)) size = pango_font_description_get_size (desc); else size = cffontmap->dpi * pango_font_description_get_size (desc) / 72.; - cairo_matrix_scale (cffont->font_matrix, + cairo_matrix_scale (&cffont->font_matrix, size / PANGO_SCALE, size / PANGO_SCALE); - cffont->ctm = cairo_matrix_create (); - pango_ctm = pango_context_get_matrix (context); if (pango_ctm) - cairo_matrix_set_affine (cffont->ctm, - pango_ctm->xx, - pango_ctm->yx, - pango_ctm->xy, - pango_ctm->yy, - 0., 0.); + cairo_matrix_init (&cffont->ctm, + pango_ctm->xx, + pango_ctm->yx, + pango_ctm->xy, + pango_ctm->yy, + 0., 0.); + else + cairo_matrix_init_identity (&cffont->ctm); return PANGO_FC_FONT (cffont); } diff --git a/pango/pangocairo-fontmap.c b/pango/pangocairo-fontmap.c index bdbb72f9..f448e3d9 100644 --- a/pango/pangocairo-fontmap.c +++ b/pango/pangocairo-fontmap.c @@ -209,22 +209,19 @@ void pango_cairo_update_context (cairo_t *cr, PangoContext *context) { - cairo_matrix_t *cairo_matrix; + cairo_matrix_t cairo_matrix; PangoMatrix pango_matrix; g_return_if_fail (cr != NULL); g_return_if_fail (PANGO_IS_CONTEXT (context)); - cairo_matrix = cairo_matrix_create (); - cairo_current_matrix (cr, cairo_matrix); - cairo_matrix_get_affine (cairo_matrix, + cairo_current_matrix (cr, &cairo_matrix); + cairo_matrix_get_affine (&cairo_matrix, &pango_matrix.xx, &pango_matrix.yx, &pango_matrix.xy, &pango_matrix.yy, &pango_matrix.x0, &pango_matrix.y0); pango_context_set_matrix (context, &pango_matrix); - - cairo_matrix_destroy (cairo_matrix); } /** diff --git a/pango/pangocairo-win32font.c b/pango/pangocairo-win32font.c index 4cb42b1d..ff9b5d85 100644 --- a/pango/pangocairo-win32font.c +++ b/pango/pangocairo-win32font.c @@ -46,11 +46,11 @@ struct _PangoCairoWin32Font int size; - cairo_font_face_t font_face; + cairo_font_face_t *font_face; cairo_scaled_font_t *scaled_font; - cairo_matrix_t *font_matrix; - cairo_matrix_t *total_matrix; + cairo_matrix_t font_matrix; + cairo_matrix_t ctm; PangoFontMetrics *metrics; }; @@ -110,8 +110,8 @@ pango_cairo_win32_font_get_scaled_font (PangoCairoFont *font) font_face = pango_cairo_win32_font_get_font_face (font); cffont->scaled_font = cairo_scaled_font_create (font_face, - cffont->font_matrix, - cffont->ctm); + &cffont->font_matrix, + &cffont->ctm); /* Failure of the above should only occur for out of memory, * we can't proceed at that point @@ -135,7 +135,7 @@ pango_cairo_win32_font_install (PangoCairoFont *font, cairo_set_font_face (cr, pango_cairo_win32_font_get_font_face (font)); - cairo_transform_font (cr, cffont->font_matrix); + cairo_transform_font (cr, &cffont->font_matrix); } static void @@ -158,20 +158,16 @@ pango_cairo_win32_font_finalize (GObject *object) if (cwfont->scaled_font) cairo_scaled_font_destroy (cwfont->scaled_font); - cairo_matrix_destroy (cwfont->total_matrix); - cairo_matrix_destroy (cwfont->font_matrix); - G_OBJECT_CLASS (pango_cairo_win32_font_parent_class)->finalize (object); } static void pango_cairo_win32_font_get_glyph_extents (PangoFont *font, - PangoGlyph glyph, - PangoRectangle *ink_rect, - PangoRectangle *logical_rect) + PangoGlyph glyph, + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { - PangoCairoWin32Font *cwfont = PANGO_CAIRO_WIN32_FONT (font); - cairo_scaled_font_t *scaled__font; + cairo_scaled_font_t *scaled_font; cairo_text_extents_t extents; cairo_glyph_t cairo_glyph; @@ -181,7 +177,7 @@ pango_cairo_win32_font_get_glyph_extents (PangoFont *font, cairo_glyph.x = 0; cairo_glyph.y = 0; - cairo_scaled_font_glyph_extents (scaled_font, cwfont->font_matrix, + cairo_scaled_font_glyph_extents (scaled_font, &cairo_glyph, 1, &extents); if (ink_rect) @@ -196,8 +192,7 @@ pango_cairo_win32_font_get_glyph_extents (PangoFont *font, { cairo_font_extents_t font_extents; - cairo_scaled_font_extents (scaled_font, cwfont->font_matrix, - &font_extents); + cairo_scaled_font_extents (scaled_font, &font_extents); logical_rect->x = 0; logical_rect->y = - font_extents.ascent * PANGO_SCALE; @@ -215,14 +210,13 @@ pango_cairo_win32_font_get_metrics (PangoFont *font, if (!cwfont->metrics) { double height; - cairo_sacled_font_t *scaled_font; + cairo_scaled_font_t *scaled_font; cairo_font_extents_t font_extents; cwfont->metrics = pango_font_metrics_new (); scaled_font = pango_cairo_win32_font_get_scaled_font (PANGO_CAIRO_FONT (font)); - cairo_scaled_font_extents (scaled_font, cwfont->font_matrix, - &font_extents); + cairo_scaled_font_extents (scaled_font, &font_extents); cwfont->metrics->ascent = font_extents.ascent * PANGO_SCALE; cwfont->metrics->descent = font_extents.ascent * PANGO_SCALE; @@ -252,7 +246,7 @@ pango_cairo_win32_font_select_font (PangoFont *font, static void pango_cairo_win32_font_done_font (PangoFont *font) { - cairo_font_t *scaled_font = pango_cairo_win32_font_get_scaled_font (PANGO_CAIRO_FONT (font)); + cairo_scaled_font_t *scaled_font = pango_cairo_win32_font_get_scaled_font (PANGO_CAIRO_FONT (font)); cairo_win32_scaled_font_done_font (scaled_font); } @@ -321,30 +315,20 @@ _pango_cairo_win32_font_new (PangoCairoWin32FontMap *cwfontmap, */ win32font->size = size * PANGO_SCALE; - cwfont->font_matrix = cairo_matrix_create (); - cairo_matrix_scale (cwfont->font_matrix, size, size); - - cwfont->total_matrix = cairo_matrix_create (); + cairo_matrix_init_scale (&cwfont->font_matrix, + size, size); pango_ctm = pango_context_get_matrix (context); if (pango_ctm) - { - cairo_matrix_t *ctm; - - ctm = cairo_matrix_create (); - cairo_matrix_set_affine (ctm, - pango_ctm->xx, - pango_ctm->yx, - pango_ctm->xy, - pango_ctm->yy, - 0., 0.); - - cairo_matrix_multiply (cwfont->total_matrix, cwfont->font_matrix, ctm); - cairo_matrix_destroy (ctm); - } + cairo_matrix_init (&cwfont->ctm, + pango_ctm->xx, + pango_ctm->yx, + pango_ctm->xy, + pango_ctm->yy, + 0., 0.); else - cairo_matrix_copy (cwfont->total_matrix, cwfont->font_matrix); - + cairo_matrix_init_identity (&cwfont->ctm); + pango_win32_make_matching_logfont (win32font->fontmap, &face->logfont, win32font->size, |