Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes spacing in the text layer builder #4633

Merged
merged 1 commit into from
Apr 16, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/core/evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
for (var i = 0; i < glyphs.length; i++) {
var glyph = glyphs[i];
if (!glyph) { // Previous glyph was a space.
width += textState.wordSpacing * textState.textHScale;
continue;
}
var vMetricX = null;
Expand Down Expand Up @@ -870,10 +871,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
args[4], args[5]);
break;
case OPS.setCharSpacing:
textState.charSpace = args[0];
textState.charSpacing = args[0];
break;
case OPS.setWordSpacing:
textState.wordSpace = args[0];
textState.wordSpacing = args[0];
break;
case OPS.beginText:
textState.textMatrix = IDENTITY_MATRIX.slice();
Expand All @@ -889,11 +890,12 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
} else {
var val = items[j] / 1000;
if (!textState.font.vertical) {
offset = -val * textState.fontSize * textState.textHScale;
offset = -val * textState.fontSize * textState.textHScale *
textState.textMatrix[0];
textState.translateTextMatrix(offset, 0);
textChunk.width += offset;
} else {
offset = -val * textState.fontSize;
offset = -val * textState.fontSize * textState.textMatrix[3];
textState.translateTextMatrix(0, offset);
textChunk.height += offset;
}
Expand Down