Skip to content
Browse files

Format 4 cmap are incorrects and are rejected by browser's font sanit…

…izer
  • Loading branch information...
1 parent 513fef7 commit 65fdd2f4e86e4e7148ed155b0026874b1bf81988 @vingtetun committed Oct 20, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/font/tables/cmap.coffee
View
8 lib/font/tables/cmap.coffee
@@ -134,8 +134,8 @@ class CmapEntry
segCount = startCodes.length
segCountX2 = segCount * 2
- searchRange = 2 * Math.pow(Math.log(segCount) / Math.LN2, 2)
- entrySelector = Math.log(searchRange / 2) / Math.LN2
+ searchRange = 2 * Math.pow(2, Math.floor(Math.log(segCount) / Math.LN2))
+ entrySelector = Math.log(segCount) / Math.LN2
rangeShift = 2 * segCount - searchRange
deltas = []
@@ -146,7 +146,7 @@ class CmapEntry
endCode = endCodes[i]
if startCode is 0xFFFF
- deltas.push 0
+ deltas.push 1
rangeOffsets.push 0
break
@@ -186,4 +186,4 @@ class CmapEntry
subtable: subtable.data
maxGlyphID: nextID + 1
-module.exports = CmapTable
+module.exports = CmapTable

0 comments on commit 65fdd2f

Please sign in to comment.
Something went wrong with that request. Please try again.