summaryrefslogtreecommitdiff
path: root/src/cairo-truetype-subset.c
diff options
context:
space:
mode:
authormh0310.choi <mh0310.choi@samsung.com>2015-07-28 10:46:57 +0900
committermh0310.choi <mh0310.choi@samsung.com>2015-07-28 13:08:12 +0900
commit5e67a6f721eaedda61300baf0799199c7771ebd0 (patch)
tree6cd50b52498aab50e79b966cdccc2a137db316d9 /src/cairo-truetype-subset.c
parentd3aeffba37161d2b76b29c4ea13369bd67a47a8e (diff)
downloadcairo-5e67a6f721eaedda61300baf0799199c7771ebd0.tar.gz
cairo-5e67a6f721eaedda61300baf0799199c7771ebd0.tar.bz2
cairo-5e67a6f721eaedda61300baf0799199c7771ebd0.zip
- from 1.12.14 to 1.14.2 Change-Id: I3b62d212041b337bbb926d579f9ce74f42a45c3b
Diffstat (limited to 'src/cairo-truetype-subset.c')
-rw-r--r--[-rwxr-xr-x]src/cairo-truetype-subset.c37
1 files changed, 4 insertions, 33 deletions
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 44d7f60f5..fa33d63e4 100755..100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -1572,40 +1572,11 @@ _cairo_truetype_read_font_name (cairo_scaled_font_t *scaled_font,
goto fail;
}
- free (name);
+ status = _cairo_escape_ps_name (&ps_name);
+ if (unlikely(status))
+ goto fail;
- /* Ensure PS name is a valid PDF/PS name object. In PDF names are
- * treated as UTF8 and non ASCII bytes, ' ', and '#' are encoded
- * as '#' followed by 2 hex digits that encode the byte. By also
- * encoding the characters in the reserved string we ensure the
- * name is also PS compatible. */
- if (ps_name) {
- static const char *reserved = "()<>[]{}/%#\\";
- char buf[128]; /* max name length is 127 bytes */
- char *src = ps_name;
- char *dst = buf;
-
- while (*src && dst < buf + 127) {
- unsigned char c = *src;
- if (c < 0x21 || c > 0x7e || strchr (reserved, c)) {
- if (dst + 4 > buf + 127)
- break;
-
- snprintf (dst, 4, "#%02X", c);
- src++;
- dst += 3;
- } else {
- *dst++ = *src++;
- }
- }
- *dst = 0;
- free (ps_name);
- ps_name = strdup (buf);
- if (ps_name == NULL) {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
- goto fail;
- }
- }
+ free (name);
*ps_name_out = ps_name;
*font_name_out = family_name;