【问题标题】:Missing widths in Times-Roman font in PDFPDF中Times-Roman字体中缺少宽度
【发布时间】:2015-11-07 18:05:59
【问题描述】:

我有一个pdf,它在第 8 页的宽度为 0 的页面上包含一些字符,例如破折号和双引号。 它有 Times-Roman 字体。
我尝试使用 AFM 文件查找 Times-Roman 字体的宽度,但没有成功。
我怎样才能找到这些字符的宽度?

谢谢。

【问题讨论】:

    标签: ios pdf fonts


    【解决方案1】:

    Times Roman 是 标准 14 种字体之一。这些字体通常是 PDF 规范中有关所需数据的例外,例如

    Widths 数组(除了标准的 14 种字体之外是必需的;...

    (表 111 – Type 1 字体字典中的条目 - ISO 32000-1)

    关于这些字体的部分解释了从何处获取信息:

    14 种 Type 1 字体的 PostScript 名称,称为标准 14 种字体,如下所示:Times-Roman、Helvetica、Courier、Symbol、Times-Bold、Helvetica-Bold、Courier-粗体、ZapfDingbats、Times-Italic、HelveticaOblique、Courier-Oblique、Times-BoldItalic、Helvetica-BoldOblique、Courier-BoldOblique

    这些字体或其字体规格和合适的替代字体应可供符合标准的读者使用。

    注意这些字体的字符集和编码列在附录 D 中。标准 14 种字体的字体度量文件可从 ASN 网站获得(参见参考书目)。有关字体指标的更多信息,请参阅 Adob​​e 技术说明 #5004,Adobe Font Metrics 文件格式规范。

    (第 9.6.2.2 节 - 标准类型 1 字体(标准 14 种字体)-ISO 32000-1)

    点击 Adob​​e 网站后,看起来字体指标目前可在 ftp://ftp.adobe.com/pub/adobe/type/ 获得


    OP 在评论中澄清了他的问题:

    我已尝试使用 Adob​​e 的字体度量文件来获取宽度值 char \x93,\x94,\x96,\x97,\x98。然而,这些值不存在于 AFM 文件中。如何找到这些值的宽度?

    首先你必须查一下这些值的含义。

    您提到问题发生在第 8 页 并且字体为 Times-Roman。在第 8 页有 Times-Roman 字体 F28 和 F46,还有一个 Fimes-Bold 字体F43。其他字体是 Courier 和 CMSY10 (TeX Computer Modern Symbol?)。 F28、F43 和 F46 具有相同的编码条目:

    163 0 obj
    <</Differences
        [0/.notdef 1/dotaccent/fi/fl/fraction/hungarumlaut/Lslash/lslash/ogonek/ring 10/.notdef 11/breve/minus 13/.notdef 14/Zcaron/zcaron/caron/dotlessi/dotlessj/ff/ffi/ffl 22/.notdef 30/grave/quotesingle/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde 127/.notdef 130/quotesinglbase/florin/quotedblbase/ellipsis/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE 141/.notdef 147/quotedblleft/quotedblright/bullet/endash/emdash/tilde/trademark/scaron/guilsinglright/oe 157/.notdef 159/Ydieresis 160/.notdef 161/exclamdown/cent/sterling/currency/yen/brokenbar/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guillemotright/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]
      /Type/Encoding>>
    endobj 
    

    您正在寻找\x93,\x94,\x96,\x97,\x98,即(十进制)147、148、150、151、152。根据编码 上面,尤其是这个 Differences 部分:

    147/quotedblleft/quotedblright/bullet/endash/emdash/tilde
    

    表示 quotedblleft、quotedblright、endash、emdash 和 波浪号 .在字体度量文件中搜索这些名称会得到:

    C 170 ; WX 444 ; N quotedblleft ; B 43 433 414 676 ;
    C 186 ; WX 444 ; N quotedblright ; B 30 433 401 676 ;
    C 177 ; WX 500 ; N endash ; B 0 201 500 250 ;
    C 208 ; WX 1000 ; N emdash ; B 0 201 1000 250 ;
    C 196 ; WX 333 ; N tilde ; B 1 532 331 638 ;
    

    这里是你的角色的指标,尤其是宽度。

    【讨论】:

    • 我已经尝试过 Adob​​e 的字体公制文件来获取宽度值 char \x93,\x94,\x96,\x97,\x98。然而,这些值不存在于 AFM 文件中。如何找到这些值的宽度?
    • 我编辑了我的答案以包括查找这些字符宽度的方法。
    • 我没有在这个答案给出的 FTP 链接中找到相关的 AFM 文件。但多次谷歌搜索我终于在adobe.com/devnet/font.html 上找到了它们,靠近底部,“Font Metrics for PDF Core 14 Fonts”。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-27
    • 1970-01-01
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 2020-02-01
    • 1970-01-01
    相关资源
    最近更新 更多