Re: Cairo and ISO C++
Bill Spitzak <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Behdad Esfahbod wrote: > To fix this, we want to lock the line width / font size in device space at the > time they are set. To fix these in the wrapper is not impossible: > > - During set_line_width / set_font_size, multiply them by the current > transformation matrix and set to *that*, > > - During stroke() / show_text/glyphs/...(), cairo_save(), set transformation > matrix to identity, stroke/show_text/..., and cairo_restore(), A way to fix it is to ignore the cairo transforms entirely and do them yourself in the wrapper. Cairo is run with the identity transform. You can redefine the state object to not have cairo's transform and to include yours. This can also be used to fix the linewidth=0 problem which I will describe in another email. > - For font_size: show_text/glyphs/... take glyph coordinates, so we need to > multiply those by the current transformation matrix before resetting the > matrix. Alternatively, we can transform the font matrix by inverse of current > transformation matrix and set that before the operation. The relative portion of glyph coordinates cannot use the CTM, otherwise text layout (which is mostly concerned with placing the glyphs next to each other in a way controlled by the glyph size) would have to be told the transform. I would instead use a space where 0,0 lines up with the CTM but the scale and rotation are the ones when the font was selected. Font metrics must also be returned in this space. > Also, this has implications on dashed lines. I think the > dash pattern also suffers from the same shortcomings. I think it would be acceptable to define dash patterns as being in "pen space", ie if the pen is twice as large all the dashes are twice as long. This could be implemented by leaving Cairo's line width at 1 and transforming to "pen space" before drawing any lines. This could be done if the wrapper does all transforms. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo