Tecnologías XML / XSL-FO / Referencia / Extensiones XSL de Antenna House Formatter / Elementos / font-face

(Extracto 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

Categoría: incorporación de una fuente

Uso habitual:

Especifica una fuente adicional. Este elemento no genera ningún área. Estas funciones no están disponibles con AH Formatter V6.3 Lite. [no-LT]

Áreas:

Ninguno.

Restricciones:

<!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">

El elemento <axf:font-face> puede colocarse directamente bajo <fo:declarations>.

Contenido:

EMPTY

Ejemplos:

<fo:declarations> <axf:font-face src="url(http://www.hixie.ch/resources/fonts/AHEM____.TTF)" font-family="AHEM"/> </fo:declarations>

Una fuente especificada mediante <axf:font-face> / @font-face siempre se incrusta. No puede especificarse una fuente cuya información prohíba la incrustación.

Pueden especificarse las siguientes propiedades para <axf:font-face> / @font-face.

src

Especifica el recurso de la fuente.

Valor:

[ <uri> [format(<string>)]? | <font-face-name> ]#

Valor inicial:

N/A

Heredado:

no

Porcentajes:

N/A

El URI puede especificarse en <uri> mediante el nombre de archivo de la fuente o la función url(). El tipo de fuente puede indicarse mediante la función format(). Si se omite, se reconoce a partir de la extensión del recurso de la fuente. Los tipos disponibles son los siguientes:

woff

WOFF (Web Open Font Format)

truetype

TrueType

opentype

OpenType

<axf:font-face> puede utilizarse de la siguiente manera:

<fo:declarations> <axf:font-face src="url(woff/MyPrivate.woff) format(woff)" font-family="MyWOFF" /> </fo:declarations> ... <fo:block font-family="MyWOFF"> ...

Para utilizar una fuente ya instalada, especifique su nombre mediante la función local().

<fo:declarations> <axf:font-face src="local(Arial)" ...

font-family

Especifica la familia de fuentes.

Valor:

<string>

Valor inicial:

N/A

Heredado:

no

Porcentajes:

N/A

font-style

Especifica el estilo de la fuente.

Valor:

normal | italic

Valor inicial:

normal

Heredado:

no

Porcentajes:

N/A

font-weight

Especifica el grosor de la fuente.

Valor:

normal | bold | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900

Valor inicial:

normal

Heredado:

no

Porcentajes:

N/A

Ejemplo 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>

Descargar los ejemplos

Resultado:

volver arriba