From 560d0115224bba89deef006c296724545732439c Mon Sep 17 00:00:00 2001 From: hanwen Date: Thu, 30 Mar 2006 22:55:36 +0000 Subject: [PATCH] (pango_item_string_stencil): update from 2.9.x --- ChangeLog | 4 ++++ lily/chord-tremolo-engraver.cc | 1 + lily/pango-font.cc | 31 ++++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8749767bb3..744e4f6757 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-03-31 Han-Wen Nienhuys + + * lily/pango-font.cc (pango_item_string_stencil): update from 2.9.x + 2006-03-30 Han-Wen Nienhuys * lily/ttf.cc (print_trailer): only print existing glyphs. diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 9c6cd1069f..29fe53cbc5 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -176,6 +176,7 @@ Chord_tremolo_engraver::acknowledge_stem (Grob_info info) stem_tremolo_->set_object ("stem", info.grob ()->self_scm ()); stem_tremolo_->set_parent (info.grob (), X_AXIS); + info.grob ()->set_object ("tremolo-flag", stem_tremolo_->self_scm ()); } } diff --git a/lily/pango-font.cc b/lily/pango-font.cc index 0dd9633860..56ce037137 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,23 +152,39 @@ 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 - SCM char_id; - if (glyph_name[0] == '\0' && cmap) + /* Ugh should ask FreeType about font type. */ + && (file_name.find (".ttf") != NPOS + || file_name.find (".TTF") != NPOS)) { 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. Skipping glyph."); + continue; + } + if (glyph_name[0] == '\0') { /* CID entry */ cid_keyed = true; - char_id = scm_from_int (pg); + char_id = scm_from_unsigned_integer (pg); } else char_id = scm_makfrom0str (glyph_name); -- 2.39.5