Add preliminary text support, including support for truetype font subsetting.

Change type of 'surface' argument in show_glyphs to void * as it is for all other surface virtual functions.
Update accordingly.
Add check for endianess.
Fix bug in array growing loop. (_cairo_array_append): Accept NULL for elements argument, in which case we just allocate space in the array.
This commit is contained in:
Kristian Høgsberg 2005-01-17 09:40:00 +00:00
parent be7b745a43
commit 2c6939b7ac
9 changed files with 1798 additions and 71 deletions

View file

@ -1,3 +1,20 @@
2005-01-17 Kristian Høgsberg <krh@redhat.com>
* src/cairo_pdf_surface.c: Add preliminary text support, including
support for truetype font subsetting.
* src/cairoint.h: Change type of 'surface' argument in show_glyphs
to void * as it is for all other surface virtual functions.
* src/cairo_xlib_surface.c (_cairo_xlib_surface_show_glyphs):
Update accordingly.
* configure.in: Add check for endianess.
* src/cairo_array.c (_cairo_array_grow_by): Fix bug in array
growing loop.
(_cairo_array_append): Accept NULL for elements argument, in which
case we just allocate space in the array.
2005-01-17 Kristian Høgsberg <krh@redhat.com>
* test/Makefile.am (EXTRA_DIST): Take image_rotate-ref.png out of

View file

@ -33,6 +33,7 @@ AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_STDC_HEADERS
AC_C_BIGENDIAN
AC_CHECK_LIBM

View file

@ -68,7 +68,7 @@ _cairo_array_grow_by (cairo_array_t *array, int additional)
new_size = old_size * 2;
while (new_size < required_size)
new_size = old_size * 2;
new_size = new_size * 2;
array->size = new_size;
new_elements = realloc (array->elements,
@ -105,22 +105,26 @@ _cairo_array_copy_element (cairo_array_t *array, int index, void *dst)
memcpy (dst, _cairo_array_index (array, index), array->element_size);
}
cairo_status_t
_cairo_array_append (cairo_array_t *array, void *elements, int num_elements)
void *
_cairo_array_append (cairo_array_t *array,
const void *elements, int num_elements)
{
cairo_status_t status;
void *dest;
status = _cairo_array_grow_by (array, num_elements);
if (status != CAIRO_STATUS_SUCCESS)
return status;
return NULL;
assert (array->num_elements + num_elements <= array->size);
memcpy (&array->elements[array->num_elements * array->element_size],
elements, num_elements * array->element_size);
dest = &array->elements[array->num_elements * array->element_size];
array->num_elements += num_elements;
return CAIRO_STATUS_SUCCESS;
if (elements != NULL)
memcpy (dest, elements, num_elements * array->element_size);
return dest;
}
int

File diff suppressed because it is too large Load diff

View file

@ -697,7 +697,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
void *abstract_surface,
int source_x,
int source_y,
const cairo_glyph_t *glyphs,
@ -1250,14 +1250,14 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
void *abstract_surface,
int source_x,
int source_y,
const cairo_glyph_t *glyphs,
int num_glyphs)
{
unsigned int elt_size;
cairo_xlib_surface_t *self = (cairo_xlib_surface_t *) surface;
cairo_xlib_surface_t *self = abstract_surface;
cairo_image_surface_t *tmp = NULL;
cairo_xlib_surface_t *src = NULL;
glyphset_cache_t *g;
@ -1278,7 +1278,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
}
/* prep the source surface. */
if (source->backend == surface->backend) {
if (source->backend == self->base.backend) {
src = (cairo_xlib_surface_t *) source;
} else {
@ -1287,7 +1287,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
goto FREE_ENTRIES;
src = (cairo_xlib_surface_t *)
_cairo_surface_create_similar_scratch (surface, self->format, 1,
_cairo_surface_create_similar_scratch (&self->base, self->format, 1,
tmp->width, tmp->height);
if (src == NULL)

View file

@ -68,7 +68,7 @@ _cairo_array_grow_by (cairo_array_t *array, int additional)
new_size = old_size * 2;
while (new_size < required_size)
new_size = old_size * 2;
new_size = new_size * 2;
array->size = new_size;
new_elements = realloc (array->elements,
@ -105,22 +105,26 @@ _cairo_array_copy_element (cairo_array_t *array, int index, void *dst)
memcpy (dst, _cairo_array_index (array, index), array->element_size);
}
cairo_status_t
_cairo_array_append (cairo_array_t *array, void *elements, int num_elements)
void *
_cairo_array_append (cairo_array_t *array,
const void *elements, int num_elements)
{
cairo_status_t status;
void *dest;
status = _cairo_array_grow_by (array, num_elements);
if (status != CAIRO_STATUS_SUCCESS)
return status;
return NULL;
assert (array->num_elements + num_elements <= array->size);
memcpy (&array->elements[array->num_elements * array->element_size],
elements, num_elements * array->element_size);
dest = &array->elements[array->num_elements * array->element_size];
array->num_elements += num_elements;
return CAIRO_STATUS_SUCCESS;
if (elements != NULL)
memcpy (dest, elements, num_elements * array->element_size);
return dest;
}
int

File diff suppressed because it is too large Load diff

View file

@ -697,7 +697,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
void *abstract_surface,
int source_x,
int source_y,
const cairo_glyph_t *glyphs,
@ -1250,14 +1250,14 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
cairo_font_scale_t *scale,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
void *abstract_surface,
int source_x,
int source_y,
const cairo_glyph_t *glyphs,
int num_glyphs)
{
unsigned int elt_size;
cairo_xlib_surface_t *self = (cairo_xlib_surface_t *) surface;
cairo_xlib_surface_t *self = abstract_surface;
cairo_image_surface_t *tmp = NULL;
cairo_xlib_surface_t *src = NULL;
glyphset_cache_t *g;
@ -1278,7 +1278,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
}
/* prep the source surface. */
if (source->backend == surface->backend) {
if (source->backend == self->base.backend) {
src = (cairo_xlib_surface_t *) source;
} else {
@ -1287,7 +1287,7 @@ _cairo_xlib_surface_show_glyphs (cairo_unscaled_font_t *font,
goto FREE_ENTRIES;
src = (cairo_xlib_surface_t *)
_cairo_surface_create_similar_scratch (surface, self->format, 1,
_cairo_surface_create_similar_scratch (&self->base, self->format, 1,
tmp->width, tmp->height);
if (src == NULL)

View file

@ -276,8 +276,9 @@ _cairo_array_grow_by (cairo_array_t *array, int additional);
cairo_private void
_cairo_array_truncate (cairo_array_t *array, int length);
cairo_private cairo_status_t
_cairo_array_append (cairo_array_t *array, void *elements, int num_elements);
cairo_private void *
_cairo_array_append (cairo_array_t *array,
const void *elements, int num_elements);
cairo_private void *
_cairo_array_index (cairo_array_t *array, int index);
@ -606,7 +607,7 @@ typedef struct _cairo_surface_backend {
cairo_font_scale_t *scale,
cairo_operator_t operator,
cairo_surface_t *source,
cairo_surface_t *surface,
void *surface,
int source_x,
int source_y,
const cairo_glyph_t *glyphs,