Using Simulated (Synthetic) Styles
Using a Simulated Styles Font from a True Type File (ttf)
Suppose you plan to style the output with the fictitious
Syncro-Oxygen
font and you just have the
Syncro-Oxygen-Regular.ttf
font available. The regular font face
definition will be:
@font-face { font-family: "Syncro-Oxygen"; font-style: normal; font-weight: 400; /* normal */ src: url("fonts/raleway/Syncro-Oxygen-Regular.ttf"); }For the missing style combinations, this example uses the
-oxy-simulate-style: yes
CSS extension
property.@font-face { font-family: "Syncro-Oxygen"; font-style: normal; font-weight: 700; /* bold */ -oxy-simulate-style: yes; src: url("fonts/raleway/Syncro-Oxygen-Regular.ttf"); } @font-face { font-family: "Raleway"; font-style: italic; font-weight: 400; /* normal */ -oxy-simulate-style: yes; src: url("fonts/raleway/Syncro-Oxygen-Regular.ttf"); } @font-face { font-family: "Raleway"; font-style: italic; font-weight: 700; /*bold*/ -oxy-simulate-style: yes; src: url("fonts/raleway/Syncro-Oxygen-Regular.ttf"); }
Using a Simulated Font Style from a True Type Font Collection (ttc)
The @font-face
rules in your CSS work as expected when they are pointing
to a .ttf file. If you intend to use a .ttc
collection, the value of the font-family
property should match exactly
one of the font names from the collection (a collection contains multiple fonts).
The following example uses the fictitious Syncro-Fusion
font (the sf.ttc file). Suppose this font provides regular, light,
bold, but no italic or bold-italic variants. In this case, you may want Oxygen PDF Chemistry to generate the missing variants for you.
To use the regular variant, use a simple @font-face
definition, making
sure the font family is found in the collection:
@font-face { font-family: "Syncro-Fusion"; font-style: normal; font-weight: 400; src: url("fonts/syncro/sf.ttc"); }
For the missing style combinations, the example uses the -oxy-simulate-style:
yes
CSS extension property.
@font-face { font-family: "Syncro-Fusion"; font-style: normal; font-weight: 700; -oxy-simulate-style: yes; src: url("fonts/syncro/sf.ttc"); } @font-face { font-family: "Syncro-Fusion"; font-style: italic; font-weight: 400; -oxy-simulate-style: yes; src: url("fonts/syncro/sf.ttc"); } @font-face { font-family: "Syncro-Fusion"; font-style: italic; font-weight: 700; -oxy-simulate-style: yes; src: url("fonts/syncro/sf.ttc"); } @font-face { font-family: "Syncro-Fusion"; font-style: normal; font-weight: 100; -oxy-simulate-style: yes; src: url("fonts/syncro/sf.ttc"); }