[cairo-commit] 11 commits - doc/public src/cairo.c src/cairo-fixed-private.h src/cairo.h src/cairoint.h src/cairo-pattern.c src/cairo-surface.c src/cairo-traps.c src/cairo-user-font.c src/cairo-xlib-surface.c test/Makefile.am test/README test/user-font.c test/user-font-pdf-ref.png test/user-font-ref.png test/user-font-svg-ref.png
Behdad Esfahbod
behdad at kemper.freedesktop.org
Fri May 16 19:21:54 PDT 2008
doc/public/cairo-sections.txt | 1
doc/public/tmpl/cairo-surface.sgml | 10 ++++++
src/cairo-fixed-private.h | 11 ++++++
src/cairo-pattern.c | 3 +
src/cairo-surface.c | 59 +++++++++++++++++++++++--------------
src/cairo-traps.c | 19 ++++++-----
src/cairo-user-font.c | 5 +--
src/cairo-xlib-surface.c | 2 -
src/cairo.c | 3 +
src/cairo.h | 5 +++
src/cairoint.h | 4 ++
test/Makefile.am | 20 ++++++++----
test/README | 19 +++++++++++
test/user-font-pdf-ref.png |binary
test/user-font-ref.png |binary
test/user-font-svg-ref.png |binary
test/user-font.c | 10 +++---
17 files changed, 125 insertions(+), 46 deletions(-)
New commits:
commit 26eeb1c7ee2416e4029e1ceee7afe779cca6dfc5
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Fri May 16 21:59:45 2008 -0400
[cairo-surface] Allow flush and finish calls after surface is finished
Flushing and finishing a surface after it has already been finished is a
very well-defined operation: no-op. Allow and document that.
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index cacb6e5..ba39b9b 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -474,8 +474,9 @@ cairo_surface_get_reference_count (cairo_surface_t *surface)
* external resources. For example, for the Xlib backend it means
* that cairo will no longer access the drawable, which can be freed.
* After calling cairo_surface_finish() the only valid operations on a
- * surface are getting and setting user data and referencing and
- * destroying it. Further drawing to the surface will not affect the
+ * surface are getting and setting user, referencing and
+ * destroying, and flushing and finishing it.
+ * Further drawing to the surface will not affect the
* surface but will instead trigger a %CAIRO_STATUS_SURFACE_FINISHED
* error.
*
@@ -495,28 +496,18 @@ cairo_surface_finish (cairo_surface_t *surface)
if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
return;
- if (surface->finished) {
- status = _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
+ if (surface->finished)
return;
- }
- if (!surface->status && surface->backend->flush) {
- status = surface->backend->flush (surface);
- if (status) {
- status = _cairo_surface_set_error (surface, status);
- return;
- }
- }
+ cairo_surface_flush (surface);
- if (surface->backend->finish == NULL) {
- surface->finished = TRUE;
- return;
+ /* call finish even if in error mode */
+ if (surface->backend->finish) {
+ status = surface->backend->finish (surface);
+ if (status)
+ status = _cairo_surface_set_error (surface, status);
}
- status = surface->backend->finish (surface);
- if (status)
- status = _cairo_surface_set_error (surface, status);
-
surface->finished = TRUE;
}
slim_hidden_def (cairo_surface_finish);
@@ -662,10 +653,8 @@ cairo_surface_flush (cairo_surface_t *surface)
if (surface->status)
return;
- if (surface->finished) {
- status = _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
+ if (surface->finished)
return;
- }
if (surface->backend->flush) {
status = surface->backend->flush (surface);
commit 168447cc2b53e446bf8e67e2f457c54256bcbada
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 20:09:17 2008 -0400
[user-font] Use opaque colors such that PS backend gets tested
Also update ref images. All backends pass now.
diff --git a/test/user-font-pdf-ref.png b/test/user-font-pdf-ref.png
index 1fb65b8..ea5b962 100644
Binary files a/test/user-font-pdf-ref.png and b/test/user-font-pdf-ref.png differ
diff --git a/test/user-font-ref.png b/test/user-font-ref.png
index e996147..abc3117 100644
Binary files a/test/user-font-ref.png and b/test/user-font-ref.png differ
diff --git a/test/user-font-svg-ref.png b/test/user-font-svg-ref.png
index 1fb65b8..28ba652 100644
Binary files a/test/user-font-svg-ref.png and b/test/user-font-svg-ref.png differ
diff --git a/test/user-font.c b/test/user-font.c
index b6acba8..81871a5 100644
--- a/test/user-font.c
+++ b/test/user-font.c
@@ -205,7 +205,7 @@ draw (cairo_t *cr, int width, int height)
cairo_rel_line_to (cr, 0, 2*BORDER + TEXT_SIZE);
cairo_move_to (cr, BORDER + extents.x_advance, 0);
cairo_rel_line_to (cr, 0, 2*BORDER + TEXT_SIZE);
- cairo_set_source_rgba (cr, 1, 0, 0, .8);
+ cairo_set_source_rgb (cr, 1, 0, 0);
cairo_set_line_width (cr, 2);
cairo_stroke (cr);
@@ -213,18 +213,18 @@ draw (cairo_t *cr, int width, int height)
cairo_rectangle (cr,
BORDER + extents.x_bearing, BORDER + font_extents.ascent + extents.y_bearing,
extents.width, extents.height);
- cairo_set_source_rgba (cr, 0, 1, 0, .8);
+ cairo_set_source_rgb (cr, 0, 1, 0);
cairo_set_line_width (cr, 2);
cairo_stroke (cr);
/* text in gray */
- cairo_set_source_rgba (cr, 0, 0, 0, 0.5);
+ cairo_set_source_rgb (cr, 0, 0, 0);
cairo_move_to (cr, BORDER, BORDER + font_extents.ascent);
cairo_show_text (cr, text);
/* filled version of text in light blue */
- cairo_set_source_rgba (cr, 0, 0, 1, 0.5);
+ cairo_set_source_rgb (cr, 0, 0, 1);
cairo_move_to (cr, BORDER, BORDER + font_extents.height + 2*BORDER + font_extents.ascent);
cairo_text_path (cr, text);
cairo_fill (cr);
commit 556b16d6a20f11627c75c1365dea5a6332091779
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 20:03:05 2008 -0400
[cairo-traps] Fix overflow in traps_path code
This was causing the user-font test failure in type1 subsetting
code as the type1 code creates a font at size 1000.
diff --git a/src/cairo-traps.c b/src/cairo-traps.c
index 91bb926..fcb0208 100644
--- a/src/cairo-traps.c
+++ b/src/cairo-traps.c
@@ -660,18 +660,19 @@ _cairo_traps_extract_region (const cairo_traps_t *traps,
/* moves trap points such that they become the actual corners of the trapezoid */
static void
-_sanitize_trap (cairo_trapezoid_t *trap)
+_sanitize_trap (cairo_trapezoid_t *t)
{
-/* XXX the math here is fragile. can overflow in extreme cases */
-#define FIX(t, lr, tb, p) \
+ cairo_trapezoid_t s = *t;
+
+#define FIX(lr, tb, p) \
if (t->lr.p.y != t->tb) { \
- t->lr.p.x = t->lr.p2.x + (t->lr.p1.x - t->lr.p2.x) * (t->tb - t->lr.p2.y) / (t->lr.p1.y - t->lr.p2.y); \
- t->lr.p.y = t->tb; \
+ t->lr.p.x = s.lr.p2.x + _cairo_fixed_mul_div (s.lr.p1.x - s.lr.p2.x, s.tb - s.lr.p2.y, s.lr.p1.y - s.lr.p2.y); \
+ t->lr.p.y = s.tb; \
}
- FIX (trap, left, top, p1);
- FIX (trap, left, bottom, p2);
- FIX (trap, right, top, p1);
- FIX (trap, right, bottom, p2);
+ FIX (left, top, p1);
+ FIX (left, bottom, p2);
+ FIX (right, top, p1);
+ FIX (right, bottom, p2);
}
cairo_private cairo_status_t
commit b355ac7a9fe8ecf550ec5f615969b82f0e45a6d6
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 20:02:33 2008 -0400
[cairo-fixed] Implement _cairo_fixed_mul_div()
Computes a*b/c where a,b,c are cairo_fixed_t.
diff --git a/src/cairo-fixed-private.h b/src/cairo-fixed-private.h
index f1d5820..630f032 100644
--- a/src/cairo-fixed-private.h
+++ b/src/cairo-fixed-private.h
@@ -226,6 +226,17 @@ _cairo_fixed_mul (cairo_fixed_t a, cairo_fixed_t b)
return _cairo_int64_to_int32(_cairo_int64_rsl (temp, CAIRO_FIXED_FRAC_BITS));
}
+/* computes a * b / c */
+static inline cairo_fixed_t
+_cairo_fixed_mul_div (cairo_fixed_t a, cairo_fixed_t b, cairo_fixed_t c)
+{
+ cairo_int64_t ab = _cairo_int32x32_64_mul (a, b);
+ cairo_int64_t c64 = _cairo_int32_to_int64 (c);
+ cairo_int64_t quo = _cairo_int64_divrem (ab, c64).quo;
+
+ return _cairo_int64_to_int32(quo);
+}
+
#else
# error Please define multiplication and other operands for your fixed-point type size
#endif
commit 84606a900f0664a0010034f5eb4bdaf159e77bfe
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 19:41:49 2008 -0400
[cairo-surface] Fix compiler warnings
by adding new status value to switch.
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index b86c8a1..cacb6e5 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2548,6 +2548,9 @@ _cairo_surface_create_in_error (cairo_status_t status)
case CAIRO_STATUS_INVALID_DSC_COMMENT:
case CAIRO_STATUS_INVALID_INDEX:
case CAIRO_STATUS_CLIP_NOT_REPRESENTABLE:
+ case CAIRO_STATUS_FONT_TYPE_MISMATCH:
+ case CAIRO_STATUS_USER_FONT_IMMUTABLE:
+ case CAIRO_STATUS_USER_FONT_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;
commit 142ba306047363af8343f29b2cf97c25919042e9
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 18:50:55 2008 -0400
[test/Makefile.am] Add 'make run' target
It runs tests under a tool specified tool. For example:
make run TOOL=gdb TESTS=user-font TARGETS=pdf
diff --git a/test/Makefile.am b/test/Makefile.am
index 88cc1ed..2b8e156 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -860,7 +860,10 @@ EXTRA_PROGRAMS += $(TESTS) $(DISABLED_TESTS)
TARGETS = $(CAIRO_TEST_TARGET)
TARGETS_EXCLUDE = $(CAIRO_TEST_TARGET_EXCLUDE)
-TESTS_ENVIRONMENT = CAIRO_XFAIL_TESTS="$(XFAIL_TESTS:$(EXEEXT)=)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)"
+# Same about ENV vs CAIRO_TEST_ENV. ENV is used with "make run" only
+ENV = $(CAIRO_TEST_ENV)
+
+TESTS_ENVIRONMENT = CAIRO_XFAIL_TESTS="$(XFAIL_TESTS:$(EXEEXT)=)" CAIRO_TEST_TARGET="$(TARGETS)" CAIRO_TEST_TARGET_EXCLUDE="$(TARGETS_EXCLUDE)" $(ENV)
EXTRA_VALGRIND_FLAGS = $(CAIRO_EXTRA_VALGRIND_FLAGS)
VALGRIND_FLAGS = \
@@ -887,11 +890,6 @@ clean-local:
-${FIND} . -name '*-diff.png' -print | ${XARGS} ${RM}
-${FIND} . -name '*.log' -print | ${XARGS} ${RM}
-# Check tests under valgrind
-# Saves log to valgrind-log
-check-valgrind:
- $(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute valgrind $(VALGRIND_FLAGS)' 2>&1 | tee valgrind-log
-
# The following definitions both should work.
#FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:$(EXEEXT)=.log) 2>/dev/null | sed -e 's/[.]log$$//' | xargs echo`
FAILED_TESTS = `grep -l '\<FAIL\>' $(TESTS:$(EXEEXT)=.log) 2>/dev/null | tr '\n' ' ' | sed -e 's/[.]log */ /g; s/^ //; s/ $$//'`
@@ -925,6 +923,15 @@ html:
rehtml:
@$(MAKE) $(AM_MAKEFLAGS) TESTS="$(FAILED_TESTS)" html
+# Run tests under a tool specified by TOOL. For example, make run TOOL=gdb
+run:
+ $(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute env $(TOOL)'
+
+# Check tests under valgrind. Saves log to valgrind-log
+check-valgrind:
+ $(MAKE) $(AM_MAKEFLAGS) check TESTS_ENVIRONMENT='$(TESTS_ENVIRONMENT) $(top_builddir)/libtool --mode=execute valgrind $(VALGRIND_FLAGS)' 2>&1 | tee valgrind-log
+
+
%.log: % $(check_PROGRAMS)
-./$<
@@ -937,6 +944,7 @@ index.html: $(srcdir)/make-html.pl $(TESTS:$(EXEEXT)=.log)
@echo Creating index.html
@perl $^ > $@
+
# Identify identical reference images
check-ref-dups:
@LANG=C; \
diff --git a/test/README b/test/README
index a241d8a..3b154e1 100644
--- a/test/README
+++ b/test/README
@@ -42,6 +42,25 @@ This will re-run the test suite, but only on tests that failed on the
last run. So this is a much faster way of checking if changes actually
fix bugs rather than running the entire test suite again.
+Running tests under modified enviroments or tools
+-------------------------------------------------
+To run tests under a tool like gdb, one can use the run target and
+the TOOL variable. For example:
+
+ make run TOOL=gdb TARGETS=pdf TESTS=user-font
+
+If you want to run under valgrind, there is a specific target for that
+that also sets a bunch of useful valgrind options. Try:
+
+ make check-valgrind TESTS=user-font
+
+You can run tests under a modified environment you can use the ENV
+make variable. However, that environment will also affect the libtool
+wrapper of the tests. To only affect the actual test binaries, pass
+such environment as TOOL:
+
+ make run TOOL="LD_PRELOAD=/path/to/something.so" TEST=user-font
+
Getting the elusive zero failures
---------------------------------
It's generally been very difficult to achieve a test run with zero
commit 537ffa762833c990e4e4237f2dbae64c7e311662
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 18:47:24 2008 -0400
[cairo-xlib-surface.c] Fix memmove bug
This was introduced in b7272e9e8e716b04752058855aeb74c42af0b395
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 58ac34c..fef51f1 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2975,7 +2975,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
to_free->glyph_count--;
memmove (&to_free->glyph_indices[i],
&to_free->glyph_indices[i+1],
- (to_free->glyph_count - i) * sizeof (to_free->glyph_indices));
+ (to_free->glyph_count - i) * sizeof (to_free->glyph_indices[0]));
goto DONE;
}
}
commit 4dd4d96fb11354e37f662eaabb1d874dbf47e368
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 17:19:53 2008 -0400
[cairo-surface] Add cairo_surface_get_fallback_resolution()
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 1696f15..b71b97a 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -163,6 +163,7 @@ cairo_surface_mark_dirty_rectangle
cairo_surface_set_device_offset
cairo_surface_get_device_offset
cairo_surface_set_fallback_resolution
+cairo_surface_get_fallback_resolution
cairo_surface_type_t
cairo_surface_get_type
cairo_surface_get_reference_count
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index 07acd37..20a1d35 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -164,6 +164,16 @@ cairo_<emphasis>backend</emphasis>_surface_create().
@y_pixels_per_inch:
+<!-- ##### FUNCTION cairo_surface_get_fallback_resolution ##### -->
+<para>
+
+</para>
+
+ at surface:
+ at x_pixels_per_inch:
+ at y_pixels_per_inch:
+
+
<!-- ##### ENUM cairo_surface_type_t ##### -->
<para>
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index edb1d75..b86c8a1 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -915,6 +915,29 @@ cairo_surface_set_fallback_resolution (cairo_surface_t *surface,
}
slim_hidden_def (cairo_surface_set_fallback_resolution);
+/**
+ * cairo_surface_get_fallback_resolution:
+ * @surface: a #cairo_surface_t
+ * @x_pixels_per_inch: horizontal pixels per inch
+ * @y_pixels_per_inch: vertical pixels per inch
+ *
+ * This function returns the previous fallback resolution set by
+ * cairo_surface_set_fallback_resolution(), or default fallback
+ * resolution if never set.
+ *
+ * Since: 1.8
+ **/
+void
+cairo_surface_get_fallback_resolution (cairo_surface_t *surface,
+ double *x_pixels_per_inch,
+ double *y_pixels_per_inch)
+{
+ if (x_pixels_per_inch)
+ *x_pixels_per_inch = surface->x_fallback_resolution;
+ if (y_pixels_per_inch)
+ *y_pixels_per_inch = surface->y_fallback_resolution;
+}
+
cairo_bool_t
_cairo_surface_has_device_transform (cairo_surface_t *surface)
{
diff --git a/src/cairo.c b/src/cairo.c
index 1a0da69..e03ad26 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -1268,6 +1268,7 @@ cairo_set_matrix (cairo_t *cr,
if (status)
_cairo_set_error (cr, status);
}
+slim_hidden_def (cairo_set_matrix);
/**
* cairo_identity_matrix:
@@ -2756,6 +2757,7 @@ cairo_set_font_size (cairo_t *cr, double size)
if (status)
_cairo_set_error (cr, status);
}
+slim_hidden_def (cairo_set_font_size);
/**
* cairo_set_font_matrix
@@ -2831,6 +2833,7 @@ cairo_set_font_options (cairo_t *cr,
_cairo_gstate_set_font_options (cr->gstate, options);
}
+slim_hidden_def (cairo_set_font_options);
/**
* cairo_get_font_options:
diff --git a/src/cairo.h b/src/cairo.h
index 2116f00..19ef7f0 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1669,6 +1669,11 @@ cairo_surface_set_fallback_resolution (cairo_surface_t *surface,
double y_pixels_per_inch);
cairo_public void
+cairo_surface_get_fallback_resolution (cairo_surface_t *surface,
+ double *x_pixels_per_inch,
+ double *y_pixels_per_inch);
+
+cairo_public void
cairo_surface_copy_page (cairo_surface_t *surface);
cairo_public void
diff --git a/src/cairoint.h b/src/cairoint.h
index beca174..8716bd4 100755
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2357,8 +2357,12 @@ slim_hidden_proto (cairo_scaled_font_get_font_options);
slim_hidden_proto (cairo_scaled_font_glyph_extents);
slim_hidden_proto_no_warn (cairo_scaled_font_reference);
slim_hidden_proto (cairo_scaled_font_status);
+slim_hidden_proto (cairo_set_font_size);
+slim_hidden_proto (cairo_set_font_options);
+slim_hidden_proto (cairo_set_matrix);
slim_hidden_proto (cairo_set_operator);
slim_hidden_proto (cairo_set_source);
+slim_hidden_proto (cairo_set_source);
slim_hidden_proto (cairo_set_source_surface);
slim_hidden_proto (cairo_status);
slim_hidden_proto (cairo_stroke_preserve);
commit 2321b91cbad7f9531ab99a7b1875eba0dcc167db
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 16:38:56 2008 -0400
[cairo-pattern] Make a free() call conditional
to emphasize that the pointer may be NULL
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index aa32b85..c0bfbaf 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -358,7 +358,8 @@ _cairo_pattern_reset_solid_pattern_cache (void)
CAIRO_MUTEX_LOCK (_cairo_pattern_solid_pattern_cache_lock);
for (i = 0; i < MIN (ARRAY_LENGTH (solid_pattern_cache.patterns), solid_pattern_cache.size); i++) {
- free (solid_pattern_cache.patterns[i]);
+ if (solid_pattern_cache.patterns[i])
+ free (solid_pattern_cache.patterns[i]);
solid_pattern_cache.patterns[i] = NULL;
}
solid_pattern_cache.size = 0;
commit 62652ecab7c3163d6b0cf9af3312806ae6bda21a
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 13:28:03 2008 -0400
[test/user-font] Another minor tweak to the font
diff --git a/test/user-font-pdf-ref.png b/test/user-font-pdf-ref.png
index 7ddc96d..1fb65b8 100644
Binary files a/test/user-font-pdf-ref.png and b/test/user-font-pdf-ref.png differ
diff --git a/test/user-font-ref.png b/test/user-font-ref.png
index 23acd92..e996147 100644
Binary files a/test/user-font-ref.png and b/test/user-font-ref.png differ
diff --git a/test/user-font-svg-ref.png b/test/user-font-svg-ref.png
index 7ddc96d..1fb65b8 100644
Binary files a/test/user-font-svg-ref.png and b/test/user-font-svg-ref.png differ
diff --git a/test/user-font.c b/test/user-font.c
index ef42284..b6acba8 100644
--- a/test/user-font.c
+++ b/test/user-font.c
@@ -74,7 +74,7 @@ static const struct {
{ ' ', 1, { END_GLYPH } },
{ '-', 2, { 7, 8, STROKE, END_GLYPH } },
{ '.', 1, { 10, 10, STROKE, END_GLYPH } },
- { 'a', 3, { 4, 6, 12, 10, 7, 8, STROKE, END_GLYPH } },
+ { 'a', 3, { 4, 6, 12, 10, 7, 9, STROKE, END_GLYPH } },
{ 'c', 3, { 6, 4, 10, 12, STROKE, END_GLYPH } },
{ 'e', 3, { 12, 10, 4, 6, 9, 7, STROKE, END_GLYPH } },
{ 'f', 3, { 3, 2, 11, STROKE, 4, 6, STROKE, END_GLYPH } },
commit df9deb1853ab199b576cd4313b80cb3dd536f74f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu May 15 13:13:30 2008 -0400
[user-font] Set correct device-offset for rotated text
Part of patch from Peter Clifton
diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index 3745380..df2a18c 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -170,13 +170,14 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
_cairo_fixed_integer_floor (scaled_glyph->bbox.p1.x);
height = _cairo_fixed_integer_ceil (scaled_glyph->bbox.p2.y) -
_cairo_fixed_integer_floor (scaled_glyph->bbox.p1.y);
+
/* XXX handle / figure out antialias/subpixel font options to choose
* the right format here? */
surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
cairo_surface_set_device_offset (surface,
- _cairo_lround (-scaled_glyph->metrics.x_bearing),
- _cairo_lround (-scaled_glyph->metrics.y_bearing));
+ - _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.x),
+ - _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.y));
status = _cairo_meta_surface_replay (meta_surface, surface);
if (status) {
More information about the cairo-commit
mailing list