A software center can allow users to install additional fonts using font metadata. Also, applications can use font metadata to find missing fonts (for example, if a special mathematical font is needed) in the distribution's software sources. This metainfo specification describes how metadata for fonts or font collections should be structured.
Font packages can ship one or more files in /usr/share/metainfo/%{id}.metainfo.xml
.
Font metadata files can – just like all other metainfo files – be translated. See the section about translation for more information.
A font
component is in most cases not describing a single font, but rather a collection of fonts that
are grouped together, usually by their art style or font-family.
To make the individual fonts known to the system, use the <provides/> ↪ <font/> tag.
A minimal font metainfo file can look like this:
<?xml version="1.0" encoding="UTF-8"?>
<component type="font">
<id>com.latofonts.Lato</id>
<metadata_license>MIT</metadata_license>
<project_license>OFL-1.1</project_license>
<name>Lato</name>
<summary>A sanserif typeface family</summary>
<description>
<p>
Lato is a sanserif typeface family designed in the Summer 2010 by Warsaw-based designer
Łukasz Dziedzic (“Lato” means “Summer” in Polish). In December 2010 the Lato family
was published under the open-source Open Font License by his foundry tyPoland, with
support from Google.
</p>
</description>
<provides>
<font>Lato Regular</font>
<font>Lato Italic</font>
<font>Lato Bold</font>
<font>Lato Light</font>
<font>Lato Light Italic</font>
...
</provides>
</component>
Note that the XML root must have the type
property set to font
.
This clearly identifies this metainfo document as describing a font.
For fonts, the %{id}
must follow the reverse-DNS scheme as described for generic components.
For the product name part, it is recommended to take the the name of the font or font bundle without whitespace.
The <metadata_license/>
tag is required. See <metadata_license/> for a description of this tag.
Set a name for the font or font collection.
A short description of the font described in this metainfo file.
Add a long description of your font. Do not assume the format is HTML. Only paragraph, ordered list and unordered list are supported at this time.
See the generic component <description/> for a detailed description of this tag.
A screenshot presents your font to the outside world.
If the font metadata does not define an own screenshot, the AppStream generator is supposed to render one or multiple sample images using the respective font.
See the generic component <screenshots/> for a detailed description of this tag.
This is a recommended tag for links of type homepage
.
Links of type homepage
should be a link to the upstream homepage for the application.
See the generic component <url/> for a description of this tag.
This tag is described in detail for generic components at <provides/>.
You should add one or more children of type <font/>
to make the font's full-names known.
The full-name should be the same as given in the font file for the English language.
If no full-name is set, a space-separated combination of the font's family
and style
is used instead.
The font must have a family
defined to be included.
The full-name entry should show the complete name of a typeface in its “natural” form, including style and character set information (if any), and without abbreviations. This is the name that some systems and applications look at to determine full, unabbreviated font menu names.
If you want to query the full-name and its family
and style
to see what needs to
be added to this tag, you can use the fc-query
utility of Fonconfig:
fc-query
--format='FN: %{fullname[0]}\nFS: %{family[0]} %{style[0]}\n'FONT-FILENAME
Examples:
<provides>
<font>Lato Heavy Italic</font>
<font>Noto Kufi Arabic Bold</font>
<font>Liberation Serif Bold Italic</font>
<font>FontAwesome Regular</font>
</provides>
If no <font/>
tags were defined, the AppStream catalog data generator should try to extract them from the actual font files found in the
software package/bundle.
In every case, the names given in the provides tag must match the metadat the fonts contain themselves. If the data of the font files
is incomplete, the data can not be extended by the <font/>
tag.
This is important because the AppStream generator may use the data to pick the right fonts, and because applications expect the exact font they requested
via AppStream to be present on the system after the component was installed (and not one which has different metadata).
This tag gives information about the locale a font supports.
This tak allows specifying the main locale (and thereby scripts) the font can be used with. It does not have to contain an extensive list, as the AppStream metadata generator will try get obtain that information from the font files themselves, but it is useful to define to hint the generator in the right direction.
If samples of the font are rendered as screenshots by the catalog metadata generator, the locale mentioned in the metainfo file will be preferred over automatically (or heuristically) defined ones.
You can use the following command to determine which languages a font supports:
fc-query
--format='%{lang}\n'FONT-FILENAME
Tag example:
<languages>
<lang>de</lang>
<lang>en</lang>
<lang>cn</lang>
</languages>
For a component of type font
, the following tags are required and must be present: <id/>, <name/>,
<summary/>, <metadata_license/>, <provides/> ↪ <font/>.