Improvements to Postscript backend (patches included)

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Improvements to Postscript backend (patches included)

David Feuer-4
I sent this some hours ago, but haven't seen it yet.  Is the mailing list
broken, or just really slow?

Original message:

I made some changes to the Postscript backend, making the output more readable
(especially for text), around 10% shorter, and, at least in theory, also faster
to interpret.  These changes are just a start, but I hope they help.  I'd like
to know if it might be possible to make the backend work at a slightly higher
level, which should allow much smaller files (e.g., Postscript could easily
understand the concept of "filled dotted quarter note in current note font with
upward stem 3 staff spaces long").

I'm not a master of diff, so let me know if the following aren't done right.
Diffs (made with -u) against the 2.8.0 source:

--- ../Installation
Programs/lilypond-2.8.0-src/lilypond-2.8.0/scm/framework-ps.scm     2006-03-20
19:45:18.000000000 -0500
+++ framework-ps.scm    2006-03-25 18:25:43.875475200 -0500
@@ -42,8 +42,10 @@
   (define font-list (ly:paper-fonts paper))
   (define (define-font command fontname scaling)
     (string-append
-     "/" command " { /" fontname " findfont "
-     (ly:number->string scaling) " output-scale div scalefont } bind def\n"))
+      "/" command " { /" fontname " " (ly:number->string scaling) "
output-scale div selectfont } bind def\n"))
+;    (string-append
+;     "/" command " { /" fontname " findfont "
+;     (ly:number->string scaling) " output-scale div scalefont } bind def\n"))
 
   (define (standard-tex-font? x)
     (or (equal? (substring x 0 2) "ms")


--- ../Installation
Programs/lilypond-2.8.0-src/lilypond-2.8.0/ps/music-drawing-routines.ps    
2006-03-16 05:52:27.000000000 -0500
+++ music-drawing-routines.ps   2006-03-25 18:25:10.447408000 -0500
@@ -241,10 +241,7 @@
 % JUNKME: Use color.  
 /draw_white_text  % text scale font
 {
-  %font
-  findfont
-  %scale
-  exch scalefont setfont
+  exch selectfont
   1 setgray
   0 0 moveto
   %-0.05 -0.05 moveto
@@ -276,5 +273,19 @@
        stroke
 } bind def
 
+/printletter {
+       currentpoint
+       3 2 roll
+       glyphshow
+       moveto
+} bind def
 
+/printglyphs {
+       -1 1
+       {
+               3 mul -3 roll
+               printletter
+               rmoveto
+       }for
+}bind def
 %end music-drawing-routines.ps




--- ../Installation Programs/lilypond-2.8.0-src/lilypond-2.8.0/scm/output-ps.scm
       2006-03-07 13:14:23.000000000 -0500
+++ output-ps.scm       2006-03-25 18:25:34.061363200 -0500
@@ -54,6 +54,21 @@
 (define (ps-encoding text)
   (escape-parentheses text))
 
+(define (round2 num)
+  (/ (round (* 100 num)) 100))
+
+(define (round4 num)
+  (/ (round (* 10000 num)) 10000))
+
+(define (str4 num)
+  (format #f "~f" (round4 num)))
+
+(define (number-pair->string4 numpair)
+  (format #f "~f ~f" (round4 (car numpair)) (round4 (cdr numpair))))
+
+(define (numbers->string4 numlist)
+  (apply string-append (map (lambda (x) (string-append (str4 x) " ")) numlist)))
+
 ;; FIXME: lily-def
 (define-public (ps-string-def prefix key val)
   (string-append "/" prefix (symbol->string key) " ("
@@ -75,59 +90,61 @@
 ;; two beziers
 (define (bezier-sandwich lst thick)
   (string-append
-   (string-join (map ly:number-pair->string lst) " ")
+   (string-join (map number-pair->string4 lst) " ")
    " "
-   (ly:number->string thick)
+   (str4 thick)
    " draw_bezier_sandwich"))
 
 (define (char font i)
   (string-append
-   (ps-font-command font) " setfont "
-   "(\\" (ly:inexact->string i 8) ") show"))
+   (ps-font-command font) ; " "
+   " (\\" (ly:inexact->string i 8) ") show"))
 
 (define (circle radius thick fill)
   (format
-   "~a ~a ~a draw_circle" radius thick
+   "~f ~f ~a draw_circle" (round4 radius) (round4 thick)
    (if fill
        "true "
        "false ")))
 
 (define (dashed-line thick on off dx dy)
   (string-append
-   (ly:number->string dx) " "
-   (ly:number->string dy) " "
-   (ly:number->string thick)
+   (str4 dx) " "
+   (str4 dy) " "
+   (str4 thick)
    " [ "
-   (ly:number->string on) " "
-   (ly:number->string off)
+   (str4 on) " "
+   (str4 off)
    " ] 0 draw_dashed_line"))
 
 ;; what the heck is this interface ?
 (define (dashed-slur thick on off l)
   (string-append
-   (string-join (map ly:number-pair->string l) " ")
+   (string-join (map number-pair->string4 l) " ")
    " "
-   (ly:number->string thick)
+   (str4 thick)
    " [ "
-   (ly:number->string on)
+   (str4 on)
    " "  
-   (ly:number->string off)
+   (str4 off)
    " ] 0 draw_dashed_slur"))
 
+;;  s/\.\([0-9]\{-}\)0* /\1 /g
+
 (define (dot x y radius)
   (string-append
    " "
-   (ly:numbers->string
+   (numbers->string4
     (list x y radius)) " draw_dot"))
 
 (define (draw-line thick x1 y1 x2 y2)
   (string-append
    "1 setlinecap 1 setlinejoin "
-   (ly:number->string thick) " setlinewidth "
-   (ly:number->string x1) " "
-   (ly:number->string y1) " moveto "
-   (ly:number->string x2) " "
-   (ly:number->string y2) " lineto stroke"))
+   (str4 thick) " setlinewidth "
+   (str4 x1) " "
+   (str4 y1) " moveto "
+   (str4 x2) " "
+   (str4 y2) " lineto stroke"))
 
 (define (embedded-ps string)
   string)
@@ -138,12 +155,10 @@
         w-x-y-named-glyphs)
 
   (format #f "gsave
-  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
+  /~a ~a output-scale div selectfont\n~a grestore"
          postscript-font-name
-         (if cid?
-             " /CIDFont findresource "
-             " findfont")
          size
+         (string-append
          (apply
           string-append
           (map (lambda  (item)
@@ -154,9 +169,12 @@
                       (g (cadddr item))
                       (prefix (if  (string? g) "/" "")))
 
-                   (format #f " gsave ~a~a glyphshow grestore ~$ ~$ rmoveto \n"
prefix g (+ w x) y)
+                   (format #f "~f ~f ~a~a\n" (round2 (+ w x))
+                           (round2 y) prefix g)
                    ))
-               w-x-y-named-glyphs))))
+               w-x-y-named-glyphs))
+         (format #f "~a printglyphs" (length w-x-y-named-glyphs)))
+        ))
 
 (define (grob-cause offset grob)
   (let* ((cause (ly:grob-property grob 'cause))
@@ -201,7 +219,7 @@
 
 (define (named-glyph font glyph)
   (string-append
-   (ps-font-command font) " setfont "
+   (ps-font-command font) " "
    "/" glyph " glyphshow "))
 
 (define (no-origin)
@@ -214,21 +232,21 @@
 ~a
 grestore\n"
 
-   (ly:number->string x)
-   (ly:number->string y)
+   (str4 x)
+   (str4 y)
    s))
 
 (define (polygon points blot-diameter filled?)
   (string-append
-   (ly:numbers->string points) " "
-   (ly:number->string (/ (length points) 2)) " "
-   (ly:number->string blot-diameter)
+   (numbers->string4 points) " "
+   (str4 (/ (length points) 2)) " "
+   (str4 blot-diameter)
    (if filled? " true " " false ")
    " draw_polygon"))
 
 (define (repeat-slash wid slope thick)
   (string-append
-   (ly:numbers->string (list wid slope thick))
+   (numbers->string4 (list wid slope thick))
    " draw_repeat_slash"))
 
 ;; restore color from stack
@@ -237,13 +255,13 @@
 
 (define (round-filled-box x y width height blotdiam)
   (string-append
-   (ly:numbers->string
+   (numbers->string4
     (list x y width height blotdiam)) " draw_round_box"))
 
 ;; save current color on stack and set new color
 (define (setcolor r g b)
   (string-append "currentrgbcolor "
-  (ly:numbers->string (list r g b))
+  (numbers->string4 (list r g b))
   " setrgbcolor\n"))
 
 (define (text font s)
@@ -256,7 +274,7 @@
         (out-vec (decode-byte-string s)))
 
     (string-append
-     (ps-font-command font) " setfont "
+     (ps-font-command font) " "
      (string-join
       (vector->list
        (vector-for-each
@@ -286,10 +304,10 @@
 (define (zigzag-line centre? zzw zzh thick dx dy)
   (string-append
    (if centre? "true" "false") " "
-   (ly:number->string zzw) " "
-   (ly:number->string zzh) " "
-   (ly:number->string thick) " "
+   (str4 zzw) " "
+   (str4 zzh) " "
+   (str4 thick) " "
    "0 0 "
-   (ly:number->string dx) " "
-   (ly:number->string dy)
+   (str4 dx) " "
+   (str4 dy)
    " draw_zigzag_line"))




_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Han-Wen Nienhuys-2
David Feuer wrote:
> I sent this some hours ago, but haven't seen it yet.  Is the mailing list
> broken, or just really slow?

The list is a bit slow, and I have been away.

> Original message:
>
> I made some changes to the Postscript backend, making the output more readable
> (especially for text), around 10% shorter, and, at least in theory, also faster
> to interpret.  These changes are just a start, but I hope they help.  I'd like
> to know if it might be possible to make the backend work at a slightly higher
> level, which should allow much smaller files (e.g., Postscript could easily
> understand the concept of "filled dotted quarter note in current note font with
> upward stem 3 staff spaces long").

That's very unlikely. The internal representation is not strictly
hierarchical, so it's difficult to group different objects (eg. note and
stem) so they will be output together, and still be sure that all of
them are processed.

> I'm not a master of diff, so let me know if the following aren't done right.
> Diffs (made with -u) against the 2.8.0 source:

I'm missing a Changelog entry.

>
> --- ../Installation
> Programs/lilypond-2.8.0-src/lilypond-2.8.0/scm/framework-ps.scm     2006-03-20
> 19:45:18.000000000 -0500
> +++ framework-ps.scm    2006-03-25 18:25:43.875475200 -0500
> @@ -42,8 +42,10 @@
>    (define font-list (ly:paper-fonts paper))
>    (define (define-font command fontname scaling)
>      (string-append
> -     "/" command " { /" fontname " findfont "
> -     (ly:number->string scaling) " output-scale div scalefont } bind def\n"))
> +      "/" command " { /" fontname " " (ly:number->string scaling) "
> output-scale div selectfont } bind def\n"))
> +;    (string-append
> +;     "/" command " { /" fontname " findfont "
> +;     (ly:number->string scaling) " output-scale div scalefont } bind def\n"))

Hi,

thanks for you patch.  CAn you have a second look; there are some style
issues,




> +/printletter {
> +       currentpoint
> +       3 2 roll
> +       glyphshow
> +       moveto
> +} bind def
>  
> +/printglyphs {
> +       -1 1
> +       {
> +               3 mul -3 roll
> +               printletter
> +               rmoveto
> +       }for
> +}bind def

can you add some comment explaining in more detail that this is for
kerning?   Also, can you follow the naming convention, which is
word_word iso. wordword for PS files.

(I'd like to change this to word-word, some time)


> +(define (round2 num)
> +  (/ (round (* 100 num)) 100))
> +
> +(define (round4 num)
> +  (/ (round (* 10000 num)) 10000))
> +
> +(define (str4 num)
> +  (format #f "~f" (round4 num)))

can you rename this to something more comprehensible?



> +;;  s/\.\([0-9]\{-}\)0* /\1 /g
> +

?

>    (format #f "gsave
> -  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
> +  /~a ~a output-scale div selectfont\n~a grestore"
>           postscript-font-name
> -         (if cid?
> -             " /CIDFont findresource "
> -             " findfont")

I don't understand this? How are CID resources supposed to be loaded now?


>  (define (named-glyph font glyph)
>    (string-append
> -   (ps-font-command font) " setfont "
> +   (ps-font-command font) " "
>     "/" glyph " glyphshow "))

While you're at it, I think it would improve readability of the SCM file
when you try to replace string-append in cases like these.


--

Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
  -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

David Feuer-2
On 3/28/06, Han-Wen Nienhuys <[hidden email]> wrote:
> David Feuer wrote:

> thanks for you patch.  CAn you have a second look; there are some style
> issues

Sure.  I can't deal with them right now, but I'll try to fix them up
this evening.

> > I'd like
> > to know if it might be possible to make the backend work at a slightly higher
> > level, which should allow much smaller files (e.g., Postscript could easily
> > understand the concept of "filled dotted quarter note in current note font with
> > upward stem 3 staff spaces long").

> That's very unlikely. The internal representation is not strictly
> hierarchical, so it's difficult to group different objects (eg. note and
> stem) so they will be output together, and still be sure that all of
> them are processed.

I've searched and searched, but I can't seem to figure out where notes
and text turn into primitive objects sent to the backends.  Could you
point me in the right direction?  Is there an explanation somewhere of
the general process through which parsed Lilypond becomes printed
music?  You say the internal representation is not strictly
hierarchical.  What _is_ the internal representation?  When objects
get broken up for separate processing, might it be reasonable for the
component pieces to point back to their parents?  In any case,
whatever structure the internal representation actually has would most
likely be useful in the backend code.  The image in my mind is an
intermediate program of sorts that is compiled to create Postscript or
TeX output and interpreted to create SVG output.

> can you add some comment explaining in more detail that this is for
> kerning?

Actually, I was rather curious where those numbers were coming from.
It might be a good idea to use separate routines for placing text, for
placing noteheads, and for whatever else, rather than using just one
glyph placer for all, as they really are rather different.  Text tends
to have a lot of letters on horizontal lines.  Notes tend to be on
lines or spaces in staves.

> Also, can you follow the naming convention, which is
> word_word iso. wordword for PS files.

Sure.

> > +(define (str4 num)
> > +  (format #f "~f" (round4 num)))
>
> can you rename this to something more comprehensible?

num->str4prec?  I couldn't think of anything really good.

> > +;;  s/\.\([0-9]\{-}\)0* /\1 /g
> > +
>
> ?

Sorry.  That's junk.

> >    (format #f "gsave
> > -  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
> > +  /~a ~a output-scale div selectfont\n~a grestore"
> >           postscript-font-name
> > -         (if cid?
> > -             " /CIDFont findresource "
> > -             " findfont")
>
> I don't understand this? How are CID resources supposed to be loaded now?

According to the Postscript reference, selectfont can be used with CID
resources as well as regular fonts.  Unfortunately, I can't make the
utf-8 regression test work either with or without my changes, so I
can't be sure I got this right.

> >  (define (named-glyph font glyph)
> >    (string-append
> > -   (ps-font-command font) " setfont "
> > +   (ps-font-command font) " "
> >     "/" glyph " glyphshow "))
>
> While you're at it, I think it would improve readability of the SCM file
> when you try to replace string-append in cases like these.

Sure.

David Feuer


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Han-Wen Nienhuys-2
David Feuer wrote:

>>> to know if it might be possible to make the backend work at a slightly higher
>>> level, which should allow much smaller files (e.g., Postscript could easily
>>> understand the concept of "filled dotted quarter note in current note font with
>>> upward stem 3 staff spaces long").
>
>> That's very unlikely. The internal representation is not strictly
>> hierarchical, so it's difficult to group different objects (eg. note and
>> stem) so they will be output together, and still be sure that all of
>> them are processed.
>
> I've searched and searched, but I can't seem to figure out where notes
> and text turn into primitive objects sent to the backends.  Could you
> point me in the right direction?  Is there an explanation somewhere of
> the general process through which parsed Lilypond becomes printed
> music?  You say the internal representation is not strictly

Have a look at Erik's thesis (he posted it to the list) recently.   It
has some pointers to more information.  In particular, the internals doc
by Carl Sorensen.

> hierarchical.  What _is_ the internal representation?  When objects
> get broken up for separate processing, might it be reasonable for the
> component pieces to point back to their parents?  In any case,
> whatever structure the internal representation actually has would most
> likely be useful in the backend code.  The image in my mind is an
> intermediate program of sorts that is compiled to create Postscript or
> TeX output and interpreted to create SVG output.

look at

   void
   Paper_book::output (SCM output_channel)

and

   SCM
   System::get_paper_system ()

(I take it you have seen the SVG backend already?)

>> can you add some comment explaining in more detail that this is for
>> kerning?
>
> Actually, I was rather curious where those numbers were coming from.
> It might be a good idea to use separate routines for placing text, for
> placing noteheads, and for whatever else, rather than using just one
> glyph placer for all, as they really are rather different.  Text tends

there already are separate glyph placers, if memory serves.


>>> +(define (str4 num)
>>> +  (format #f "~f" (round4 num)))
>> can you rename this to something more comprehensible?
>
> num->str4prec?  I couldn't think of anything

num->string-with-4-decimals

hmm, still a little verbose.

>>>    (format #f "gsave
>>> -  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
>>> +  /~a ~a output-scale div selectfont\n~a grestore"
>>>           postscript-font-name
>>> -         (if cid?
>>> -             " /CIDFont findresource "
>>> -             " findfont")
>> I don't understand this? How are CID resources supposed to be loaded now?
>
> According to the Postscript reference, selectfont can be used with CID
> resources as well as regular fonts.  Unfortunately, I can't make the
> utf-8 regression test work either with or without my changes, so I
> can't be sure I got this right.

This should be fixed in CVS.

Werner, do we still need /CIDFont findresource ?

>>>  (define (named-glyph font glyph)
>>>    (string-append
>>> -   (ps-font-command font) " setfont "
>>> +   (ps-font-command font) " "
>>>     "/" glyph " glyphshow "))
>> While you're at it, I think it would improve readability of the SCM file
>> when you try to replace string-append in cases like these.

ops, I mean "replace with format"

--

Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
  -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Werner LEMBERG
> >>> -         (if cid?
> >>> -             " /CIDFont findresource "
> >>> -             " findfont")
> >> I don't understand this? How are CID resources supposed to be
> >> loaded now?
> >
> > According to the Postscript reference, selectfont can be used with
> > CID resources as well as regular fonts.

But a CID resource is completely useless for us since we don't get the
corresponding CID value, AFAIK.  In case Pango does the CMap resource
handling (this is, we send a Unicode value and Pango returns the CID)
we can enable this again.

> Werner, do we still need /CIDFont findresource ?

It really depends on Pango...


    Werner


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

David Feuer-2
In reply to this post by Han-Wen Nienhuys-2
In pango-font.cc, what are ggeo.width and ggeo.x_offset?
glyph-string, in output-ps.scm, adds the two together to figure out
where to place the next glyph.  Is ggeo.width the same as the width
PostScript would use to place the next glyph?  If so, it would be much
cleaner not to add it in, and not have to move back over it.  In
detail:

Current situation:

place glyph -> move to the left by what I'm guessing might be
ggeo.width -> move to the right by ggeo.width + ggeo.x_offset -> place
another glyph.

If ggeo.width is the width PostScript uses for glyphshow, we can change it to:

place glyph -> move to the right by ggeo.x_offset -> place another glyph.

David Feuer


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

David Feuer-2
In reply to this post by Werner LEMBERG
On 3/28/06, Werner LEMBERG <[hidden email]> wrote:

> > >>> -         (if cid?
> > >>> -             " /CIDFont findresource "
> > >>> -             " findfont")
> > >> I don't understand this? How are CID resources supposed to be
> > >> loaded now?
> > >
> > > According to the Postscript reference, selectfont can be used with
> > > CID resources as well as regular fonts.
>
> But a CID resource is completely useless for us since we don't get the
> corresponding CID value, AFAIK.  In case Pango does the CMap resource
> handling (this is, we send a Unicode value and Pango returns the CID)
> we can enable this again.

The current code does

/fontname /CIDFont findresource 17 scalefont setfont, where 17 is a
random number.

If I'm not mistaken, this is completely equivalent to /fontname 17
selectfont, except that it's almost certainly slower.

David


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Werner LEMBERG
> > But a CID resource is completely useless for us since we don't get
> > the corresponding CID value, AFAIK.  In case Pango does the CMap
> > resource handling (this is, we send a Unicode value and Pango
> > returns the CID) we can enable this again.
>
> The current code does
>
> /fontname /CIDFont findresource 17 scalefont setfont, where 17 is a
> random number.
>
> If I'm not mistaken, this is completely equivalent to /fontname 17
> selectfont, except that it's almost certainly slower.

You are probably right, but this code will (at least temporarily)
vanish, I think, since we aren't able currently to handle CIDFont
resources directly.


    Werner


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Han-Wen Nienhuys-2
In reply to this post by David Feuer-2
David Feuer wrote:
>
> If ggeo.width is the width PostScript uses for glyphshow, we can change it to:

ggeo.width is the kerning info that we get from pango.


--

Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
  -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Han-Wen Nienhuys-2
In reply to this post by David Feuer-2
David Feuer wrote:

>>>    (format #f "gsave
>>> -  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
>>> +  /~a ~a output-scale div selectfont\n~a grestore"
>>>           postscript-font-name
>>> -         (if cid?
>>> -             " /CIDFont findresource "
>>> -             " findfont")
>> I don't understand this? How are CID resources supposed to be loaded now?
>
> According to the Postscript reference, selectfont can be used with CID
> resources as well as regular fonts.  Unfortunately, I can't make the
> utf-8 regression test work either with or without my changes, so I
> can't be sure I got this right.

unfortunately, Ghostscript disagrees. It throws a /typecheck error from
--glyphshow-- , if you load the font as a regular font.

--

Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
  -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

David Feuer-2
On 3/31/06, Han-Wen Nienhuys <[hidden email]> wrote:

> > According to the Postscript reference, selectfont can be used with CID
> > resources as well as regular fonts.  Unfortunately, I can't make the
> > utf-8 regression test work either with or without my changes, so I
> > can't be sure I got this right.
>
> unfortunately, Ghostscript disagrees. It throws a /typecheck error from
> --glyphshow-- , if you load the font as a regular font.

Yech.  I suspect this is a bug in Ghostscript, though I could be
reading the PostScript reference wrong.  Could you take a look at
section 5.11.3 (CIDFont Dictionaries), the entry for selectfont in the
operator index (page 656, or PDF page 670), and the entry for
glyphshow (page 602, PDF page 616)?


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Han-Wen Nienhuys-2
David Feuer schreef:

> On 3/31/06, Han-Wen Nienhuys <[hidden email]> wrote:
>
>>> According to the Postscript reference, selectfont can be used with CID
>>> resources as well as regular fonts.  Unfortunately, I can't make the
>>> utf-8 regression test work either with or without my changes, so I
>>> can't be sure I got this right.
>> unfortunately, Ghostscript disagrees. It throws a /typecheck error from
>> --glyphshow-- , if you load the font as a regular font.
>
> Yech.  I suspect this is a bug in Ghostscript, though I could be
> reading the PostScript reference wrong.  Could you take a look at
> section 5.11.3 (CIDFont Dictionaries), the entry for selectfont in the
> operator index (page 656, or PDF page 670), and the entry for
> glyphshow (page 602, PDF page 616)?

I suspect you may know more about postscript than me, your guess is as
good as mine; If you think it is bug, can you file a bug with
ghostscript development?

I can send you a file with an embedded CFF CID font.


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

David Feuer-2
On 4/1/06, Han-Wen Nienhuys <[hidden email]> wrote:

> I suspect you may know more about postscript than me, your guess is as
> good as mine; If you think it is bug, can you file a bug with
> ghostscript development?
>
> I can send you a file with an embedded CFF CID font.

I don't actually know _too_ much about PostScript.  I write it with
the reference up on my screen, and fonts are one of the parts I
understand least.  If I get a chance, I'll ask the Ghostscript people
about it.

David Feuer


_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|

Re: Improvements to Postscript backend (patches included)

Han-Wen Nienhuys-2
David Feuer wrote:

> On 4/1/06, Han-Wen Nienhuys <[hidden email]> wrote:
>
>> I suspect you may know more about postscript than me, your guess is as
>> good as mine; If you think it is bug, can you file a bug with
>> ghostscript development?
>>
>> I can send you a file with an embedded CFF CID font.
>
> I don't actually know _too_ much about PostScript.  I write it with
> the reference up on my screen, and fonts are one of the parts I
> understand least.  If I get a chance, I'll ask the Ghostscript people
> about it.

Hi,

you can find a sample PS on

lilypond.org/~hanwen/typography-demo-macos.ps

the CFF font is HiraKaku Pro.

--

Han-Wen Nienhuys - [hidden email] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
  -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/lilypond-devel