From 317da518928f4b721c1976f359f2d559bc42f973 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 3 Jan 2005 22:30:01 +0000 Subject: [PATCH] (text_stencil): dump string as (utf-8-string FONTDESC UTF8) for use in -f gnome, -f svg. --- ChangeLog | 5 +++++ lily/include/pango-font.hh | 1 + lily/pango-font.cc | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1a23de0933..046552ddd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-01-03 Han-Wen Nienhuys + + * lily/pango-font.cc (text_stencil): dump string as (utf-8-string + FONTDESC UTF8) for use in -f gnome, -f svg. + 2005-01-03 Jan Nieuwenhuizen * configure.in (gui_b): Remove handy developer-only diff --git a/lily/include/pango-font.hh b/lily/include/pango-font.hh index 55e566eb65..77139c08b8 100644 --- a/lily/include/pango-font.hh +++ b/lily/include/pango-font.hh @@ -22,6 +22,7 @@ class Pango_font : public Font_metric { PangoContext *context_; + PangoFontDescription *description_; PangoAttrList *attribute_list_; Real scale_; SCM subfonts_; diff --git a/lily/pango-font.cc b/lily/pango-font.cc index 042ac350a6..fbdf13ba05 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -30,6 +30,8 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap, : PANGO_DIRECTION_RTL; context_ = pango_ft2_get_context (PANGO_RESOLUTION, PANGO_RESOLUTION); + + description_ = pango_font_description_copy (description); // context_ = pango_ft2_font_map_create_context (fontmap); attribute_list_= pango_attr_list_new(); @@ -47,6 +49,7 @@ Pango_font::Pango_font (PangoFT2FontMap *fontmap, Pango_font::~Pango_font () { + pango_font_description_free (description_); g_object_unref (context_); pango_attr_list_unref (attribute_list_); } @@ -130,6 +133,13 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con return item_stencil; } +Stencil +Pango_font::direct_pango_text_stencil (String str) const +{ + + +} + Stencil Pango_font::text_stencil (String str) const { @@ -154,6 +164,21 @@ Pango_font::text_stencil (String str) const ptr = ptr->next; } + if (output_format_global != "ps") + { + /* + For Pango based backends, we take a shortcut. + */ + SCM exp + = scm_list_3 (ly_symbol2scm ("utf-8-string"), + scm_makfrom0str (pango_font_description_to_filename (description_)), + scm_makfrom0str (str.to_str0 ())); + + + return Stencil (dest.extent_box (), + exp); + } + return dest; } -- 2.39.2