mirror of
https://github.com/foliojs/pdfkit.git
synced 2025-12-08 20:15:54 +00:00
Fix word spacing
We were mutating a cached position object. Fixes #687.
This commit is contained in:
parent
e4bb772409
commit
5ae153490d
@ -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)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user