Fix word spacing

We were mutating a cached position object. Fixes #687.
This commit is contained in:
Devon Govett 2017-07-01 18:30:58 -07:00
parent e4bb772409
commit 5ae153490d

View File

@ -252,7 +252,11 @@ module.exports =
positions.push positionsWord...
# add the word spacing to the end of the word
positions[positions.length - 1].xAdvance += wordSpacing
# clone object because of cache
space = {}
space[key] = val for key, val of positions[positions.length - 1]
space.xAdvance += wordSpacing
positions[positions.length - 1] = space
else
[encoded, positions] = @_font.encode(text, options.features)