<axf:font-face> / CSS @font-face
(Auszug aus "XSL-FO ― Die Referenz" von 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
Category Appending a Font
Common Usage: | Specifies an additional font. This element does not generate area. These functions are not available with AH Formatter V6.3 Lite. [no-LT] |
Areas: | None. |
Constraints: | <!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"> The <axf:font-face> element can be placed directly under <fo:declarations>. |
Contents: | EMPTY |
Examples: | <fo:declarations> <axf:font-face src="url(http://www.hixie.ch/resources/fonts/AHEM____.TTF)" font-family="AHEM"/> </fo:declarations> |
A font specified by <axf:font-face> / @font-face is always embedded. A font with embedding prohibition information cannot be specified.
The following properties can be specified to <axf:font-face> / @font-face.
src
Specifies the font resource.
Value: | [ <uri> [format(<string>)]? | <font-face-name> ]# |
Initial: | N/A |
Inherited: | no |
Percentages: | N/A |
URI can be specified to <uri> with the file name of the font, or the url() function. The type of fonts can be specified by the format() function. When omitted, it will be recognized by the extension of the font resource. Available types are as follows:
woff | WOFF (Web Open Font Format) |
truetype | TrueType |
opentype | OpenType |
<axf:font-face> can be used as follows;
<fo:declarations> <axf:font-face src="url(woff/MyPrivate.woff) format(woff)" font-family="MyWOFF" /> </fo:declarations> ... <fo:block font-family="MyWOFF"> ...
When using the already installed font, specify the installed font name with the local() function.
<fo:declarations> <axf:font-face src="local(Arial)" ...
font-family
Specifies the font family.
Value: | <string> |
Initial: | N/A |
Inherited: | no |
Percentages: | N/A |
font-style
Specifies the font style.
Value: | normal | italic |
Initial: | normal |
Inherited: | no |
Percentages: | N/A |
font-weight
Specifies the font weight.
Value: | normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
Initial: | normal |
Inherited: | no |
Percentages: | N/A |
XSL-FO sample:
| <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"> | |
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| <fo:block> | |
| Formatter can reference fonts from external sources. Externally referenced fonts are always embedded. | |
| </fo:block> | |
| ||
| The text in the following block will be in the font Lobster which is referenced from a public dropbox link | |
| </fo:block> | |
| ||
| This text is in the Lobster font | |
| </fo:block> | |
| ||
| 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:root> |
Output:
Tipp der data2type-Redaktion: Zum Thema XSL-FO bieten wir auch folgende Schulungen zur Vertiefung und professionellen Fortbildung an: |