source-code-pro icon indicating copy to clipboard operation
source-code-pro copied to clipboard

LibreOffice doesn’t recognize font name in OTF file

Open yrogge opened this issue 4 years ago • 9 comments

I’m using LibreOffice 7.0.3 with SourceCodePro v.2.030 (v.1.050 for italics) on Linux system (Ubuntu 20.10). When OTF fonts are installed, everything is perfect (LaTeX and other documents producing software), but LibreOffice export tool to PDF. When I look to fonts used in PDF file, all SourceCodePro fonts are indicated as “DummyName” font. If I install the TTF version of the same fonts, LibreOffice does export the font name correctly. Strange, isn’t it? I’m using static version, because variable fonts cannot be used when creating PDF documents.

yrogge avatar Nov 09 '20 09:11 yrogge

Thanks for this observation! I don’t have the same setup so I can’t reproduce this exactly, but my thinking is that his may have to do with LibreOffice’s PDF export library. Is it possible to choose another way to export the PDF?

BTW – if the PDF file works and fonts are embedded correctly, the font name embedded within the PDF does not really matter in terms of functionality. Also: TTF and OTF variants of Source Code Pro are equivalent in their functionality, so if one format works better than the other you are free to choose without drawbacks.

frankrolf avatar Nov 13 '20 10:11 frankrolf

Same results when tested on LibreOffice v7.0.3.1 (x64) on Windows 10. The TTF versions installed with LO (v2.030/v1.050) work fine. The OTF versions (v2.030/v1.050) export DummyName to the PDF. Tried with the new just-released versions (v2.032/v1.052). OTF versions (v2.032/v1.052) export DummyName to the PDF. TTF versions (v2.032/v1.052) work fine. The PostScript Name field looks fine in all the OTF and TTF fonts (the same). Quite odd.

So I selected some other OTF-PS fonts to test the export to PDF. Commercial and FOSS from different sources/vendors. Seven worked fine - Arno Pro Text, Avenir Next LT Pro, Bookmania, Helvetica Now Text, ITC Avant Garde, Public Sans, Vollkorn So I thought ... the issue is perhaps only in Source Code Pro, and then ... Adobe Minion 3 exported as DummyName.

So something is in these particular fonts that causes the LO PDF library an issue. Both are newer Adobe OpenType-PS font families ... relevant ? ? ? A mystery.

kenmcd avatar Nov 17 '20 20:11 kenmcd

Adobe Minion 3 exported as DummyName.

This is the relevant bit of information.

Based on this, I conclude that LibreOffice uses Macintosh font menu names for embedding OTF files to PDF. A while ago, we dropped Mac (OS 9-era) menu names from the name table, because they are encoded in Mac Roman, and therefore present challenges for keeping them in sync with the (Unicode-supporting) Windows menu names.

