包含 Unicode 字符(跨越两个字节)的 PDF 注释未在 firefox 中显示,但在 chrome 中工作正常
PDF Annotation containing Unicode characters(spanning two bytes) are not showing in firefox but working fine in chrome
使用 arial unicode 在 Annotation appearance 流中设置 unicode 字符可以在 chrome 中正确显示字符,但在 firefox 中不能。对此有什么想法吗?注释外观流如下。例如,显示一个刻度符号。
BT /F3 34 Tf 1.0 0.0 0.0 rg 107.44528 635.27405 Td [
<FEFF27132713>
] TJ ET
很可能您的内容流无效。
如果我没理解错的话,您想通过在 PDF 内容流中添加 Unicode BOM 前缀来控制文本显示指令的字符串参数的编码。这不起作用:
A string operand of a text-showing operator shall be interpreted as a sequence of character codes identifying the glyphs to be painted.
With a simple font, each byte of the string shall be treated as a separate character code. The character code shall then be looked up in the font’s encoding to select the glyph, as described in 9.6.5, "Character encoding".
With a composite font (PDF 1.2), multiple-byte codes may be used to select glyphs. In this instance, one or more consecutive bytes of the string shall be treated as a single character code. The code lengths and the mappings from codes to glyphs are defined in a data structure called a CMap, described in 9.7, "Composite fonts".
(ISO 32000-2,第 9.4.3 节“文本显示运算符”)
因此,对于您的示例,F3 字体
- 要么是一种带有一些单字节编码的简单字体,而您的
<FEFF27132713>
字符串包含 6 个单独的字符代码,如果有的话,每个字符代码本身代表一个字形,
- or 是一种可能具有多字节编码的复合字体,并且您的
<FEFF27132713>
字符串最多包含 6 个单独的字符代码,如果有的话,每个字符代码本身代表一个字形。
在任何一种情况下,您的字符串的解释都取决于相关字体对象定义的固定编码,您不能通过某些 BOM 前缀来操纵它。
使用 arial unicode 在 Annotation appearance 流中设置 unicode 字符可以在 chrome 中正确显示字符,但在 firefox 中不能。对此有什么想法吗?注释外观流如下。例如,显示一个刻度符号。
BT /F3 34 Tf 1.0 0.0 0.0 rg 107.44528 635.27405 Td [
<FEFF27132713>
] TJ ET
很可能您的内容流无效。
如果我没理解错的话,您想通过在 PDF 内容流中添加 Unicode BOM 前缀来控制文本显示指令的字符串参数的编码。这不起作用:
A string operand of a text-showing operator shall be interpreted as a sequence of character codes identifying the glyphs to be painted.
With a simple font, each byte of the string shall be treated as a separate character code. The character code shall then be looked up in the font’s encoding to select the glyph, as described in 9.6.5, "Character encoding".
With a composite font (PDF 1.2), multiple-byte codes may be used to select glyphs. In this instance, one or more consecutive bytes of the string shall be treated as a single character code. The code lengths and the mappings from codes to glyphs are defined in a data structure called a CMap, described in 9.7, "Composite fonts".
(ISO 32000-2,第 9.4.3 节“文本显示运算符”)
因此,对于您的示例,F3 字体
- 要么是一种带有一些单字节编码的简单字体,而您的
<FEFF27132713>
字符串包含 6 个单独的字符代码,如果有的话,每个字符代码本身代表一个字形, - or 是一种可能具有多字节编码的复合字体,并且您的
<FEFF27132713>
字符串最多包含 6 个单独的字符代码,如果有的话,每个字符代码本身代表一个字形。
在任何一种情况下,您的字符串的解释都取决于相关字体对象定义的固定编码,您不能通过某些 BOM 前缀来操纵它。