]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/ttf.cc (print_trailer): use it.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 28 Mar 2006 16:54:50 +0000 (16:54 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 28 Mar 2006 16:54:50 +0000 (16:54 +0000)
* lily/pango-font.cc (get_unicode_name): new function.

* lily/ttf.cc (make_index_to_charcode_map): move function from
open-type-font.cc
(print_trailer): substitute uniXXXX name if applicable.

* lily/pango-font.cc (get_index_to_charcode_map): new function.
(pango_item_string_stencil): use it to generate uniXXXX names.

ChangeLog
lily/include/open-type-font.hh
lily/pango-font.cc
lily/ttf.cc

index 29e3ea938ee77be8ab07bb5b134d05b03e8086f4..eaae776e40fb71f24759bebeec96761c2d58bbb2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-03-28  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * lily/ttf.cc (print_trailer): use it.
+
+       * lily/pango-font.cc (get_unicode_name): new function.
+
        * lily/ttf.cc (make_index_to_charcode_map): move function from
        open-type-font.cc
        (print_trailer): substitute uniXXXX name if applicable. 
index 462837e5956d8e48ce670db9cc1cbb57d89fdd53..be1f85bf7accd9f04d06c47d2912beed86e2e191 100644 (file)
@@ -17,6 +17,7 @@ using namespace std;
 
 typedef map<FT_UInt, FT_ULong> Index_to_charcode_map;
 Index_to_charcode_map make_index_to_charcode_map (FT_Face face);
+void get_unicode_name (char*s, FT_ULong code);
 
 class Open_type_font : public Font_metric
 {
index 76ccfbc66d39ce2fbb20f1660a2e1d09a01a1999..6419187dbf018b47d809603b3de61313488280e2 100644 (file)
@@ -88,6 +88,16 @@ Pango_font::get_index_to_charcode_map (string key, FT_Face face)
   return &charcode_maps_[key];
 }
 
+void
+get_unicode_name (char*s, FT_ULong code)
+{
+  if (code > 0xFFFF)
+    sprintf (s,  "u%06lX", char_code);
+  else
+    sprintf (s,  "uni%04lX", char_code);
+}
+
+
 Stencil
 Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
 {
@@ -147,9 +157,9 @@ Pango_font::pango_item_string_stencil (PangoItem const *item, string str) const
       if (glyph_name[0] == '\0' && cmap)
        {
          FT_ULong char_code = cmap->find (pg)->second;
-         
-         sprintf (glyph_name,  "uni%04lX", char_code);
+         get_unicode_name (glyph_name, char_code);
        }
+      
   
       if (glyph_name[0] == '\0')
        {
index 8d22ccee181e0b077c0dda5e77123dbca7bd919c..a3f85297672cebd36c8faceb32f93341df363ee2 100644 (file)
@@ -165,7 +165,7 @@ print_trailer (void *out,
 
       if (!glyph_name[0])
        {
-         sprintf (glyph_name, "uni%04lX", ic_map[i]);
+         get_unicode_name (glyph_name, ic_map[i]);
        }
       
       lily_cookie_fprintf (out, "/%s %d def ", glyph_name, i);