mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Refactor Font.js
This commit is contained in:
parent
e8a4d775e8
commit
b239937e00
@ -63,9 +63,11 @@ export class FontMetrics {
|
|||||||
return {baseline, middle};
|
return {baseline, middle};
|
||||||
}
|
}
|
||||||
getMetrics(font: Font) {
|
getMetrics(font: Font) {
|
||||||
if (this._data[`${font.fontFamily} ${font.fontSize}`] === undefined) {
|
const key = `${font.fontFamily} ${font.fontSize}`;
|
||||||
this._data[`${font.fontFamily} ${font.fontSize}`] = this._parseMetrics(font);
|
if (this._data[key] === undefined) {
|
||||||
|
this._data[key] = this._parseMetrics(font);
|
||||||
}
|
}
|
||||||
return this._data[`${font.fontFamily} ${font.fontSize}`];
|
|
||||||
|
return this._data[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user