See here the difference between an old-school OTF (Tekton Pro) and a current OTF (Minion 3): (name table dumped with ttx -t name)

  <name>
    <namerecord nameID="0" platformID="1" platEncID="0" langID="0x0" unicode="True">
      © 1989, 1990, 1993, 1994, 1996, 1998, 1999, 2000 Adobe Systems Incorporated. All rights reserved.
    </namerecord>
    <namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Tekton Pro
    </namerecord>
    <namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Regular
    </namerecord>
    <namerecord nameID="3" platformID="1" platEncID="0" langID="0x0" unicode="True">
      2.073;ADBE;TektonPro-Regular;ADOBE
    </namerecord>
    <namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Tekton Pro
    </namerecord>
    <namerecord nameID="5" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Version 2.073;PS 2.000;hotconv 1.0.70;makeotf.lib2.5.5900
    </namerecord>
    <namerecord nameID="6" platformID="1" platEncID="0" langID="0x0" unicode="True">
      TektonPro-Regular
    </namerecord>
    <namerecord nameID="7" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Tekton is either a registered trademark or a trademark of Adobe Systems Incorporated in the United States and/or other countries.
    </namerecord>
    <namerecord nameID="9" platformID="1" platEncID="0" langID="0x0" unicode="True">
      David Siegel
    </namerecord>
    <namerecord nameID="11" platformID="1" platEncID="0" langID="0x0" unicode="True">
      http://www.adobe.com/type
    </namerecord>
    <namerecord nameID="14" platformID="1" platEncID="0" langID="0x0" unicode="True">
      http://www.adobe.com/type/legal.html
    </namerecord>
    <namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
      © 1989, 1990, 1993, 1994, 1996, 1998, 1999, 2000 Adobe Systems Incorporated. All rights reserved.
    </namerecord>
    <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
      Tekton Pro
    </namerecord>
    <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
      Regular
    </namerecord>
    <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
      2.073;ADBE;TektonPro-Regular;ADOBE
    </namerecord>
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
      TektonPro-Regular
    </namerecord>
    <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
      Version 2.073;PS 2.000;hotconv 1.0.70;makeotf.lib2.5.5900
    </namerecord>
    <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
      TektonPro-Regular
    </namerecord>
    <namerecord nameID="7" platformID="3" platEncID="1" langID="0x409">
      Tekton is either a registered trademark or a trademark of Adobe Systems Incorporated in the United States and/or other countries.
    </namerecord>
    <namerecord nameID="8" platformID="3" platEncID="1" langID="0x409">
      Adobe Systems Incorporated
    </namerecord>
    <namerecord nameID="9" platformID="3" platEncID="1" langID="0x409">
      David Siegel
    </namerecord>
    <namerecord nameID="11" platformID="3" platEncID="1" langID="0x409">
      http://www.adobe.com/type
    </namerecord>
    <namerecord nameID="14" platformID="3" platEncID="1" langID="0x409">
      http://www.adobe.com/type/legal.html
    </namerecord>
  </name>

  <name>
    <namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Minion 3
    </namerecord>
    <namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Regular
    </namerecord>
    <namerecord nameID="3" platformID="1" platEncID="0" langID="0x0" unicode="True">
      1.021;ADBE;Minion3-Regular;ADOBE
    </namerecord>
    <namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Minion 3
    </namerecord>
    <namerecord nameID="5" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Version 1.021;hotconv 1.0.105;makeotfexe 2.5.65591
    </namerecord>
    <namerecord nameID="6" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Minion3-Regular
    </namerecord>
    <namerecord nameID="267" platformID="3" platEncID="1" langID="0x402">
      Кирилица: трапецовидни варианти
    </namerecord>
    <namerecord nameID="268" platformID="3" platEncID="1" langID="0x402">
      Кирилица: варианти за български
    </namerecord>
    <namerecord nameID="269" platformID="3" platEncID="1" langID="0x402">
      Кирилица: варианти за сръбски и македонски
    </namerecord>
    <namerecord nameID="270" platformID="3" platEncID="1" langID="0x402">
      варианти за МФА
    </namerecord>
    <namerecord nameID="265" platformID="3" platEncID="1" langID="0x408">
      Ελληνικά: κάθετη έμφαση
    </namerecord>
    <namerecord nameID="266" platformID="3" platEncID="1" langID="0x408">
      Ελληνικά: Εναλλακτικά υπογεγραμμένης
    </namerecord>
    <namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
      © 1990-2018 Adobe. All rights reserved.
    </namerecord>
    <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
      Minion 3
    </namerecord>
    <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
      Regular
    </namerecord>
    <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
      1.021;ADBE;Minion3-Regular;ADOBE
    </namerecord>
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
      Minion 3
    </namerecord>
    <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
      Version 1.021;hotconv 1.0.105;makeotfexe 2.5.65591
    </namerecord>
    <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
      Minion3-Regular
    </namerecord>
    <namerecord nameID="7" platformID="3" platEncID="1" langID="0x409">
      Minion is either a registered trademark or a trademark of Adobe in the United States and/or other countries.
    </namerecord>
    <namerecord nameID="8" platformID="3" platEncID="1" langID="0x409">
      Adobe
    </namerecord>
    <namerecord nameID="9" platformID="3" platEncID="1" langID="0x409">
      Robert Slimbach
    </namerecord>
    <namerecord nameID="11" platformID="3" platEncID="1" langID="0x409">
      http://www.adobe.com/type
    </namerecord>
    <namerecord nameID="14" platformID="3" platEncID="1" langID="0x409">
      http://www.adobe.com/type/legal.html
    </namerecord>
    <namerecord nameID="256" platformID="3" platEncID="1" langID="0x409">
      Alternate form of Ŋ (U+014A)
    </namerecord>
    <namerecord nameID="257" platformID="3" platEncID="1" langID="0x409">
      Alternate form of Ɓ (U+0181)
    </namerecord>
    <namerecord nameID="258" platformID="3" platEncID="1" langID="0x409">
      Alternate form of Ɲ (U+019D)
    </namerecord>
    <namerecord nameID="259" platformID="3" platEncID="1" langID="0x409">
      Alternate form of ƥ (U+01A5)
    </namerecord>
    <namerecord nameID="260" platformID="3" platEncID="1" langID="0x409">
      Alternate form of Ʃ (U+01A9)
    </namerecord>
    <namerecord nameID="261" platformID="3" platEncID="1" langID="0x409">
      Alternate form of ɑ (U+0251)
    </namerecord>
    <namerecord nameID="262" platformID="3" platEncID="1" langID="0x409">
      Alternate form of Ɑ (U+2C6D)
    </namerecord>
    <namerecord nameID="263" platformID="3" platEncID="1" langID="0x409">
      Alternate form of թ (U+0569)
    </namerecord>
    <namerecord nameID="264" platformID="3" platEncID="1" langID="0x409">
      Alternate form of k (U+006B)
    </namerecord>
    <namerecord nameID="265" platformID="3" platEncID="1" langID="0x409">
      Greek: vertical stress
    </namerecord>
    <namerecord nameID="266" platformID="3" platEncID="1" langID="0x409">
      Greek: subscript alternates
    </namerecord>
    <namerecord nameID="267" platformID="3" platEncID="1" langID="0x409">
      Cyrillic: trapezoid variants
    </namerecord>
    <namerecord nameID="268" platformID="3" platEncID="1" langID="0x409">
      Cyrillic: Bulgarian alternates
    </namerecord>
    <namerecord nameID="269" platformID="3" platEncID="1" langID="0x409">
      Cyrillic: Serbian and Macedonian alternates
    </namerecord>
    <namerecord nameID="270" platformID="3" platEncID="1" langID="0x409">
      IPA alternates
    </namerecord>
    <namerecord nameID="271" platformID="3" platEncID="1" langID="0x409">
      Arrow alternates A
    </namerecord>
    <namerecord nameID="272" platformID="3" platEncID="1" langID="0x409">
      Arrow alternates B
    </namerecord>
    <namerecord nameID="273" platformID="3" platEncID="1" langID="0x409">
      Regular
    </namerecord>
    <namerecord nameID="267" platformID="3" platEncID="1" langID="0x419">
      Кириллица: трапециевидные варианты
    </namerecord>
    <namerecord nameID="268" platformID="3" platEncID="1" langID="0x419">
      Кириллица: варианты для болгарского
    </namerecord>
    <namerecord nameID="269" platformID="3" platEncID="1" langID="0x419">
      Кириллица: варианты для сербского и македонского
    </namerecord>
    <namerecord nameID="270" platformID="3" platEncID="1" langID="0x419">
      варианты для МФА
    </namerecord>
    <namerecord nameID="267" platformID="3" platEncID="1" langID="0x42f">
      Кирилица: трапезоидни варијанти
    </namerecord>
    <namerecord nameID="268" platformID="3" platEncID="1" langID="0x42f">
      Кирилица: опции за бугарски
    </namerecord>
    <namerecord nameID="269" platformID="3" platEncID="1" langID="0x42f">
      Кирилица: опции за српски и македонски
    </namerecord>
    <namerecord nameID="270" platformID="3" platEncID="1" langID="0x42f">
      опции за МФА
    </namerecord>
    <namerecord nameID="267" platformID="3" platEncID="1" langID="0xc1a">
      Ћирилица: трапезне варијанте
    </namerecord>
    <namerecord nameID="268" platformID="3" platEncID="1" langID="0xc1a">
      Ћирилица: опције за бугарски
    </namerecord>
    <namerecord nameID="269" platformID="3" platEncID="1" langID="0xc1a">
      Ћирилица: опције за српски и македонски
    </namerecord>
    <namerecord nameID="270" platformID="3" platEncID="1" langID="0xc1a">
      опције за МФА
    </namerecord>
  </name>

