From a2974b2f581301871f4793606f29e848de6e5a6a Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Thu, 30 Jun 2011 03:01:46 +0200 Subject: [PATCH] Map .notdef in order to attach the [missing|break]Char to it --- fonts.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fonts.js b/fonts.js index f023419bb..1aee442c6 100644 --- a/fonts.js +++ b/fonts.js @@ -417,6 +417,7 @@ var Font = (function () { }; function createCMapTable(glyphs) { + glyphs.push({ unicode: 0x0000 }); var ranges = getRanges(glyphs); var headerSize = (12 * 2 + (ranges.length * 4 * 2)); @@ -450,7 +451,7 @@ var Font = (function () { var range = ranges[i]; var start = range[0]; var end = range[1]; - var delta = (((start - 1) - bias) ^ 0xffff) + 1; + var delta = (((start - 1) - bias) ^ 0xffff); bias += (end - start + 1); startCount += string16(start); @@ -479,7 +480,6 @@ var Font = (function () { var charset = properties.charset; if (charset && charset.length) { - log(charset); for (var i = 1; i < charset.length; i++) { var position = getUnicodeRangeFor(GlyphsUnicode[charset[i]]); if (position < 32) { @@ -530,10 +530,8 @@ var Font = (function () { "\x00\x00\x00\x00" + // ulCodePageRange2 (Bits 32-63) string16(properties.xHeight) + // sxHeight string16(properties.capHeight) + // sCapHeight - // XXX mapping .notdef in the cmap table will allow us to use it - // here instead, especially because these field are limit to 0xFFFF - string16(properties.firstChar) + // usDefaultChar - string16(properties.firstChar) + // usBreakChar + string16(0) + // usDefaultChar + string16(0) + // usBreakChar "\x00\x00"; // usMaxContext };