summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-05-12 12:31:13 (GMT)
committer John Mark Bell <jmb@netsurf-browser.org>2009-05-12 12:31:13 (GMT)
commitaee4953df4779e2848ed25649c4485052a02a02d (patch)
tree5adebabb5b6bf0e7ea5d7c0a8932e1c6c65967bc
parent35674b225a3d6fd2a8fde5156456d6ec3831ff57 (diff)
downloadttf2f-aee4953df4779e2848ed25649c4485052a02a02d.tar.gz
ttf2f-aee4953df4779e2848ed25649c4485052a02a02d.tar.bz2
Hack for space character with no path.
svn path=/trunk/tools/ttf2f/; revision=7480
-rw-r--r--src/outlines.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/outlines.c b/src/outlines.c
index 2a32eb5..f66d10d 100644
--- a/src/outlines.c
+++ b/src/outlines.c
@@ -1,3 +1,4 @@
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -265,8 +266,8 @@ ttf2f_result append_glyph(struct glyph *g, size_t idx, ttf2f_ctx *ctx,
ttf2f_poll(1);
- /* no path => skip character */
- if (g->ttf_pathlen == 0) {
+ /* no path => skip character unless space */
+ if (g->ttf_pathlen == 0 && g->code != 0x0020) {
(*chunk)->offset[idx] = 0;
return TTF2F_RESULT_OK;
}
@@ -294,6 +295,25 @@ ttf2f_result append_glyph(struct glyph *g, size_t idx, ttf2f_ctx *ctx,
(((g->xMax - g->xMin) >> 8) & 0xF);
character->xsys[2] = ((g->yMax - g->yMin) >> 4) & 0xFF;
+ /* Nasty hack for space character */
+ if (g->ttf_pathlen == 0) {
+ assert(g->code == 0x0020);
+
+ temp = realloc((*chunk), (*chunk_size) + 1);
+ if (temp == NULL)
+ return TTF2F_RESULT_NOMEM;
+ (*chunk) = temp;
+
+ outline = (char *) (*chunk) + (*chunk_size);
+
+ (*chunk_size) += 1;
+
+ /* Just terminate path */
+ (*outline) = 0;
+
+ return TTF2F_RESULT_OK;
+ }
+
/* decompose glyph path */
glpath(ctx, g - ctx->glyphs);