You’ll see that all the entries are duplicated in Tekton, once as Mac variant (platformID="1") and once as Windows variant (platformID="3")

You’ll also see that in the name table dump of Minion 3 how MacRoman encoding might represent a problem in keeping all entries in sync.

As far as I know, macOS itself does not rely on the Mac-specific name table entries. It would be good to bring up this issue with LibreOffice – they seem to know how to reference the Windows menu names, judging by the properly-embedded TTF fonts.

frankrolf avatar Nov 17 '20 21:11 frankrolf

I don't understand. The name tables are identical in SourceCodePro-Regular .otf and .ttf files. Both have only platformID="3" . And the .otf does not work and .ttf works fine. Minion3-Regular .otf has both platformID="1"and platformID="3" and does not work. MinionPro-Regular .otf has both platformID="1"and platformID="3" and works fine. So I do not understand your point, or something else is going on.

I have tested over 150+ fonts families in LibreOffice for Windows to find out what works, and what does not work, and why. Generally with font selection issues the problem is the style groups are wrong. Fix the names and the fonts then work properly. Generally wrong fonts in the Export to PDF the problem is the PostScript Name field is wrong. Fix the PostScript Name to the recommended format and the fonts work properly. Like service bureaus the various PDF libraries appear to use the PostScript Name for font ID.

