* scm/framework-ps.scm (load-fonts): load pfb files too.
* lily/pfb.cc (pfb2pfa): new file.
+2004-07-16 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * input/regression/font-postscript.ly: new file.
+
+ * scm/framework-ps.scm (load-fonts): load pfb files too.
+
+ * lily/pfb.cc (pfb2pfa): new file.
+
2004-07-15 Han-Wen Nienhuys <hanwen@xs4all.nl>
* scripts/lilypond-book.py (PREAMBLE_LY): set
--- /dev/null
+\header {
+
+ texidoc = "This file demonstrates how to load different
+ (postscript) fonts. The file @file{font.scm} shows how to define
+ the scheme-function called."
+
+}
+
+\bookpaper
+{
+
+ #(define text-font-defaults
+ '((font-encoding . latin1)
+ (baseline-skip . 2)
+ (word-space . 0.6)))
+
+ #(set! fonts (make-century-schoolbook-tree 1.0))
+}
+
+\paper {
+ linewidth = 160 \mm - 2.0 * 9.0 \mm
+
+
+ indent = 0.0\mm
+ raggedright = ##t
+}
+
+ {
+ \key a \major
+\time 6/8
+cis''8. d''16 cis''8 e''4 e''8
+ }
--- /dev/null
+/*
+ pfb.cc -- implement pfb conversion.
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "string.hh"
+#include "lily-guile.hh"
+#include "source-file.hh"
+
+char *
+pfb2pfa (Byte const * pfb, int length)
+{
+ char * out = new char[1];
+ int olen = 0;
+
+ Byte const * p = pfb;
+ while (p < pfb + length)
+ {
+ if (*p++ != 128)
+ break;
+
+ Byte type = *p++;
+ if (type == 3)
+ break ;
+
+ unsigned seglen =
+ p[0] | (p[1] << 8)
+ | (p[2] << 16) | (p[3] << 24);
+
+ p += 4;
+ if (type == 1)
+ {
+ out = (char*)realloc (out, olen + seglen + 1);
+ char* outp = out + olen ;
+ memcpy (outp, p, seglen);
+ olen += seglen;
+ p += seglen;
+ }
+ else if (type == 2)
+ {
+ unsigned outlength = (seglen * 2) + (seglen / 32) + 2;
+
+ out = (char*)realloc (out, olen + outlength + 1);
+
+ char * outp = out + olen;
+ for (int i = seglen; i--;)
+ {
+ sprintf (outp, "%02x", *p++);
+ outp += 2;
+ if (!(i % 32))
+ {
+ *outp ++ = '\n';
+ }
+ }
+
+ olen = outp - out;
+ }
+
+ }
+ out[olen] = 0;
+
+ return out;
+}
+
+LY_DEFINE(ly_pfb_to_pfa, "ly:pfb->pfa",
+ 1,0,0, (SCM pfb_path),
+ "Convert the contents of a PFB file to PFA."
+ )
+{
+ SCM_ASSERT_TYPE(ly_c_string_p (pfb_path), pfb_path,
+ SCM_ARG1, __FUNCTION__, "string");
+
+ String path = ly_scm2string (pfb_path);
+ int len ;
+ char *str = gulp_file (path, &len);
+ char *pfa = pfb2pfa ((Byte*)str, len);
+
+ SCM pfa_scm = scm_makfrom0str(pfa);
+ free (pfa);
+ delete str;
+ return pfa_scm;
+}
+
{
/* ARGH. */
programming_error ("Must have Modified_font_metric for text.");
+ scm_display (fm->description_, scm_current_error_port ());
}
return Stencil (b, lst).smobbed_copy ();
(font-shape . upright)
(font-series . medium)
(font-encoding . latin1))
- `(10.0 . #(,(delay (ly:font-load "c059013l")))))
+ `(10.0 . #(,(delay (ly:font-load "uncr8a")))))
(add-font node
'((font-family . roman)
(font-shape . italic)
(font-series . medium)
(font-encoding . latin1))
- `(10.0 . #(,(delay (ly:font-load "c059033l")))))
+ `(10.0 . #(,(delay (ly:font-load "uncri8a")))))
(add-font node
'((font-family . roman)
(font-shape . upright)
(font-series . bold)
(font-encoding . latin1))
- `(10.0 . #(,(delay (ly:font-load "c059016l")))))
+ `(10.0 . #(,(delay (ly:font-load "uncb8a")))))
(add-font node
'((font-family . roman)
(font-shape . italic)
(font-series . bold)
(font-encoding . latin1))
- `(10.0 . #(,(delay (ly:font-load "c059036l")))))
+ `(10.0 . #(,(delay (ly:font-load "uncbi8a")))))
)
(define-public (make-cmr-tree factor)
-
(let
((n (make-font-tree-node 'font-encoding 'fetaMusic)))
))
-
(define-public (magstep x)
(exp (* (/ x 6) (log 2))))
((aname (string-append x ".pfa"))
(apath (ly:kpathsea-expand-path aname))
-; (bpath (if (not apath)
-; (ly:kpathsea-expand-path (string-append x ".pfb"))
-; #f)))
-
- )
+ (bpath (if (not apath)
+ (ly:kpathsea-expand-path (string-append x ".pfb"))
+ #f)))
+
(cond
(apath (ly:gulp-file apath))
-
- ; oops , can't plonk PFB in, must convert to ASCII.
- ;(bpath (ly:gulp-file bpath))
+ (bpath (ly:pfb->pfa bpath))
(else
(ly:warn "Can't find PFA font ~S" x)
""))))