[cairo-bugs] [Bug 5495] Need cairo_scaled_font_text_extents

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Jan 20 16:07:26 PST 2006


Please do not reply to this email: if you want to comment on the bug, go to    
       
the URL shown below and enter yourcomments there.     
   
https://bugs.freedesktop.org/show_bug.cgi?id=5495          
     




------- Additional Comments From cworth at cworth.org  2006-01-21 11:03 -------
[copying my recent post to cairo at cairographics.org which reviews the latest
patch here]

The indentation for the patch needs to be changed from two spaces to
cairo's standard of four spaces (see cairo/CODING_STYLE for more
details).

Beyond that, I would like to see a little bit more detail in the
documentation to describe what the returned extents actually are,
(that is how they correspond to something that might be drawn). I
recognize that you modelled the new documentation from the existing
documentation for cairo_scaled_font_glyph_extents---it should be fixed
as well.

For example, the documentation for cairo_text_extents has the
following paragraph:

    * Gets the extents for a string of text. The extents describe a
    * user-space rectangle that encloses the "inked" portion of the text,
    * (as it would be drawn by cairo_show_text()). Additionally, the
    * x_advance and y_advance values indicate the amount by which the
    * current point would be advanced by cairo_show_text().

This makes very clear the strong association between the values
returned by cairo_text_extents and the effects of cairo_show_text.
(There's also a second paragraph about whitespace character which you
may just want to copy verbatim.)

For cairo_scaled_font_text_extents, the first paragraph is a bit
trickier to write since the drawing operation to reference is
cairo_show_text, but only if the cairo_t is using the same scaled
font. Maybe the right way to describe the operation would be to have
the literal code necessary to achieve the same effect. Maybe something
like:

        cairo_font_face_t *font_face;
        cairo_matrix_t font_matrix, ctm;
        cairo_font_options_t font_options;

        font_face = cairo_scaled_font_get_font_face (scaled_font);
        cairo_scaled_font_get_font_matrix (scaled_font, &font_matrix);
        cairo_scaled_font_get_ctm (scaled_font, &ctm);
        cairo_scaled_font_get_font_options (scaled_font, &font_options);

        cairo_set_font_face (cr, font_face);
        cairo_set_font_matrix (cr, &font_matrix);
        cairo_set_matrix (cr, &ctm);
        cairo_set_font_options (cr, &font_options);

        cairo_show_text (cr, text);

Though, now that I type that all out, maybe it would be easier to just
describe it with text, saying something like "as it would be drawn by
cairo_show_text if the cairo graphics state were set to the same
font_face, font_matrix, ctm, and font_options as @scaled_font).

Anyway, I'll let you take a whack at the complete paragraph.

Does anybody see any problem with adding this new
cairo_scaled_font_text_extents function? I've been convinced that this
makes sense *instead of* ever adding any sort of text_to_glyphs
functionality within cairo.
          
     
     
--           
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email         
     
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the cairo-bugs mailing list