Technologies XML / XSL-FO / Référence / Extensions XSL d’Antenna House Formatter / Éléments / font-face
(Extrait de « XSL-FO ― Die Referenz » de Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
Catégorie : ajout d’une police
Utilisation courante : | Spécifie une police supplémentaire. Cet élément ne génère aucune zone. Ces fonctions ne sont pas disponibles avec AH Formatter V6.3 Lite. [no-LT] |
Zones : | Aucun. |
Contraintes : | <!ELEMENT axf:font-face EMPTY> <!ATTLIST axf:font-face src CDATA #REQUIRED> <!ATTLIST axf:font-face font-family CDATA #REQUIRED> <!ATTLIST axf:font-face font-style (%font-style;) "normal"> <!ATTLIST axf:font-face font-weight (%font-weight;) "normal"> L’élément <axf:font-face> peut être placé directement sous <fo:declarations>. |
Contenu : | EMPTY |
Exemples : | <fo:declarations> <axf:font-face src="url(http://www.hixie.ch/resources/fonts/AHEM____.TTF)" font-family="AHEM"/> </fo:declarations> |
Une police spécifiée par <axf:font-face> / @font-face est toujours incorporée. Il n’est pas possible de spécifier une police dont les informations interdisent l’incorporation.
Les propriétés suivantes peuvent être spécifiées pour <axf:font-face> / @font-face.
src
Spécifie la ressource de police.
Valeur : | |
Valeur initiale : | N/A |
Hérité : | no |
Pourcentages : | N/A |
L’URI peut être spécifié dans <uri> à l’aide du nom de fichier de la police ou de la fonction url(). Le type de police peut être spécifié par la fonction format(). S’il est omis, il est reconnu à partir de l’extension de la ressource de police. Les types disponibles sont les suivants :
woff | |
truetype | TrueType |
opentype | OpenType |
<axf:font-face> peut être utilisé comme suit :
<fo:declarations> <axf:font-face src="url(woff/MyPrivate.woff) format(woff)" font-family="MyWOFF" /> </fo:declarations> ... <fo:block font-family="MyWOFF"> ...
Pour utiliser une police déjà installée, spécifiez son nom à l’aide de la fonction local().
<fo:declarations> <axf:font-face src="local(Arial)" ...
font-family
Spécifie la famille de polices.
Valeur : | <string> |
Valeur initiale : | N/A |
Hérité : | no |
Pourcentages : | N/A |
font-style
Spécifie le style de police.
Valeur : | normal | italic |
Valeur initiale : | normal |
Hérité : | no |
Pourcentages : | N/A |
font-weight
Spécifie la graisse de la police.
Valeur : | normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
Valeur initiale : | normal |
Hérité : | no |
Pourcentages : | N/A |
Exemple XSL-FO :
<fo:root font-size="12pt" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<axf:document-info name="author" value="Alex Critchfield, Antenna House"/>
<axf:document-info name="keywords" value="extensions, font-face"/>
<axf:document-info name="subject" value="font-face extension"/>
<axf:document-info name="title" value="font-face extension demonstration"/>
<fo:layout-master-set>
<fo:simple-page-master page-width="8.5in" page-height="11in" master-name="main">
<fo:region-body region-name="body" margin-top="1in" margin-bottom="1in" margin-left=".75in" margin-right=".75in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:declarations>
<axf:font-face src="url(https://dl.dropboxusercontent.com/u/221516245/Lobster-Regular.ttf)" font-family="EXTERNAL-LOBSTER"/>
</fo:declarations>
<fo:page-sequence master-reference="main">
<fo:flow flow-name="body">
<fo:block>
Formatter can reference fonts from external sources. Externally referenced fonts are always embedded.
</fo:block>
<fo:block space-after="10mm">
The text in the following block will be in the font Lobster which is referenced from a public dropbox link
</fo:block>
<fo:block font-family="EXTERNAL-LOBSTER" space-after="10mm">
This text is in the Lobster font
</fo:block>
<fo:block font-family="monospace" white-space-treatment="preserve" linefeed-treatment="preserve">
Code to include external font: <axf:font-face src="url(https://dl.dropboxusercontent.com/u/221516245/Lobster-Regular.ttf)" font-family="EXTERNAL-LOBSTER"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>Résultat :