(#840) fix font stretching and overlapping characters encoding
This commit is contained in:
parent
b958fd41d8
commit
bb6e5c6e00
@ -575,7 +575,7 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
ctx.scale(1, -1);
|
ctx.scale(1, -1);
|
||||||
ctx.translate(current.x, -1 * current.y);
|
ctx.translate(current.x, -1 * current.y);
|
||||||
ctx.transform.apply(ctx, fontMatrix);
|
ctx.transform.apply(ctx, fontMatrix);
|
||||||
ctx.scale(1 / textHScale, 1);
|
ctx.scale(textHScale, 1);
|
||||||
},
|
},
|
||||||
getTextGeometry: function canvasGetTextGeometry() {
|
getTextGeometry: function canvasGetTextGeometry() {
|
||||||
var geometry = {};
|
var geometry = {};
|
||||||
@ -651,7 +651,7 @@ var CanvasGraphics = (function canvasGraphics() {
|
|||||||
ctx.transform.apply(ctx, current.textMatrix);
|
ctx.transform.apply(ctx, current.textMatrix);
|
||||||
ctx.translate(current.x, current.y);
|
ctx.translate(current.x, current.y);
|
||||||
|
|
||||||
ctx.scale(1 / textHScale, 1);
|
ctx.scale(textHScale, 1);
|
||||||
for (var i = 0; i < glyphsLength; ++i) {
|
for (var i = 0; i < glyphsLength; ++i) {
|
||||||
|
|
||||||
var glyph = glyphs[i];
|
var glyph = glyphs[i];
|
||||||
|
@ -1705,11 +1705,19 @@ var Font = (function Font() {
|
|||||||
|
|
||||||
var cidToGidMap = properties.cidToGidMap || [];
|
var cidToGidMap = properties.cidToGidMap || [];
|
||||||
var gidToCidMap = [0];
|
var gidToCidMap = [0];
|
||||||
|
if (cidToGidMap.length > 0) {
|
||||||
for (var j = cidToGidMap.length - 1; j >= 0; j--) {
|
for (var j = cidToGidMap.length - 1; j >= 0; j--) {
|
||||||
var gid = cidToGidMap[j];
|
var gid = cidToGidMap[j];
|
||||||
if (gid)
|
if (gid)
|
||||||
gidToCidMap[gid] = j;
|
gidToCidMap[gid] = j;
|
||||||
}
|
}
|
||||||
|
// filling the gaps using CID above the CIDs currently used in font
|
||||||
|
var nextCid = cidToGidMap.length;
|
||||||
|
for (var i = 1; i < numGlyphs; i++) {
|
||||||
|
if (!gidToCidMap[i])
|
||||||
|
gidToCidMap[i] = nextCid++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var glyphs = [], ids = [];
|
var glyphs = [], ids = [];
|
||||||
var usedUnicodes = [];
|
var usedUnicodes = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user