split_text_to_size

jsPDF split_text_to_size 插件

Source:

Methods

(inner) getCharWidthsArray(text, options) → {Array}

Source:

返回一个与 'word' 字符串长度匹配的数组,每个单元格包含该位置字符的宽度。

参数:
Name Type Description
text string
options Object
Returns:
Type
Array

(inner) getStringUnitWidth(text, options) → {number}

Source:

返回给定字体中字符串的宽度,如果字体大小设置为 1 点。

换句话说,这是 "proportional" 值。对于 1 个单位字体大小,字符串的长度将是那么多。

乘以字体大小以获得实际宽度(以点为单位)

然后除以 72 以获得英寸,或除以 (72/25.6) 以获得 'mm' 等。

参数:
Name Type Description
text string
options string
Returns:

result

Type
number

(inner) splitTextToSize(text, size, options) → {Array}

Source:

将给定字符串拆分为字符串数组。使用 'size' 值(以 jsPDF 实例声明的默认测量单位为单位)和字体 的 "widths" 和 "Kerning" 表,如果可用,确定给定字符串的显示长度。

当宽度表或默认宽度不可用时,我们使用字符的 100% 单位大小(高度)作为宽度。

Parameters:
Name Type Description
text string

未编码的常规 JavaScript(Unicode、UTF-16 / UCS-2)字符串。

size number

名义数字,以 jsPDF 实例声明的默认测量单位为单位。

options Object

可选标志,用于 chopper 执行正确操作。

Returns:

array 包含拆分字符串的数组。

Type
Array