[cairo] show_glyphs breakage in PS backend

Vladimir Vukicevic vladimir at pobox.com
Mon Mar 24 17:41:54 PDT 2008


Howdy,

It looks like show_glyphs is broken in the PS backend if glyph  
positions are specified that are not equal to the natural advances of  
the glyphs.  The attached testcase demonstrates the problem.  (This is  
mozilla bugzilla #423047 as well.)

I think I've identified the problems, but I'm not sure how to fix  
them... two things:

The first problem is in the current PS definition of TJ is:

/TJ {
   {
     dup
     type /stringtype eq
     { show } { -0.0001 mul 0 rmoveto } ifelse
   } forall
} bind def

I believe the -0.0001 should be -0.001 (should be 1/1000th, not  
1/10,000th).

The second problem is in show_glyphs impl itself... positioned glyphs  
are shown via:

BT
/f-0-0 1 Tf
12 0 0 12 42 738 Tm
[<01> -965 <02>] TJ
ET

in PDF, the 12.0 scale in the text matrix will be applied to the -965  
(/1000) offset in the TJ.  However, in PS, TJ is emulated using the  
current path position and rmoveto; the text matrix scale isn't being  
applied.  I'm not sure how to fix this in a way that's compatible with  
both the PS and PDF backends... one way would be for the ps backend to  
pre-scale the glyphs array positions, but that would break the initial  
output of the Tm.  We could probably avoid that by doing "12 0 0 12 0  
0 Tm 42 738 Td", because the Td would be implemented as a moveto in PS  
and would thus need to be scaled.  Hopefully Adrian has some ideas :)

     - Vlad

-------------- next part --------------
A non-text attachment was scrubbed...
Name: show-glyphs-spacing.c
Type: application/octet-stream
Size: 937 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080324/850e4222/attachment.obj 
-------------- next part --------------



More information about the cairo mailing list