mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: adjust height (thanks @haztheo)
This commit is contained in:
parent
4dbd0da0ec
commit
ceb37b25c8
@ -146,11 +146,11 @@ export class CanvasRenderer extends Renderer {
|
|||||||
|
|
||||||
renderTextWithLetterSpacing(text: TextBounds, letterSpacing: number, baseline: number): void {
|
renderTextWithLetterSpacing(text: TextBounds, letterSpacing: number, baseline: number): void {
|
||||||
if (letterSpacing === 0) {
|
if (letterSpacing === 0) {
|
||||||
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top - text.bounds.height / 2 + baseline);
|
this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height - baseline);
|
||||||
} else {
|
} else {
|
||||||
const letters = segmentGraphemes(text.text);
|
const letters = segmentGraphemes(text.text);
|
||||||
letters.reduce((left, letter) => {
|
letters.reduce((left, letter) => {
|
||||||
this.ctx.fillText(letter, left, text.bounds.top - text.bounds.height / 2 + baseline);
|
this.ctx.fillText(letter, left, text.bounds.top + text.bounds.height - baseline);
|
||||||
|
|
||||||
return left + this.ctx.measureText(letter).width;
|
return left + this.ctx.measureText(letter).width;
|
||||||
}, text.bounds.left);
|
}, text.bounds.left);
|
||||||
|
Loading…
Reference in New Issue
Block a user