File: metainfo-font.xml

package info (click to toggle)
appstream 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,408 kB
  • sloc: ansic: 51,906; xml: 10,459; cpp: 4,721; python: 538; sh: 260; makefile: 24
file content (237 lines) | stat: -rw-r--r-- 9,075 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "AppStream.ent">
%BOOK_ENTITIES;
]>

<section id="sect-Metadata-Fonts">
	<title>Fonts</title>

	<section id="spec-fontdata-introduction">
		<title>Introduction</title>
		<para>
			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.
		</para>
		<para>
			Font packages can ship one or more files in <filename>/usr/share/metainfo/%{id}.metainfo.xml</filename>.
		</para>
		<para>
			Font metadata files can – just like all other metainfo files – be translated. See the section about translation for more information.
		</para>
		<note>
			<para>
				A <literal>font</literal> 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.
			</para>
			<para>
				To make the individual fonts known to the system, use the <xref linkend="tag-font-provides"/> tag.
			</para>
		</note>
	</section>

	<section id="spec-fontdata-example">
		<title>Example file</title>
		<para>
			A minimal font metainfo file can look like this:
		</para>
		<programlisting language="XML"><![CDATA[<?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 type­face fam­ily</summary>
  <description>
    <p>
      Lato is a sanserif type­face fam­ily designed in the Sum­mer 2010 by Warsaw-​​based designer
      Łukasz Dziedzic (“Lato” means “Sum­mer” in Pol­ish). In Decem­ber 2010 the Lato fam­ily
      was pub­lished under the open-​​source Open Font License by his foundry tyPoland, with
      sup­port 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>]]></programlisting>
	</section>

	<section id="spec-fontdata-filespec">
		<title>File specification</title>
		<para>
			Note that the XML root must have the <literal>type</literal> property set to <code>font</code>.
			This clearly identifies this metainfo document as describing a font.
		</para>

		<variablelist>
			<varlistentry>
			<term>&lt;id/&gt;</term>
			<listitem>
				<para>
					For fonts, the <literal>%{id}</literal> 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.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry>
			<term>&lt;metadata_license/&gt;</term>
			<listitem>
				<para>
					The <code>&lt;metadata_license/&gt;</code> tag is required. See <xref linkend="tag-metadata_license"/> for a description of this tag.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry>
			<term>&lt;name/&gt;</term>
			<listitem>
				<para>
					Set a name for the font or font collection.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry>
			<term>&lt;summary/&gt;</term>
			<listitem>
				<para>
					A short description of the font described in this metainfo file.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry>
			<term>&lt;description/&gt;</term>
			<listitem>
				<para>
					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.
				</para>
				<para>
					See the generic component <xref linkend="tag-description"/> for a detailed description of this tag.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry>
			<term>&lt;screenshots/&gt;</term>
			<listitem>
				<para>
					A screenshot presents your font to the outside world.
				</para>
				<para>
					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.
				</para>
				<para>
					See the generic component <xref linkend="tag-screenshots"/> for a detailed description of this tag.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry>
			<term>&lt;url/&gt;</term>
			<listitem>
				<para>
					This is a recommended tag for links of type <code>homepage</code>.
					Links of type <code>homepage</code> should be a link to the upstream homepage for the application.
					See the generic component <xref linkend="tag-url"/> for a description of this tag.
				</para>
			</listitem>
			</varlistentry>

			<varlistentry id="tag-font-provides">
			<term>&lt;provides/&gt; ↪ &lt;font/&gt;</term>
			<listitem>
				<para>
					This tag is described in detail for generic components at <xref linkend="tag-provides"/>.
				</para>
				<para>
					You should add one or more children of type <code>&lt;font/&gt;</code> 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 <literal>family</literal> and <literal>style</literal>
					is used instead.
					The font <emphasis>must</emphasis> have a <literal>family</literal> defined to be included.
				</para>
				<para>
					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.
				</para>
				<para>
					If you want to query the full-name and its <literal>family</literal> and <literal>style</literal> to see what needs to
					be added to this tag, you can use the <command>fc-query</command> utility of Fonconfig:
				</para>
				<screen><command>fc-query</command> --format='FN: %{fullname[0]}\nFS: %{family[0]} %{style[0]}\n' <userinput>FONT-FILENAME</userinput></screen>
				<para>
					Examples:
				</para>
				<programlisting language="XML"><![CDATA[<provides>
  <font>Lato Heavy Italic</font>
  <font>Noto Kufi Arabic Bold</font>
  <font>Liberation Serif Bold Italic</font>
  <font>FontAwesome Regular</font>
</provides>]]></programlisting>
				<para>
					If no <code>&lt;font/&gt;</code> tags were defined, the AppStream catalog data generator should try to extract them from the actual font files found in the
					software package/bundle.
				</para>
				<para>
					In every case, the names given in the provides tag <emphasis>must</emphasis> match the metadat the fonts contain themselves. If the data of the font files
					is incomplete, the data can not be extended by the <code>&lt;font/&gt;</code> 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).
				</para>
			</listitem>
			</varlistentry>

			<varlistentry id="tag-font-languages">
				<term>&lt;languages/&gt;</term>
				<listitem>
					<para>
						This tag gives information about the locale a font supports.
					</para>
					<para>
						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.
					</para>
					<para>
						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.
					</para>
					<para>
						You can use the following command to determine which languages a font supports:
					</para>
					<screen><command>fc-query</command> --format='%{lang}\n' <userinput>FONT-FILENAME</userinput></screen>
					<para>
						Tag example:
					</para>
					<programlisting language="XML"><![CDATA[<languages>
  <lang>de</lang>
  <lang>en</lang>
  <lang>cn</lang>
</languages>
]]></programlisting>
				</listitem>
			</varlistentry>
		</variablelist>

		<para>
			For a component of type <literal>font</literal>, the following tags are required and must be present: <xref linkend="tag-id-generic"/>, <xref linkend="tag-name"/>,
			<xref linkend="tag-summary"/>, <xref linkend="tag-metadata_license"/>, <xref linkend="tag-font-provides"/>.
		</para>

	</section>
</section>