[dia/dia-0-97] Bug #591403 - allow DiaCairoRenderer::set_font() even before call to begin()



commit 26fcae24cf917dd934511dfef0dacb966da7e522
Author: Hans Breuer <hans breuer org>
Date:   Wed Aug 19 19:11:31 2009 +0200

    Bug #591403 - allow DiaCairoRenderer::set_font() even before call to begin()
    (cherry picked from commit a913f6f6a49fe0b41efed1ab1a951156e0f3c746)

 plug-ins/cairo/diacairo-renderer.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index 09610a3..1ab5cbf 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -305,10 +305,6 @@ static void
 set_font(DiaRenderer *self, DiaFont *font, real height)
 {
   DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
-#ifndef HAVE_PANGOCAIRO_H
-  DiaFontStyle style = dia_font_get_style (font);
-  const char *family_name;
-#endif
   /* pango/cairo wants the font size, not the (line-) height */
   real size = dia_font_get_size (font) * (height / dia_font_get_height (font));
 
@@ -321,18 +317,21 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
   pango_layout_set_font_description (renderer->layout, pfd);
   pango_font_description_free (pfd);
 #else
-  family_name = dia_font_get_family(font);
-
-  cairo_select_font_face (
-      renderer->cr,
-      family_name,
-      DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : CAIRO_FONT_SLANT_ITALIC,
-      DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : CAIRO_FONT_WEIGHT_BOLD); 
-  cairo_set_font_size (renderer->cr, size);
+  if (renderer->cr) {
+    DiaFontStyle style = dia_font_get_style (font);
+    const char *family_name = dia_font_get_family(font);
+
+    cairo_select_font_face (
+        renderer->cr,
+        family_name,
+        DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : CAIRO_FONT_SLANT_ITALIC,
+        DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : CAIRO_FONT_WEIGHT_BOLD); 
+    cairo_set_font_size (renderer->cr, size);
+
+    DIAG_STATE(renderer->cr)
+  }
 #endif
 
-  DIAG_STATE(renderer->cr)
-  
   /* for the interactive case we must maintain the font field in the base class */
   if (self->is_interactive) {
     dia_font_ref(font);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]