作図ソフト dia の改良版
修訂 | a913f6f6a49fe0b41efed1ab1a951156e0f3c746 (tree) |
---|---|
時間 | 2009-08-20 02:11:31 |
作者 | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
Bug #591403 - allow DiaCairoRenderer::set_font() even before call to begin()
@@ -305,10 +305,6 @@ static void | ||
305 | 305 | set_font(DiaRenderer *self, DiaFont *font, real height) |
306 | 306 | { |
307 | 307 | DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self); |
308 | -#ifndef HAVE_PANGOCAIRO_H | |
309 | - DiaFontStyle style = dia_font_get_style (font); | |
310 | - const char *family_name; | |
311 | -#endif | |
312 | 308 | /* pango/cairo wants the font size, not the (line-) height */ |
313 | 309 | real size = dia_font_get_size (font) * (height / dia_font_get_height (font)); |
314 | 310 |
@@ -321,18 +317,21 @@ set_font(DiaRenderer *self, DiaFont *font, real height) | ||
321 | 317 | pango_layout_set_font_description (renderer->layout, pfd); |
322 | 318 | pango_font_description_free (pfd); |
323 | 319 | #else |
324 | - family_name = dia_font_get_family(font); | |
325 | - | |
326 | - cairo_select_font_face ( | |
327 | - renderer->cr, | |
328 | - family_name, | |
329 | - DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : CAIRO_FONT_SLANT_ITALIC, | |
330 | - DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : CAIRO_FONT_WEIGHT_BOLD); | |
331 | - cairo_set_font_size (renderer->cr, size); | |
320 | + if (renderer->cr) { | |
321 | + DiaFontStyle style = dia_font_get_style (font); | |
322 | + const char *family_name = dia_font_get_family(font); | |
323 | + | |
324 | + cairo_select_font_face ( | |
325 | + renderer->cr, | |
326 | + family_name, | |
327 | + DIA_FONT_STYLE_GET_SLANT(style) == DIA_FONT_NORMAL ? CAIRO_FONT_SLANT_NORMAL : CAIRO_FONT_SLANT_ITALIC, | |
328 | + DIA_FONT_STYLE_GET_WEIGHT(style) < DIA_FONT_MEDIUM ? CAIRO_FONT_WEIGHT_NORMAL : CAIRO_FONT_WEIGHT_BOLD); | |
329 | + cairo_set_font_size (renderer->cr, size); | |
330 | + | |
331 | + DIAG_STATE(renderer->cr) | |
332 | + } | |
332 | 333 | #endif |
333 | 334 | |
334 | - DIAG_STATE(renderer->cr) | |
335 | - | |
336 | 335 | /* for the interactive case we must maintain the font field in the base class */ |
337 | 336 | if (self->is_interactive) { |
338 | 337 | dia_font_ref(font); |