Skip to content

Commit

Permalink
Fix ligatures when letter-rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
eKoopmans committed Mar 27, 2017
1 parent e58fc69 commit a6a5e3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nodeparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,13 @@ NodeParser.prototype.paintFormValue = function(container) {
NodeParser.prototype.paintText = function(container) {
container.applyTextTransform();
var characters = punycode.ucs2.decode(container.node.data);
var textList = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function(character) {
var wordRendering = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data);
var textList = wordRendering ? getWords(characters) : characters.map(function(character) {
return punycode.ucs2.encode([character]);
});
if (!wordRendering) {
container.parent.node.style.fontVariantLigatures = 'none';
}

var weight = container.parent.fontWeight();
var size = container.parent.css('fontSize');
Expand Down
1 change: 1 addition & 0 deletions src/renderers/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ CanvasRenderer.prototype.shape = function(shape) {
};

CanvasRenderer.prototype.font = function(color, style, variant, weight, size, family) {
variant = /^(normal|small-caps)$/i.test(variant) ? variant : '';
this.setFillStyle(color).font = [style, variant, weight, size, family].join(" ").split(",")[0];
};

Expand Down

0 comments on commit a6a5e3a

Please sign in to comment.