So that is why this issue has me intrigued. Unlike many fonts I tested, these fonts are built by experts. I doubt the issue is the fonts, but I do want to know the common thread in these few fonts.

Searched for "DummyName" with various other font and PDF related terms - found nothing.

Hmmm ... just did Export to PDF from Affinity Publisher to test. And Minion3-Regular is listed correctly in the PDF fonts.

Ugh, I really do not want to get back into the LO bug tracker pit of despair. Time to punt. ;-)

@yrogge This appears to be a LibreOffice issue. So you should post it in the LO bug tracker here: https://bugs.documentfoundation.org/

kenmcd avatar Nov 18 '20 18:11 kenmcd

I have a feeling that LO may use one route for embedding TTFs, another for OTFs. One of the few things that Minion3 and these fonts have in common is the general omission of Macintosh names in the name table.

frankrolf avatar Nov 18 '20 22:11 frankrolf

For reference, OP opened an issue for LibreOffice: https://bugs.documentfoundation.org/show_bug.cgi?id=138325

jefferyto avatar Jun 22 '22 06:06 jefferyto

Thanks for submitting the bug upstream!

fitojb avatar Jun 25 '22 16:06 fitojb

This issue is now fixed in LibreOffice.

(LibreOffice was trying to get the font name from the CFF table but couldn’t find either FontName or FullName. It now reads the name from name table unconditionally).

khaledhosny avatar Dec 12 '22 10:12 khaledhosny

Thank you! This reminds me of comparefamily.py: https://github.com/adobe-type-tools/afdko/blob/develop/python/afdko/comparefamily.py#L1578-L1592

frankrolf avatar Dec 12 '22 13:12 frankrolf