[cairo-commit] 3 commits - src/cairo-cff-subset.c
src/cairo-output-stream.c src/cairo-pdf-surface.c
Adrian Johnson
ajohnson at kemper.freedesktop.org
Tue Feb 13 05:33:29 PST 2007
src/cairo-cff-subset.c | 25 ++++++++++++++-----------
src/cairo-output-stream.c | 4 ++--
src/cairo-pdf-surface.c | 2 +-
3 files changed, 17 insertions(+), 14 deletions(-)
New commits:
diff-tree 6f7cfdf5c79c3c09a0241ae25ff540fb0d893d31 (from 88cae7766d6006e4169da1dcddc14a52e210cae5)
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Feb 13 23:53:38 2007 +1030
PDF: Add missing character code to Differences array
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 1e5e521..15ef4fc 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2044,7 +2044,7 @@ _cairo_pdf_surface_emit_truetype_font_su
_cairo_output_stream_printf (surface->output,
"%d 0 obj\r\n"
"<< /Type /Encoding\r\n"
- " /Differences [ ",
+ " /Differences [0 ",
encoding.id);
for (i = 0; i < font_subset->num_glyphs; i++)
diff-tree 88cae7766d6006e4169da1dcddc14a52e210cae5 (from 88f7ea4ad7926b135c987d3d75c029310c328010)
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Feb 13 23:29:05 2007 +1030
output-stream: coding style fix
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 9dd39a4..df3ae4d 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -225,8 +225,8 @@ _cairo_dtostr (char *buffer, size_t size
int decimal_len;
/* Omit the minus sign from negative zero. */
- if (d == 0)
- d = 0;
+ if (d == 0.0)
+ d = 0.0;
snprintf (buffer, size, "%f", d);
diff-tree 88f7ea4ad7926b135c987d3d75c029310c328010 (from ac01dcb5ad077d8ea08a93348fc23d4a891abaae)
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Tue Feb 13 22:52:53 2007 +1030
CFF: Fix Visual C++ compile problem
Don't use structure intitialization for assigning
structure values.
Add a new field to cff_charset_t to point to the sids
charset array instead of casting it into the data field.
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index b02983a..5c924d9 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -83,9 +83,10 @@ typedef struct _cff_dict_operator {
} cff_dict_operator_t;
typedef struct _cff_charset {
- cairo_bool_t is_builtin;
+ cairo_bool_t is_builtin;
+ const uint16_t *sids;
const unsigned char *data;
- int length;
+ int length;
} cff_charset_t;
typedef struct _cairo_cff_font {
@@ -876,23 +877,27 @@ static const uint16_t ExpertSubset_chars
341, 342, 343, 344, 345, 346,
};
-#define BUILTIN_CHARSET(name) ((cff_charset_t){TRUE, (const unsigned char *)&(name), sizeof(name)})
-
static cairo_int_status_t
cairo_cff_font_read_charset (cairo_cff_font_t *font)
{
switch (font->charset_offset) {
case 0:
/* ISOAdobe charset */
- font->charset = BUILTIN_CHARSET(ISOAdobe_charset);
+ font->charset.is_builtin = TRUE;
+ font->charset.sids = ISOAdobe_charset;
+ font->charset.length = sizeof (ISOAdobe_charset);
return CAIRO_STATUS_SUCCESS;
case 1:
/* Expert charset */
- font->charset = BUILTIN_CHARSET(Expert_charset);
+ font->charset.is_builtin = TRUE;
+ font->charset.sids = Expert_charset;
+ font->charset.length = sizeof (Expert_charset);
return CAIRO_STATUS_SUCCESS;
case 2:
/* ExpertSubset charset */;
- font->charset = BUILTIN_CHARSET(ExpertSubset_charset);
+ font->charset.is_builtin = TRUE;
+ font->charset.sids = ExpertSubset_charset;
+ font->charset.length = sizeof (ExpertSubset_charset);
return CAIRO_STATUS_SUCCESS;
default:
break;
@@ -1039,10 +1044,8 @@ cff_sid_from_gid (const cff_charset_t *c
int prev_glyph;
if (charset->is_builtin) {
- sids = (const uint16_t *)charset->data;
-
- if (gid - 1 < charset->length / 2)
- return sids[gid - 1];
+ if (gid - 1 < charset->length / 2)
+ return charset->sids[gid - 1];
}
else {
/* no need to check sizes here, this was done during reading */
More information about the cairo-commit
mailing list