summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2012-04-06 09:43:53 +0930
committerAdrian Johnson <ajohnson@redneon.com>2012-04-06 09:45:56 +0930
commit8886220b5027296f5b3b95e9c2f93509108d3b9e (patch)
tree98d233b9ca96dc109a0c593f912d79cf7bd02bef
parenta6d955fcc46ae2da8d6f3b2cadeae64c03066461 (diff)
type1-subset: if font name is prefixed with a subset tag, strip it off
-rw-r--r--src/cairo-type1-subset.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index ddef8aeca..e507abeae 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -381,6 +381,7 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
{
const char *start, *end, *segment_end;
char *s;
+ int i;
segment_end = font->header_segment + font->header_segment_size;
start = find_token (font->header_segment, segment_end, "/FontName");
@@ -406,6 +407,16 @@ cairo_type1_font_subset_get_fontname (cairo_type1_font_subset_t *font)
return CAIRO_INT_STATUS_UNSUPPORTED;
}
+ /* If font name is prefixed with a subset tag, strip it off. */
+ if (strlen(start) > 7 && start[6] == '+') {
+ for (i = 0; i < 6; i++) {
+ if (start[i] < 'A' || start[i] > 'Z')
+ break;
+ }
+ if (i == 6)
+ start += 7;
+ }
+
font->base.base_font = strdup (start);
free (s);
if (unlikely (font->base.base_font == NULL))