Merge 66254512b9
into 6020386bbe
This commit is contained in:
commit
749b8bf737
|
@ -146,12 +146,11 @@ export class CanvasRenderer extends Renderer {
|
|||
|
||||
renderTextWithLetterSpacing(text: TextBounds, letterSpacing: number, baseline: number): void {
|
||||
if (letterSpacing === 0) {
|
||||
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + baseline);
|
||||
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height - baseline);
|
||||
} else {
|
||||
const letters = segmentGraphemes(text.text);
|
||||
letters.reduce((left, letter) => {
|
||||
this.ctx.fillText(letter, left, text.bounds.top + baseline);
|
||||
|
||||
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height - baseline);
|
||||
return left + this.ctx.measureText(letter).width;
|
||||
}, text.bounds.left);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue