]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 13 Dec 2004 23:32:46 +0000 (23:32 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 13 Dec 2004 23:32:46 +0000 (23:32 +0000)
buildscripts/gen-bigcheese-scripts.py
lily/open-type-font.cc
scm/framework-tex.scm
scm/output-tex.scm

index 8d590fe0e3da792f7b9020604aec57ba49ce3e00..4b066b22c542f109f1b55a4a6802bb36788d0c1b 100644 (file)
@@ -77,7 +77,7 @@ Generate("%(name)s%(design_size)d.cff");''' % vars()
 
        ns = []
        for s in subfonts:
-               ns.append (s % vars())
+               ns.append ('"%s"' % (s % vars()))
                
        subfonts_str = string.join (ns)
        
index 36eeafb52267baa6d186a6426f3f60754cda37dd..9e78737405f8bf90340acb0a9f251bed1ffdde6c 100644 (file)
@@ -55,10 +55,10 @@ load_scheme_table (char const *tag_str, FT_Face face)
       String contents ((Byte const*)buffer, length);
       contents = "(quote (" +  contents + "))";
 
-      SCM expr = scm_c_eval_string (contents.to_str0 ());
+      tab = scm_c_eval_string (contents.to_str0 ());
       free (buffer);
     }
-  return expr;
+  return tab;
 }
 
 
@@ -130,7 +130,8 @@ Open_type_font::Open_type_font (FT_Face face)
   face_ = face;
   lily_character_table_ = SCM_EOL;
   lily_global_table_ = SCM_EOL;
-
+  lily_subfonts_ = SCM_EOL;
+  
   lily_character_table_ = alist_to_hashq (load_scheme_table ("LILC", face_));
   lily_global_table_ = alist_to_hashq (load_scheme_table ("LILY", face_));
   lily_subfonts_ = load_scheme_table ("LILF", face_);
@@ -221,13 +222,13 @@ Open_type_font::sub_fonts () const
   return lily_subfonts_;
 }
 
-LY_DEFINE (ly_font_magnification, "ly:font-sub-fonts", 1, 0, 0,
+LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0,
          (SCM font),
-          "Given the font metric @var{font}, return the "
-          "magnification, relative to the current outputscale.")
+          "Given the font metric @var{font} of an OpenType font, return the "
+          "names of the subfonts within @var{font}.")
 {
   Font_metric *fm = unsmob_metrics (font);
   SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric");
-  return scm_cdr (fm->description_);
+  return fm->sub_fonts ();
 }
 
index 988e49e04003f7b7b14beb1cfe59a7eceb89d60e..1d20344a431477468c8040c5b9fcde460b207f84 100644 (file)
   (string-append
    "\\def\\" prefix (symbol->tex-key key) "{" number "}%\n"))
 
+
+(define-public (digits->letters str)
+  (regexp-substitute/global
+   #f "[-\\._]"
+   (regexp-substitute/global
+    #f "([0-9])" str
+    'pre
+    (lambda (match)
+      (make-string
+       1
+       (integer->char
+       (+ (char->integer #\A)
+          (- (char->integer #\0))
+          (char->integer (string-ref (match:substring match 1) 0)))
+       )))
+    'post)
+   'pre ""
+   'post))
+
+(define (otf-font-load-command paper font)
+  (let*
+      ((sub-fonts (ly:font-sub-fonts font))
+       (base-name (tex-font-command font)))
+
+    (string-append
+     (apply string-append
+           (map
+            (lambda (sub-name)
+              (string-append
+               "\\font\\" (string-append base-name (digits->letters sub-name)) "="
+               sub-name 
+               " scaled "
+               (ly:number->string (inexact->exact
+                                   (round (* 1000
+                                             (ly:font-magnification font)
+                                             (ly:paper-outputscale paper)))))
+               "%\n"))
+            sub-fonts)))
+
+    "\\def\\" (tex-font-command font) "{"
+    (apply string-append
+          (map (lambda (name)
+                 "\\def\\" (string-append base-name (digits->letters name))
+                 )
+    ))))
+
 (define-public (tex-font-command font)
   (string-append
    "magfont"
@@ -41,7 +87,7 @@
    (string-encode-integer
     (inexact->exact (round (* 1000 (ly:font-magnification font)))))))
 
-(define (font-load-command paper font)
+(define (simple-font-load-command paper font)
   (let* ((coding-alist (ly:font-encoding-alist font))
         (font-encoding (assoc-get 'output-name coding-alist)))
     (string-append
      "\\lilypond" (tex-font-command font)
      "}%\n")))
 
+(define (font-load-command paper font)
+  (if (pair? (ly:font-sub-fonts font))
+      (otf-font-load-command paper font)
+      (simple-font-load-command paper font)))
+
 (define (define-fonts paper)
   (string-append
    ;; UGH. FIXME.
index e4aab9f61395a9784a31d7e24f5cf142b2669799..0f4f5b4f95972237d1baccfc3edfad398f656f33 100644 (file)
 (define (dashed-slur thick dash l)
   (embedded-ps (list 'dashed-slur thick dash `(quote ,l))))
 
-(define (digits->letters str)
-    (regexp-substitute/global
-     #f "([0-9])" str
-     'pre
-     (lambda (match)
-       (make-string
-       1
-       (integer->char
-        (+ (char->integer #\A)
-           (- (char->integer #\0))
-           (char->integer (string-ref (match:substring match 1) 0)))
-        )))
-     'post))
 
 (define (named-glyph font name)
   (string-append "\\" (tex-font-command font)
                 (string-append
 ;                (digits->letters (ly:font-name font))
                  (regexp-substitute/global
-                  #f "[\\._]"
+                  #f "[-\\._]"
                   (digits->letters name)
                   'pre ""
                   'post))))