]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/ttf.cc (LY_DEFINE): new function ly:font-glyph-list.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 21 Jan 2006 14:16:35 +0000 (14:16 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 21 Jan 2006 14:16:35 +0000 (14:16 +0000)
* lily/ttf.cc (LY_DEFINE): ly:ttf-ps-name: new routine to extract
PS name from TTF font.

ChangeLog
lily/ttf.cc

index 17ac4de2e42f458578a034de9567f6b067ba89b5..a4272d482c85faf492a8795419ba9d5783dd1b57 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-01-21  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/ttf.cc (LY_DEFINE): new function ly:font-glyph-list.
+
+       * VERSION (PACKAGE_NAME): release 2.7.28
+
        * scm/framework-ps.scm (write-preamble): use it to pick exactly
        the right font from a Mac dfont.
        (write-preamble): don't forget directory, only look at files.
 
 2006-01-07  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * VERSION: release 2.7.27
+
        * lily/bar-line.cc (calc_bar_size): inspect staff->extent (Y_AXIS)
        for determining bar size.
 
index 14d58411f7e0693a0b0b9367da6af3b37e5e5ef4..f1163e884cec7808a3bae4d2c8af18ad820c6e99 100644 (file)
@@ -159,6 +159,39 @@ create_type42_font (void *out, String name)
   print_header (out, face);
   print_body (out, name);
   print_trailer (out, face);
+
+  FT_Done_Face (face);
+}
+
+LY_DEFINE (ly_font_glyph_list, "ly:font-glyph-list",
+          1, 0, 0, (SCM font_file_name),
+          "Return a list of glyphnames for @var{font-file-name}.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (font_file_name), font_file_name,
+                  SCM_ARG1, __FUNCTION__, "string");
+
+  String file_name = ly_scm2string (font_file_name);
+  if (be_verbose_global)
+    progress_indication ("[" + file_name);
+
+  SCM retval = SCM_EOL;
+  SCM *tail = &retval;
+  
+  FT_Face face = open_ft_face (file_name);
+  for (int i = 0; i < face->num_glyphs; i++)
+    {
+      const int len = 256;
+      char name[len];
+      int code = FT_Get_Glyph_Name (face, i, name, len);
+      if (code)
+       warning (_f ("FT_Get_Glyph_Name() returned error: %d", code));
+
+      *tail = scm_cons (scm_makfrom0str (name), SCM_EOL);
+      tail = SCM_CDRLOC (*tail);
+    }
+  
+  FT_Done_Face (face);
+  return retval;
 }
 
 LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-name",
@@ -177,9 +210,12 @@ LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-name",
   if (be_verbose_global)
     progress_indication ("]");
 
+  FT_Done_Face (face);
   return scm_makfrom0str (ps_name_str0 ? ps_name_str0 : "");
 }
 
+
+
 LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa",
           1, 0, 0, (SCM ttf_file_name),
           "Convert the contents of a TTF file to Type42 PFA, returning it as "