CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/06/07 13:34:02

Modified files:
        .              : ChangeLog 
        scm            : framework-ps.scm lily.scm 
        ttftool        : parse.c 

Log message:
        * ttftool/parse.c (readNamingTable): handle Apple/8bit encoding too.
        
        * scm/framework-ps.scm (font-file-as-ps-string): new function.
        (handle-macfont): new function. Call fondu for Native mac fonts.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3733&tr2=1.3734&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/framework-ps.scm.diff?tr1=1.112&tr2=1.113&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily.scm.diff?tr1=1.353&tr2=1.354&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ttftool/parse.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3733 lilypond/ChangeLog:1.3734
--- lilypond/ChangeLog:1.3733   Tue Jun  7 11:29:30 2005
+++ lilypond/ChangeLog  Tue Jun  7 13:34:01 2005
@@ -1,5 +1,10 @@
 2005-06-07  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * ttftool/parse.c (readNamingTable): handle Apple/8bit encoding too.
+
+       * scm/framework-ps.scm (font-file-as-ps-string): new function.
+       (handle-macfont): new function. Call fondu for Native mac fonts.
+
        * scm/define-markup-commands.scm (fill-line): handle text-widths =
        '() case.
 
Index: lilypond/scm/framework-ps.scm
diff -u lilypond/scm/framework-ps.scm:1.112 lilypond/scm/framework-ps.scm:1.113
--- lilypond/scm/framework-ps.scm:1.112 Tue Jun  7 07:45:31 2005
+++ lilypond/scm/framework-ps.scm       Tue Jun  7 13:34:02 2005
@@ -254,6 +254,68 @@
         (ly:warning (_ "don't know how to embed ~S=~S") name file-name)
          "")))))
 
+  ;; ugh.  posix /windows/mingw? 
+  (define (path-join a b)
+    (if (equal? a "")
+       b
+       (string-append a "/" b)))
+    
+  (define (dir-listing dir-name)
+    (define (dir-helper dir lst)
+      (let ((e (readdir dir)))
+       (if (eof-object? e) lst (dir-helper dir (cons e lst)))))
+    (reverse (dir-helper (opendir dir-name) '())))
+      
+  (define (handle-mac-font name filename)
+    (let*
+       ((dir-name  (tmpnam))
+        (files '())
+        (status 0)
+        (embed ""))
+
+
+      (display (list filename name))
+      (mkdir dir-name #o700)
+
+      (set! status (system
+                   (format "cd ~a && fondu -force ~a" dir-name filename)))
+
+      (if (!= status 0)
+         (ly:error "Fondu failed."))
+      
+      (set! files (dir-listing dir-name))
+
+      (for-each
+       (lambda (f)
+        (if (string-match (string-append name "\\.") f)
+            (set! embed
+                  (font-file-as-ps-string name (path-join dir-name f))))
+            
+        (if (or (equal? "." f) 
+                (equal? ".." f))
+            #t
+            (delete-file (path-join dir-name f))))
+       files)
+      (rmdir dir-name)
+      embed))
+
+    (define (font-file-as-ps-string name file-name)
+      (cond
+       ((and file-name (string-match "\\.pfa" file-name))
+       (cached-file-contents file-name))
+       ((and file-name (string-match "\\.pfb" file-name))
+       (ly:pfb->pfa file-name))
+       ((and file-name (string-match "\\.ttf" file-name))
+       (ly:ttf->pfa file-name))
+       ((and file-name (string-match "\\.otf" file-name))
+       (ps-embed-cff (ly:otf->cff file-name) name 0))
+       ((and file-name (string-match "\\.ttf" file-name))
+       (ly:ttf->pfa file-name))
+       (else
+       (ly:warning (_ "don't know how to embed ~S=~S") name file-name)
+       "")
+       ))
+      
   (define (load-font font-name-filename)
     (let* ((font (car font-name-filename))
           (name (cadr font-name-filename))
@@ -264,30 +326,29 @@
       (cons
        (munge-lily-font-name name)
        (cond
-       ((and bare-file-name (string-match "\\.pfa" bare-file-name))
-        (cached-file-contents bare-file-name))
-       ((and bare-file-name (string-match "\\.pfb" bare-file-name))
-        (ly:pfb->pfa bare-file-name))
-       ((and bare-file-name (string-match "\\.ttf" bare-file-name))
-        (ly:ttf->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))
+       ((and
+;        (eq? PLATFORM 'darwin)
+         bare-file-name (string-match "\\.dfont" bare-file-name))
+        (handle-mac-font name bare-file-name))
+       
+       ((and
+;        (eq? PLATFORM 'darwin)
+         bare-file-name (= (stat:size (stat bare-file-name)) 0))
+        (handle-mac-font name bare-file-name))
 
        ((and font (cff-font? font))
         (ps-embed-cff (ly:otf-font-table-data font "CFF ")
                       name
                       0))
+
+       (bare-file-name (font-file-as-ps-string name bare-file-name))
        (else
-        (ly:warning (_ "don't know how to embed ~S=~S") name file-name)
-         "")))))
+        (ly:warning (_ "don't know how to embed font ~s ~s ~s")
+                    name file-name font))))))
+       
 
   (define (load-fonts paper)
     (let* ((fonts (ly:paper-fonts paper))
Index: lilypond/scm/lily.scm
diff -u lilypond/scm/lily.scm:1.353 lilypond/scm/lily.scm:1.354
--- lilypond/scm/lily.scm:1.353 Wed Jun  1 07:56:41 2005
+++ lilypond/scm/lily.scm       Tue Jun  7 13:34:02 2005
@@ -86,6 +86,8 @@
 ;; Mingw
 ;; #(Windows XP HOSTNAME build 2600 5.01 Service Pack 1 i686)
 ;;
+
+;; ugh, code dup.
 (define-public PLATFORM
   (string->symbol
    (string-downcase
Index: lilypond/ttftool/parse.c
diff -u lilypond/ttftool/parse.c:1.2 lilypond/ttftool/parse.c:1.3
--- lilypond/ttftool/parse.c:1.2        Tue Apr 19 12:48:41 2005
+++ lilypond/ttftool/parse.c    Tue Jun  7 13:34:02 2005
@@ -67,10 +67,11 @@
 
   for (i = 0; i < nrecords; i++)
     {
-      if (records[i].platformID == 3 &&        /* Microsoft */
+      if
+       ((records[i].platformID == 3 && /* Microsoft */
          records[i].encodingID == 1 && /* UGL */
          records[i].languageID == 0x0409 &&    /* US English */
-         records[i].nameID <= 7)
+         records[i].nameID <= 7))
        {
          strings[records[i].nameID] = mymalloc (records[i].length / 2 + 1);
          unistrncpy (strings[records[i].nameID],
@@ -80,6 +81,27 @@
                     strings[records[i].nameID]);
        }
     }
+
+
+  for (i = 0; i < nrecords; i++)
+    {
+      int id = records[i].nameID;
+      if (records[i].platformID == 1 &&        /* Apple */
+         records[i].encodingID == 0 && /* 8bit */
+         id <= 7 &&
+         !strings[id]
+        )
+       {
+         strings[id] = mymalloc (records[i].length + 1);
+         strncpy (strings[id],
+                  data + records[i].offset, records[i].length);
+         strings[id][records[i].length] = 0;
+         if (verbosity >= 2)
+           fprintf (stderr, "%d: %s\n", records[i].nameID,
+                    strings[records[i].nameID]);
+       }
+    }
+
   free (records);
   free (data);
   return strings;


_______________________________________________
Lilypond-cvs mailing list
Lilypond-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to