Merge pull request #1947 from yurydelendik/issue-1944

Fix loading of the font widths
This commit is contained in:
Brendan Dahl 2012-08-02 11:54:58 -07:00
commit 9ddbe1fac7
2 changed files with 4 additions and 3 deletions

View File

@ -157,6 +157,7 @@ var CanvasExtraState = (function CanvasExtraStateClosure() {
this.wordSpacing = 0; this.wordSpacing = 0;
this.textHScale = 1; this.textHScale = 1;
this.textRenderingMode = TextRenderingMode.FILL; this.textRenderingMode = TextRenderingMode.FILL;
this.textRise = 0;
// Color spaces // Color spaces
this.fillColorSpace = new DeviceGrayCS(); this.fillColorSpace = new DeviceGrayCS();
this.fillColorSpaceObj = null; this.fillColorSpaceObj = null;
@ -601,7 +602,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.current.textRenderingMode = mode; this.current.textRenderingMode = mode;
}, },
setTextRise: function CanvasGraphics_setTextRise(rise) { setTextRise: function CanvasGraphics_setTextRise(rise) {
TODO('text rise: ' + rise); this.current.textRise = rise;
}, },
moveText: function CanvasGraphics_moveText(x, y) { moveText: function CanvasGraphics_moveText(x, y) {
this.current.x = this.current.lineX += x; this.current.x = this.current.lineX += x;
@ -628,7 +629,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
ctx.transform.apply(ctx, current.textMatrix); ctx.transform.apply(ctx, current.textMatrix);
ctx.scale(1, -1); ctx.scale(1, -1);
ctx.translate(current.x, -1 * current.y); ctx.translate(current.x, -current.y - current.textRise);
ctx.transform.apply(ctx, fontMatrix); ctx.transform.apply(ctx, fontMatrix);
ctx.scale(textHScale, 1); ctx.scale(textHScale, 1);
}, },

View File

@ -765,7 +765,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if (widths) { if (widths) {
var start = 0, end = 0; var start = 0, end = 0;
for (var i = 0, ii = widths.length; i < ii; i++) { for (var i = 0, ii = widths.length; i < ii; i++) {
var code = widths[i]; var code = xref.fetchIfRef(widths[i]);
if (isArray(code)) { if (isArray(code)) {
for (var j = 0, jj = code.length; j < jj; j++) for (var j = 0, jj = code.length; j < jj; j++)
glyphsWidths[start++] = code[j]; glyphsWidths[start++] = code[j];