]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/framework-ps.scm (write-preamble): embed CFFs if file name
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 8 May 2005 13:17:15 +0000 (13:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 8 May 2005 13:17:15 +0000 (13:17 +0000)
matches .otf

* lily/pfb.cc (Module): new function ly:otf->cff

* lily/open-type-font.cc (get_otf_table): use ::get_otf_table
(get_otf_table): new function.

ChangeLog
lexer-gcc-3.1.sh
lily/include/open-type-font.hh
lily/open-type-font.cc
lily/pfb.cc
scm/framework-ps.scm

index 9514332092d5e33967212f3ef7624b42689e50df..299db8485098e359739f4b4799007372297cb1c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-05-08  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/framework-ps.scm (write-preamble): embed CFFs if file name
+       matches .otf
+
+       * lily/pfb.cc (Module): new function ly:otf->cff
+
+       * lily/open-type-font.cc (get_otf_table): use ::get_otf_table
+       (get_otf_table): new function.
+
+2005-05-07  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/backend-library.scm (postscript->png): call lilypond-ps2png
+       iso. ps2png.
+
 2005-05-06  Heikki Junes  <hjunes@cc.hut.fi>
 
        * po/fi.po: apply second round of update.
index c9b8a389d64bb86040c8857a37b12f37f541f7f3..1898f27eb8b5f9cefc9ba97d3806cd8a5de0430e 100755 (executable)
@@ -8,7 +8,7 @@ FLEXLEXER=OK
 
 if [ -z "$FLEXLEXER" ]; then
 
-includes="$HOME/usr/include /usr/local/include /usr/include"
+includes="$HOME/usr/include $PREFIX/include /usr/local/include /usr/include" 
 
 for i in $includes; do
     file=$i/FlexLexer.h
@@ -43,9 +43,9 @@ if [ -z "$FLEXLEXER" ]; then
 echo -n "Copying and fixing $file... "
 mkdir -p lily/$outdir
 rm -f lily/$outdir/FlexLexer.h
-sed -e 's/iostream.h/iostream/' \
-    -e 's/\<istream\>/std::istream/' \
-    -e 's/\<ostream\>/std::ostream/' \
+perl -p -e 's/iostream.h/iostream/g;' \
+    -e 's/\bistream\b/std::istream/g;' \
+    -e 's/\bostream\b/std::ostream/' \
     $file > lily/$outdir/FlexLexer.h
 echo "done"
 
@@ -58,9 +58,9 @@ if [ -f GNUmakefile ]; then
     make conf=$CONF -C lily $outdir/lexer.cc > /dev/null 2>&1 || true
 
     mv $file $file.orig
-    sed -e 's/\<cin\>/std::cin/g' \
-       -e 's/\<cout\>/std::cout/g' \
-       -e 's/\<cerr\>/std::cerr/g' \
+    perl -p -e 's/\bcin\b/std::cin/g;' \
+       -e 's/\bcout\b/std::cout/g;' \
+       -e 's/\bcerr\b/std::cerr/g' \
        $file.orig > $file
     echo "done"
 fi
index 918a2cc5cb6cc5f969437d0c72f8d7dfa0da88ca..02278dbf2337cdebbc739d277a8f7d13b697393f 100644 (file)
@@ -44,13 +44,10 @@ public:
   virtual unsigned index_to_charcode (int) const;
   virtual void derived_mark () const;
   virtual SCM sub_fonts () const;
-#if 0
-  virtual int count () const;
-  virtual int index_to_ascii (int) const;
-  virtual Box get_ascii_char (int) const;
-  virtual Offset get_indexed_wxwy (int) const;
-#endif
   virtual Real design_size () const;
 };
 
+String get_otf_table (FT_Face face, String tag);
+FT_Face open_ft_face (String str);
+
 #endif /* OPEN_TYPE_FONT_HH */
index 6c82e91f216f3b0c095507a1feab8ea5a058df3a..ddd6b7c80e1bda6f9c02cccae821ec3ba5af5130 100644 (file)
@@ -42,13 +42,11 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length)
   return 0;
 }
 
+
 String
 Open_type_font::get_otf_table (String tag) const
 {
-  FT_ULong len;
-  FT_Byte *tab = load_table (tag.to_str0 (), face_,  &len);
-
-  return String (tab, len);
+  return ::get_otf_table (face_, tag);
 }
 
 SCM
@@ -87,8 +85,21 @@ Open_type_font::~Open_type_font ()
   FT_Done_Face (face_);
 }
 
-SCM
-Open_type_font::make_otf (String str)
+
+/*
+  UGH fix naming
+*/
+String
+get_otf_table (FT_Face face, String tag)
+{
+  FT_ULong len;
+  FT_Byte *tab = load_table (tag.to_str0 (), face,  &len);
+
+  return String (tab, len);
+}
+
+FT_Face
+open_ft_face (String str)
 {
   FT_Face face;
   int error_code = FT_New_Face (freetype2_library, str.to_str0 (), 0, &face);
@@ -98,7 +109,13 @@ Open_type_font::make_otf (String str)
   else if (error_code)
     error (_f ("unknown error: %d reading font file: %s", error_code,
               str.to_str0 ()));
+  return face;
+}
 
+SCM
+Open_type_font::make_otf (String str)
+{
+  FT_Face face = open_ft_face (str);
   Open_type_font *otf = new Open_type_font (face);
 
   return otf->self_scm ();
index 0967358f1f8b6d6c95ba4a5184656ad7fc8bd4b2..bbb546405dae94aa18f04281ff0525ae411dd64a 100644 (file)
@@ -13,6 +13,7 @@
 #include "source-file.hh"
 #include "memory-stream.hh"
 #include "ttftool.h"
+#include "open-type-font.hh"
 
 char *
 pfb2pfa (Byte const *pfb, int length)
@@ -104,3 +105,24 @@ LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa",
 
   return asscm;
 }
+
+
+
+LY_DEFINE (ly_otf_to_pfa, "ly:otf->cff",
+          1, 0, 0, (SCM otf_file_name),
+          "Convert the contents of a OTF file to CFF file, returning it as "
+          " a string.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (otf_file_name), otf_file_name,
+                  SCM_ARG1, __FUNCTION__, "string");
+
+  String file_name = ly_scm2string (otf_file_name);
+
+  FT_Face face = open_ft_face (file_name);
+  String table = get_otf_table (face, "CFF ");
+
+  SCM asscm = scm_from_locale_stringn (table.get_bytes (),
+                                      table.length ());
+
+  return asscm;
+}         
index 2418b1c854827d67bd01bb0aa7feabb442b31d26..9eeb6588a2f70310ef5d00a90401ceff582fbab4 100644 (file)
 
 
 (define (write-preamble paper load-fonts? port)
-  
   (define (load-font font-name-filename)
     (let* ((font (car font-name-filename))
           (name (cadr font-name-filename))
        ((and bare-file-name (string-match "\\.pfb" bare-file-name))
         (ly:pfb->pfa bare-file-name))
        
+
        ((string-match "([eE]mmentaler|[Aa]ybabtu)" file-name)
         (cached-file-contents
          (format "~a.pfa" (munge-lily-font-name file-name))))
+
+       ((and bare-file-name (string-match "\\.otf" bare-file-name))
+        (ps-embed-cff (ly:otf->cff bare-file-name) name 0))
        
        ((and bare-file-name (string-match "\\.ttf" bare-file-name))
         (ly:ttf->pfa bare-file-name))