mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Set preserve spaces, and insert spaces on blank lines when exporting text from paint. This makes render show the right thing.
This commit is contained in:
parent
f69748fc06
commit
f6b8f8e309
1 changed files with 2 additions and 1 deletions
|
@ -265,6 +265,7 @@ new function() {
|
|||
var node = SvgElement.create('text', getTransform(item._matrix, false),
|
||||
formatter);
|
||||
node.setAttribute('font-size', item.fontSize);
|
||||
node.setAttribute('xml:space', 'preserve');
|
||||
for (var i = 0; i < item._lines.length; i++) {
|
||||
// Scratch-specific: Use <tspan> for multiline text,
|
||||
// right now only supports left justified (x=0)
|
||||
|
@ -272,7 +273,7 @@ new function() {
|
|||
x: '0',
|
||||
dy: i === 0 ? '0' : item.getLeading() + 'px'
|
||||
}, formatter);
|
||||
tspanNode.textContent = item._lines[i];
|
||||
tspanNode.textContent = item._lines[i] ? item._lines[i] : ' ';
|
||||
node.appendChild(tspanNode);
|
||||
}
|
||||
return node;
|
||||
|
|
Loading…
Reference in a new issue