summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6fd9215)
raw | patch | inline | side by side (parent: 6fd9215)
author | ozmikepittman <ozmikepittman@users.sourceforge.net> | |
Fri, 28 Mar 2008 00:22:49 +0000 (00:22 +0000) | ||
committer | ozmikepittman <ozmikepittman@users.sourceforge.net> | |
Fri, 28 Mar 2008 00:22:49 +0000 (00:22 +0000) |
src/extension/internal/cairo-render-context.cpp | patch | blob | history |
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index a040d5c099c387a9f0bce9ccc2d59abc1f52675c..5fbdfcf3ce438dc72c71700ae12c639775cc5ec7 100644 (file)
#include "sp-pattern.h"
#include "sp-mask.h"
#include "sp-clippath.h"
+#ifdef WIN32
+#include "FontFactory.h" // USE_PANGO_WIN32
+##endif
#include <unit-constants.h>
#ifdef CAIRO_HAS_FT_FONT
#include <cairo-ft.h>
#endif
+#ifdef CAIRO_HAS_WIN32_FONT
+#include <cairo-win32.h>
+#include <pango/pangowin32.h>
+#endif
#include <pango/pangofc-fontmap.h>
@@ -1418,16 +1425,33 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, NR::Matrix const *font_matr
{
// create a cairo_font_face from PangoFont
double size = style->font_size.computed;
+ cairo_font_face_t *font_face = NULL;
+
+ FcPattern *fc_pattern = NULL;
+
+#ifdef USE_PANGO_WIN32
+# ifdef CAIRO_HAS_WIN32_FONT
+ LOGFONTA *lfa = pango_win32_font_logfont(font);
+ LOGFONTW lfw;
+
+ ZeroMemory(&lfw, sizeof(LOGFONTW));
+ memcpy(&lfw, lfa, sizeof(LOGFONTA));
+ MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, lfa->lfFaceName, LF_FACESIZE, lfw.lfFaceName, LF_FACESIZE);
+
+ font_face = cairo_win32_font_face_create_for_logfontw(&lfw);
+# endif
+#else
+# ifdef CAIRO_HAS_FT_FONT
PangoFcFont *fc_font = PANGO_FC_FONT(font);
- FcPattern *fc_pattern = fc_font->font_pattern;
-
+ fc_pattern = fc_font->font_pattern;
+ font_face = cairo_ft_font_face_create_for_pattern(fc_pattern);
+# endif
+#endif
+
cairo_save(_cr);
-
-#ifdef CAIRO_HAS_FT_FONT
- cairo_font_face_t *font_face = cairo_ft_font_face_create_for_pattern(fc_pattern);
cairo_set_font_face(_cr, font_face);
- if (FcPatternGetDouble(fc_pattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
+ if (fc_pattern && FcPatternGetDouble(fc_pattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch)
size = 12.0;
// set the given font matrix
@@ -1468,13 +1492,8 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, NR::Matrix const *font_matr
cairo_restore(_cr);
- cairo_font_face_destroy(font_face);
-#else
- (void)size;
- (void)fc_pattern;
-
- cairo_restore(_cr);
-#endif
+ if (font_face)
+ cairo_font_face_destroy(font_face);
return true;
}