A few people have asked me now “How do I make my font show up in GNOME Software” and until today my answer has been something along the lines of “mrrr, it’s complicated“.
What we used to do is treat each font file in a package as an application, and then try to merge them together using some metrics found in the font and 444 semi-automatically generated AppData files from a manually updated .csv file. This wasn’t ideal as fonts were being renamed, added and removed, which quickly made the .csv file obsolete. The summary and descriptions were not translated and hard to modify. We used the pre-0.6 format AppData files as the MetaInfo specification had not existed when this stuff was hacked up just in time for Fedora 20.
I’ve spent the better part of today making this a lot more sane, but in the process I’m going to need a bit of help from packagers in Fedora, and maybe even helpful upstreams. This are the notes of what I’ve got so far:
Font components are supersets of font faces, so we’d include fonts together that make a cohesive set, for instance,”SourceCode” would consist of “SoureCodePro“, “SourceSansPro-Regular” and “SourceSansPro-ExtraLight“. This is so the user can press one button and get a set of fonts, rather than having to install something new when they’re in the application designing something. Font components need a one line summary for GNOME Software and optionally a long description. The icon and screenshots are automatically generated.
So, what do you need to do if you maintain a package with a single font, or where all the fonts are shipped in the same (sub)package? Simply ship a file like this in
/usr/share/appdata/Liberation.metainfo.xml like this:
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2014 Your Name <you@domain> --> <component type="font"> <id>Liberation</id> <metadata_license>CC0-1.0</metadata_license> <name>Liberation</name> <summary>Open source versions of several commercial fonts</summary> <description> <p> The Liberation Fonts are intended to be replacements for Times New Roman, Arial, and Courier New. </p> </description> <updatecontact>richard_at_hughsie_dot_com</updatecontact> <url type="homepage">http://fedorahosted.org/liberation-fonts/</url> </component>
There can be up to 3 paragraphs of description, and the summary has to be just one line. Try to avoid too much technical content here, this is designed to be shown to end-users who probably don’t know what TTF means or what MSCoreFonts are.
It’s a little more tricky when there are multiple source tarballs for a font component, or when the font is split up into subpackages by a packager. In this case, each subpackage needs to ship something like this into
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2014 Your Name <you@domain> --> <component type="font"> <id>LiberationSerif</id> <metadata_license>CC0-1.0</metadata_license> <extends>Liberation</extends> </component>
This won’t end up in the final metadata (or be visible) in the software center, but it will tell the metadata extractor that
LiberationSerif should be merged into the
Liberation component. All the automatically generated screenshots will be moved to the right place too.
Moving the metadata to font packages makes the process much more transparent, letting packagers write their own descriptions and actually influence how things show up in the software center. I’m happy to push some of my existing content from the .csv file upstream.
These MetaInfo files are not supposed to replace the existing fontconfig files, nor do I think they should be merged into one file or format. If your package just contains one font used internally, or where there is only partial coverage of the alphabet, I don’t think we want to show this in GNOME Software, and thus it doesn’t need any new MetaInfo files.