[cairo-commit] 2 commits - src/cairo.h src/cairo-scaled-font.c

Uli Schlachter psychon at kemper.freedesktop.org
Thu Jan 27 08:45:23 PST 2011


 src/cairo-scaled-font.c |    5 +++--
 src/cairo.h             |    8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit a8e8d2aba811487dbb5b682c4f55065008e7ebbd
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Jan 25 16:29:58 2011 +0100

    scaled font: Fix the docs for cairo_scaled_font_get_font_face
    
    With the toy font API, it is possible that cairo_scaled_font_get_font_face()
    doesn't return the font face which was passed to cairo_scaled_font_create()
    despite the docs saying otherwise.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 2702877..196af4d 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -2870,8 +2870,9 @@ _cairo_scaled_font_get_max_scale (cairo_scaled_font_t *scaled_font)
  * cairo_scaled_font_get_font_face:
  * @scaled_font: a #cairo_scaled_font_t
  *
- * Gets the font face that this scaled font uses.  This is the
- * font face passed to cairo_scaled_font_create().
+ * Gets the font face that this scaled font uses.  This might be the
+ * font face passed to cairo_scaled_font_create(), but this does not
+ * hold true for all possible cases.
  *
  * Return value: The #cairo_font_face_t with which @scaled_font was
  * created.
commit 23f87951bae73d174131abdebfbcf5ae79b55779
Author: Uli Schlachter <psychon at znc.in>
Date:   Tue Jan 25 16:19:27 2011 +0100

    User fonts: Make it clear what should NOT be freed
    
    This is a misunderstanding that I actually saw in some real-world code that used
    to work fine with cairo 1.8. Once you spend some time trying to debug such a
    problem, you wish the docs would have said so. ;-)
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo.h b/src/cairo.h
index e087d89..a966c83 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1631,7 +1631,8 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
  * using cairo_glyph_allocate() and placed in @glyphs.  Upon return,
  * @num_glyphs should contain the number of generated glyphs.  If the value
  * @glyphs points at has changed after the call, the caller will free the
- * allocated glyph array using cairo_glyph_free().
+ * allocated glyph array using cairo_glyph_free().  The caller will also free
+ * the original value of @glyphs, so the callback shouldn't do so.
  * The callback should populate the glyph indices and positions (in font space)
  * assuming that the text is to be shown at the origin.
  *
@@ -1642,8 +1643,9 @@ typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scal
  * as a cluster buffer, and @num_clusters points to the number of cluster
  * entries available there.  If the provided cluster array is too short for
  * the conversion (or for convenience), a new cluster array may be allocated
- * using cairo_text_cluster_allocate() and placed in @clusters.  Upon return,
- * @num_clusters should contain the number of generated clusters.
+ * using cairo_text_cluster_allocate() and placed in @clusters.  In this case,
+ * the original value of @clusters will still be freed by the caller.  Upon
+ * return, @num_clusters should contain the number of generated clusters.
  * If the value @clusters points at has changed after the call, the caller
  * will free the allocated cluster array using cairo_text_cluster_free().
  *


More information about the cairo-commit mailing list