From df7667c81afced0f9d6422b5cbaaf49fd5b3ae1f Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 20 May 2005 18:09:02 +0000 Subject: [PATCH] handle CID CFFs. --- ChangeLog | 3 +++ lily/pango-font.cc | 8 ++++++-- scm/framework-ps.scm | 6 ++++-- scm/output-ps.scm | 43 +++++++++++++++++++++++++------------------ 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 72131e75f6..0cf52a5ee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ 2005-05-20 Han-Wen Nienhuys + * scm/output-ps.scm (glyph-string): take cid? argument. Use + findresource iso. findfont for CID CFF fonts. + * VERSION (PACKAGE_NAME): release 2.5.25 * ly/Welcome_to_LilyPond.ly: add \version diff --git a/lily/pango-font.cc b/lily/pango-font.cc index b8693c8b73..c021807467 100644 --- a/lily/pango-font.cc +++ b/lily/pango-font.cc @@ -101,9 +101,11 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con PANGO_ASCENT (ink_rect))); b.scale (scale_); - + SCM glyph_exprs = SCM_EOL; SCM *tail = &glyph_exprs; + + bool cid_keyed = false; for (int i = 0; i < pgs->num_glyphs; i++) { PangoGlyphInfo *pgi = pgs->glyphs + i; @@ -120,6 +122,7 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con /* CID entry */ + cid_keyed = true; char_id = scm_from_int (pg); } else @@ -183,9 +186,10 @@ Pango_font::pango_item_string_stencil (PangoItem *item, String str, Real dx) con ((Pango_font *) this)->register_font_file (file_name, ps_name); pango_fc_font_unlock_face (fcfont); - SCM expr = scm_list_4 (ly_symbol2scm ("glyph-string"), + SCM expr = scm_list_5 (ly_symbol2scm ("glyph-string"), scm_makfrom0str (ps_name.to_str0 ()), scm_from_double (size), + scm_from_bool (cid_keyed), ly_quote_scm (glyph_exprs)); return Stencil (b, expr); diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 2731193c60..c80168fdd9 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -254,7 +254,8 @@ (let* ((font (car font-name-filename)) (name (cadr font-name-filename)) (file-name (caddr font-name-filename)) - (bare-file-name (ly:find-file file-name))) + (bare-file-name (ly:find-file file-name)) + ) (cons (munge-lily-font-name name) @@ -301,7 +302,8 @@ (list #f (car name-psname-pair) (cdr name-psname-pair))) - (ly:pango-font-physical-fonts font))) + (ly:pango-font-physical-fonts font))) + (else (ly:font-sub-fonts font)))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index cc021b8423..538bd18c8e 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -174,26 +174,33 @@ (define (glyph-string postscript-font-name - size + size cid? x-y-named-glyphs) + (format #f "gsave 1 output-scale div 1 output-scale div scale - /~a findfont ~a scalefont setfont\n~a grestore" postscript-font-name size - (apply - string-append - (map (lambda (item) - (let - ((x (car item)) - (y (cadr item)) - (g (caddr item))) - - (if (and (= 0.0 x) - (= 0.0 y)) - (format #f " /~a glyphshow\n" g) - (format #f " ~a ~a rmoveto ~a~a glyphshow\n" - x y - (if (string? g) "/" "") - g)))) - x-y-named-glyphs)))) + /~a ~a ~a scalefont setfont\n~a grestore" + postscript-font-name + (if cid? + " /CIDFont findresource " + " findfont") + + size + (apply + string-append + (map (lambda (item) + (let + ((x (car item)) + (y (cadr item)) + (g (caddr item))) + + (if (and (= 0.0 x) + (= 0.0 y)) + (format #f " /~a glyphshow\n" g) + (format #f " ~a ~a rmoveto ~a~a glyphshow\n" + x y + (if (string? g) "/" "") + g)))) + x-y-named-glyphs)))) (define (grob-cause offset grob) (let* ((cause (ly:grob-property grob 'cause)) -- 2.39.2