Gitweb links: ...log http://git.netsurf-browser.org/ttf2f.git/shortlog/ee664df8218ff38d9d90dddecc0c20cd2857a4be ...commit http://git.netsurf-browser.org/ttf2f.git/commit/ee664df8218ff38d9d90dddecc0c20cd2857a4be ...tree http://git.netsurf-browser.org/ttf2f.git/tree/ee664df8218ff38d9d90dddecc0c20cd2857a4be
The branch, master has been updated via ee664df8218ff38d9d90dddecc0c20cd2857a4be (commit) from ec4f056527a065d95583f1c82b9d9975bd89bf2a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commitdiff http://git.netsurf-browser.org/ttf2f.git/commit/?id=ee664df8218ff38d9d90dddecc0c20cd2857a4be commit ee664df8218ff38d9d90dddecc0c20cd2857a4be Author: John-Mark Bell <j...@netsurf-browser.org> Commit: John-Mark Bell <j...@netsurf-browser.org> Fix Encoding file entries for astral characters. Early versions of the UCS Font Manager (3.41-3.42) supported the use of /uni followed by up to 8 upper-case hex digits to specify the Unicode codepoint represented by a glyph. Font Manager 3.43 changed this behaviour to align with Adobe's then-current specification of /uniXXXX for characters in the Basic Multilingual Plane and /uniXXXXYYYY for all other characters (where XXXX is a high UTF-16 surrogate and YYYY is a low surrogate) Font Manager 3.53 changed again to remove support for /uniXXXXYYYY and, instead, introduced support for /uXXXX to /uXXXXXXXX, where leading zeroes are forbidden if more than 4 hex digits are present. Change our behaviour to use the /uniXXXX form for characters in the Basic Multilingual Plane (which is supported by all versions of the UCS Font Manager) and use the /uXXXXX - /uXXXXXXXX form for all other characters. This effectively means that Font Manager 3.53 or later is required when astral characters are in use. diff --git a/src/encoding.c b/src/encoding.c index ae8767d..8f9671f 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -78,8 +78,15 @@ void encoding_write_glyph(int index, struct glyph *glyph, glyph->name); } } else if (glyph->code != (unsigned int) -1) { - fprintf(fp, "%4.4X;uni%04X;COMMENT\n", index, - glyph->code); + if (glyph->code < 0x10000) { + /* Use uniXXXX for BMP codepoints */ + fprintf(fp, "%4.4X;uni%04X;COMMENT\n", index, + glyph->code); + } else { + /* Use uXXXXX - uXXXXXXXX otherwise */ + fprintf(fp, "%4.4X;u%X;COMMENT\n", index, + glyph->code); + } } else { fprintf(fp, "# Skipping %4.4X\n", index); } @@ -87,11 +94,26 @@ void encoding_write_glyph(int index, struct glyph *glyph, if (glyph->name != 0) { fprintf(fp, "/%s\n", glyph->name); } else if (glyph->code != (unsigned int) -1) { - fprintf(fp, "/uni%4.4X\n", glyph->code); + if (glyph->code < 0x10000) { + /* Use /uniXXXX for BMP codepoints */ + fprintf(fp, "/uni%4.4X\n", glyph->code); + } else { + /* Use /uXXXXX - /uXXXXXXXX otherwise. + * These are supported since FM 3.53. + * FM 3.43 - 3.52 (inclusive) understood + * /uniXXXXYYYY, where XXXX and YYYY were + * a UTF-16 surrogate pair. We have never + * emitted such things and support for + * them was removed in FM 3.53 with the + * introduction of support for the /u form. + * Thus, take the easy option and rely on + * noone running a UCS FM earlier than 3.53 + * expecting astral codepoints to work. + */ + fprintf(fp, "/u%X\n", glyph->code); + } } else { fprintf(fp, "/.notdef\n"); } } } - - ----------------------------------------------------------------------- Summary of changes: src/encoding.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/encoding.c b/src/encoding.c index ae8767d..8f9671f 100644 --- a/src/encoding.c +++ b/src/encoding.c @@ -78,8 +78,15 @@ void encoding_write_glyph(int index, struct glyph *glyph, glyph->name); } } else if (glyph->code != (unsigned int) -1) { - fprintf(fp, "%4.4X;uni%04X;COMMENT\n", index, - glyph->code); + if (glyph->code < 0x10000) { + /* Use uniXXXX for BMP codepoints */ + fprintf(fp, "%4.4X;uni%04X;COMMENT\n", index, + glyph->code); + } else { + /* Use uXXXXX - uXXXXXXXX otherwise */ + fprintf(fp, "%4.4X;u%X;COMMENT\n", index, + glyph->code); + } } else { fprintf(fp, "# Skipping %4.4X\n", index); } @@ -87,11 +94,26 @@ void encoding_write_glyph(int index, struct glyph *glyph, if (glyph->name != 0) { fprintf(fp, "/%s\n", glyph->name); } else if (glyph->code != (unsigned int) -1) { - fprintf(fp, "/uni%4.4X\n", glyph->code); + if (glyph->code < 0x10000) { + /* Use /uniXXXX for BMP codepoints */ + fprintf(fp, "/uni%4.4X\n", glyph->code); + } else { + /* Use /uXXXXX - /uXXXXXXXX otherwise. + * These are supported since FM 3.53. + * FM 3.43 - 3.52 (inclusive) understood + * /uniXXXXYYYY, where XXXX and YYYY were + * a UTF-16 surrogate pair. We have never + * emitted such things and support for + * them was removed in FM 3.53 with the + * introduction of support for the /u form. + * Thus, take the easy option and rely on + * noone running a UCS FM earlier than 3.53 + * expecting astral codepoints to work. + */ + fprintf(fp, "/u%X\n", glyph->code); + } } else { fprintf(fp, "/.notdef\n"); } } } - - -- Truetype font to RISC OS font converter _______________________________________________ netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org