* 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.
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.
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
{
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
{
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')
{
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);