From 578a9be234a2312ce7bdf2c64ff26331a042826b Mon Sep 17 00:00:00 2001 From: hanwen Date: Thu, 30 Mar 2006 17:53:48 +0000 Subject: [PATCH] * lily/pango-font.cc (pango_item_string_stencil): more robustness. * VERSION (PATCH_LEVEL): bump version number. * flower/include/guile-compatibility.hh (scm_from_uint32): add scm_from_uint32 () * lily/pango-font.cc (pango_item_string_stencil): use scm_from_uint32 () * lily/pango-font.cc (pango_item_string_stencil): only use uXXX glyphnames if we have a ttf font. --- ChangeLog | 7 +++++++ VERSION | 2 +- flower/include/guile-compatibility.hh | 1 + lily/pango-font.cc | 22 +++++++++++++++++----- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b35223412d..694195e31e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2006-03-30 Han-Wen Nienhuys + * lily/pango-font.cc (pango_item_string_stencil): more robustness. + + * VERSION (PATCH_LEVEL): bump version number. + + * flower/include/guile-compatibility.hh (scm_from_uint32): add + scm_from_uint32 () + * lily/pango-font.cc (pango_item_string_stencil): use scm_from_uint32 () diff --git a/VERSION b/VERSION index ac0e56c186..5ab0ec392e 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=9 -PATCH_LEVEL=0 +PATCH_LEVEL=1 MY_PATCH_LEVEL= diff --git a/flower/include/guile-compatibility.hh b/flower/include/guile-compatibility.hh index 022771812a..0ccbe57196 100644 --- a/flower/include/guile-compatibility.hh +++ b/flower/include/guile-compatibility.hh @@ -42,6 +42,7 @@ inline SCM scm_cadar (SCM x) { return SCM_CADAR (x); } #define scm_from_int(x) SCM_MAKINUM (x) #define scm_from_unsigned_integer(x) scm_uint2num (x) #define scm_from_unsigned(x) scm_uint2num (x) +#define scm_from_uint32(x) scm_uint2num (x) #define scm_is_integer(x) SCM_INUMP (x) #define scm_is_string(x) SCM_STRINGP (x) #define scm_hash_table_p scm_vector_p diff --git a/lily/pango-font.cc b/lily/pango-font.cc index 2ea4852ed3..f38c5ff7b5 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -140,7 +140,8 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const SCM *tail = &glyph_exprs; Index_to_charcode_map const *cmap = 0; - if (! (ftface->face_flags & FT_FACE_FLAG_GLYPH_NAMES)) + bool has_glyph_names = ftface->face_flags & FT_FACE_FLAG_GLYPH_NAMES; + if (! has_glyph_names) cmap = ((Pango_font*)this)->get_index_to_charcode_map (file_name, ftface); bool cid_keyed = false; @@ -151,8 +152,14 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const PangoGlyph pg = pgi->glyph; PangoGlyphGeometry ggeo = pgi->geometry; - FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN); - + glyph_name[0] = '\0'; + if (has_glyph_names) + { + int errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN); + if (errorcode) + programming_error ("FT_Get_Glyph_Name returns error"); + } + SCM char_id = SCM_EOL; if (glyph_name[0] == '\0' && cmap @@ -164,8 +171,13 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const FT_ULong char_code = cmap->find (pg)->second; get_unicode_name (glyph_name, char_code); } - - + + if (glyph_name[0] == '\0' && has_glyph_names) + { + programming_error ("Glyph has no name, but font supports glyph naming"); + continue; + } + if (glyph_name[0] == '\0') { /* -- 2.39.5