Skip to content

Commit 9ddbe1f

Browse files
committed
Merge pull request mozilla#1947 from yurydelendik/issue-1944
Fix loading of the font widths
2 parents 37db58e + 3c4efb2 commit 9ddbe1f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/canvas.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ var CanvasExtraState = (function CanvasExtraStateClosure() {
157157
this.wordSpacing = 0;
158158
this.textHScale = 1;
159159
this.textRenderingMode = TextRenderingMode.FILL;
160+
this.textRise = 0;
160161
// Color spaces
161162
this.fillColorSpace = new DeviceGrayCS();
162163
this.fillColorSpaceObj = null;
@@ -601,7 +602,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
601602
this.current.textRenderingMode = mode;
602603
},
603604
setTextRise: function CanvasGraphics_setTextRise(rise) {
604-
TODO('text rise: ' + rise);
605+
this.current.textRise = rise;
605606
},
606607
moveText: function CanvasGraphics_moveText(x, y) {
607608
this.current.x = this.current.lineX += x;
@@ -628,7 +629,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
628629

629630
ctx.transform.apply(ctx, current.textMatrix);
630631
ctx.scale(1, -1);
631-
ctx.translate(current.x, -1 * current.y);
632+
ctx.translate(current.x, -current.y - current.textRise);
632633
ctx.transform.apply(ctx, fontMatrix);
633634
ctx.scale(textHScale, 1);
634635
},

src/evaluator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
765765
if (widths) {
766766
var start = 0, end = 0;
767767
for (var i = 0, ii = widths.length; i < ii; i++) {
768-
var code = widths[i];
768+
var code = xref.fetchIfRef(widths[i]);
769769
if (isArray(code)) {
770770
for (var j = 0, jj = code.length; j < jj; j++)
771771
glyphsWidths[start++] = code[j];

0 commit comments

Comments
 (0)