This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 测量字符串长度 | |
export function measureText(pText: string, pFontSize: number) { | |
let lDiv = document.createElement('div'); | |
document.body.appendChild(lDiv); | |
lDiv.style.fontSize = '' + pFontSize + 'px'; | |
lDiv.style.position = 'absolute'; | |
lDiv.style.visibility = 'hidden'; | |
lDiv.innerHTML = pText; |