[gimp/gimp-2-8] Bug 681895: PDF export does not save fonts properly
- From: Massimo Valentini <mvalentini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 681895: PDF export does not save fonts properly
- Date: Wed, 28 Jan 2015 18:40:19 +0000 (UTC)
commit cca7f6f8a3ca04dae46adbe9858ad377dde113fd
Author: Massimo Valentini <mvalentini src gnome org>
Date: Wed Jan 28 19:31:32 2015 +0100
Bug 681895: PDF export does not save fonts properly
Set the resolution of the PangoFontMap from which the
PangoContext is created, set cairo font options only
on the PangoContext, explicitely set wrap mode and
do not force a layout height.
(cherry picked from commit a215fbda56381db42730d70d809628c86adc3711)
Conflicts:
plug-ins/common/file-pdf-save.c
plug-ins/common/file-pdf-save.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-save.c b/plug-ins/common/file-pdf-save.c
index 7c1d2f2..5141abd 100644
--- a/plug-ins/common/file-pdf-save.c
+++ b/plug-ins/common/file-pdf-save.c
@@ -1522,6 +1522,7 @@ drawText (GimpDrawable *text_layer,
gdouble letter_spacing;
PangoAttribute *letter_spacing_at;
PangoAttrList *attr_list = pango_attr_list_new ();
+ PangoFontMap *fontmap;
cairo_save (cr);
@@ -1572,8 +1573,13 @@ drawText (GimpDrawable *text_layer,
/* We are done with cairo's settings.
* It's time to create the context */
- cairo_set_font_options (cr, options);
- context = pango_cairo_create_context (cr);
+ fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
+
+ pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (fontmap), y_res);
+
+ context = pango_font_map_create_context (fontmap);
+ g_object_unref (fontmap);
+
pango_cairo_context_set_font_options (context, options);
/* Text Direction */
@@ -1589,6 +1595,7 @@ drawText (GimpDrawable *text_layer,
/* We are done with the context's settings.
* It's time to create the layout */
layout = pango_layout_new (context);
+ pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
/* Font */
font_family = gimp_text_layer_get_font (text_id);
@@ -1603,9 +1610,8 @@ drawText (GimpDrawable *text_layer,
pango_layout_set_font_description (layout, font_description);
- /* Width and height */
+ /* Width */
pango_layout_set_width (layout, text_layer->width * PANGO_SCALE);
- pango_layout_set_height (layout, text_layer->height * PANGO_SCALE);
/* Justification, and Alignment */
justify = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]