1

I downloaded a "Fredoka One" font here: https://fonts.google.com/specimen/Fredoka+One?selection.family=Fredoka+One

and installed the TTF file on my system (ie mv FredoakOne-Regular.ttf ~/.fonts/, and fc-cache -f -v).

$ fc-list | grep -i "fredoka"
/home/myUser/.fonts/FredokaOne-Regular.ttf: Fredoka One:style=Regular

and my SVG file references the Fredoka One font like so:

font-family="'FredokaOne-Regular'"

Thus, when I view the SVG file in a browser, it doesn't render the font.

But when I change my SVG file to reference the file like this instead:

font-family="'Fredoka One'"

Then the font renders properly. Why aren't the names matching? How did this happen? Am I missing something?

FYI I received the SVG files from a designer who created/exported them in Illustrator, using MacOS.


If I can somehow alias the name FredokaOne-Regular to point to my Fredoka One font name, would that be a reasonable solution? If so, how?

1 Answer 1

1

It seems that Adobe Illustrator uses the "PostScript name" field from within the font – not the more common "Family name" field. This seems to be common within macOS with its heavily PostScript-influenced graphics system and might make sense for e.g. PDF outputs, but is quite different from what everything else uses.

(Note: Both names are embedded inside the file and have nothing to do with the .ttf file name itself.)


If you want to create font aliases, you can do so through fontconfig. Create a file such as ~/.config/fontconfig/conf.d/50-aliases.conf with contents:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <alias binding="same">
        <family>FredokaOne-Regular</family>
        <prefer>
            <family>Fredoka One</family>
        </prefer>
    </alias>    
</fontconfig>

(The binding="same" option tells fontconfig that this is exactly the same font rather than a fallback alternative, but I honestly don't know what, if any, effect it has on the font selection.)


You seem to be confusing family names and file names.

In this case, "FredokaOne-Regular" is not the family name. It is merely the file name, and almost no software actually cares about the file name. It could as well be named "Fredoka~1.ttf" or "FREDOK1R.TTF" or "H234567.TTF" (as font files often are) and that still wouldn't affect a thing.

Instead, software almost always expects you to specify the name that is embedded inside the file itself. As fontconfig's fc-cache (or fc-query) shows, the embedded family name is "Fredoka One", so that's what you're supposed to specify.

(Note how even Google's webfont CSS, which imports randomly-named files such as "k3kUo8kEI-tA1RRcTZGmTlHGCac.woff2" from the CDN, also specifies "Fredoka One" as the family name.)

5
  • Thanks for the answer! Just to clarify, was this an error in the SVG, which listed font-family="'FredokaOne-Regular'"? I'm not sure how the SVG was generated, but is it fair to say that it was incorrectly generated?
    – modulitos
    Commented Jul 8, 2019 at 17:58
  • Honestly I'm not sure how macOS works nor how Adobe Illustrator works (and font metadata has many weird OS-specific variations too), but I would strongly lean towards it being an error in the SVG. Commented Jul 8, 2019 at 18:11
  • Very interesting - it seems like Illustrator is the one confusing the family and file names. I confirmed with the designer, who created the SVG's by downloading the Fredoka One font, installing it with the FontBook app that comes with OSX, then used the default exports in Illustrator to deliver me the SVG.
    – modulitos
    Commented Jul 8, 2019 at 18:23
  • 1
    Looks like many people have the same problem with Illustrator on macOS. Does this happen with other macOS applications? Commented Jul 8, 2019 at 18:27
  • 1
    Ah, I think what Illustrator uses isn't the file name, it's actually the "PostScript font name" field that's also embedded within the file. Commented Jul 8, 2019 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .