1

PDFMake 声明可以 在构建时为客户端工作嵌入自定义字体。

但是,文档没有提及支持哪些字体文件类型。

例如:

pdfMake.fonts = {
    Roboto: {
        normal: 'Roboto-Light-Latin.woff2',
        bold: 'Roboto-Regular-Latin.woff2'
    },
}

当我在我的构建过程中嵌入 woff2 文件时vfs_fonts.js,我得到了Uncaught RangeError: "value" argument is out of bounds. 如果我使用 TTF 字体版本,则不会发生这种情况。

Uncaught RangeError: "value" argument is out of bounds
    at checkInt (pdfmake.js:2298)
    at Uint8Array.writeUInt16BE (pdfmake.js:2373)
    at EncodeStream.<computed> [as writeUInt16BE] (pdfmake.js:51031)
    at NumberT.encode (pdfmake.js:6232)
    at ArrayT.encode (pdfmake.js:15995)
    at VersionedStruct.encode (pdfmake.js:54300)
    at Struct.encode (pdfmake.js:16134)
    at TTFSubset.encode (pdfmake.js:49346)
    at pdfmake.js:49039
    at Item.run (pdfmake.js:4314)

是不是我的配置/字体文件有问题,还是 PDFMake 不支持 woff2?

4

0 回答 0