Home > sculp-js > getStrWidthPx
getStrWidthPx() function
字符串的像素宽度
Signature:
typescript
export declare function getStrWidthPx(str: string, fontSize?: number, isRemove?: boolean): number;Parameters
Parameter | Type | Description |
|---|---|---|
str | string | 目标字符串 |
fontSize | number | (Optional) 字符串字体大小 |
isRemove | boolean | (Optional) 计算后是否移除创建的dom元素 |
Returns:
number
{*}