[Cairo] Re: [xsvg] cairo_text_extents ?

Bill Spitzak spitzak at d2.com
Thu Dec 4 20:37:44 PST 2003


On Thursday 04 December 2003 01:45 pm, Carl Worth wrote:

> And cairo already allows the user to manage external matrices via
> cairo_set_matrix and cairo_current_matrix. Those calls should let you
> do exactly what you've described, but in a manner that is simpler,
> more flexible, and consistent with PostScript.

Okay I'll accept that, if changing the matrix does not cause the current 
point to change. I think my main concern was that saving a matrix for use 
later should not require transmission back from Cairo to the program, so that 
Cairo can easily be translated to a stream format. This maybe could be done 
by having a saved matrix slot in the current gstate that you can save or 
restore the transformation to.

> Are you claiming that cairo_move_to/cairo_restore behave fundamentally
> differently than PostScript moveto/grestore? If so, that's a bug, and
> I would be quite interested to see a test case so we can fix this.

It appears Postscript (or Ghostscript) works like Cairo. I expected the 
following program to draw two identical shapes, but it does not. I always 
assummed the path was more like marks on the page, and unaffected by 
gsave/grestore:

.5 setgray
100 100 moveto
200 100 lineto
250 125 lineto
200 150 lineto
100 150 lineto
closepath
fill

0 setgray
100 100 moveto
200 100 lineto
gsave
250 125 lineto
grestore
200 150 lineto
100 150 lineto
closepath
fill
showpage

>  > Instead the "toy" api should accept complex strings that can describe a
>  > font in the device-specific API.
>
> No, I don't want to go there. That's why I keep using the word "toy" here.
> if you want platform-specific fonts, then use the platform-specific
> API.

I want to allow a platform-specific "configuration" program that says "the 
default font is this". As designed I CANNOT do this unless every program uses 
the platform-specific interface. This is only for constant strings. Programs 
are not expected to modify or generate these to use platform-specific fonts, 
they should use the platform interface. It is simply a communication 
mechanism, similar to a url. If you really insist, make it a hex number so 
programs cannot possibly attempt to interpret them. However I think this is 
VITAL that this be provided.

-- 
                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com




More information about the cairo mailing list