Fonts
Supported Fonts
- Some fonts may use features that are unsupported, such as the
MarkGlyphSetin the GDEF table. - The advanced features of OTF are not supported, but the Compact Font Format (CFF) extracted from the OTF is embedded as a Type1C font.
Basic Fonts
By default, a PDF document should embed all the fonts except for a few that are considered to be available in all the PDF rendering applications, called basic fonts:
- Times (v3) (in regular, italic, bold, and bold italic)
- Courier (in regular, oblique, bold and bold oblique)
- Helvetica (v3) (in regular, oblique, bold and bold oblique)
- Symbol.
- Zapf Dingbats.
Using Web Fonts
@import declaration in your
CSS:@import url('https://fonts.googleapis.com/css?family=Montserrat:300,300i,400,500,700i'); section h2 { font-family: Montserrat, Serif; font-weight:500; }
Serif in the
above example).Using Installed Fonts
section h2 {
font-family: Calibri;
}Using Local Font Files
Font Files from a Directory
If you have your font files located in a directory, you can instruct Oxygen PDF Chemistry to load them. Use the -fonts-dir command line argument. In this case,
just specify the name of the font directly in the font-family property,
as you would for the built-in fonts. There is no need to define a
@font-face in the CSS.
Font Files from the Oxygen PDF Chemistry Installation
Another way is to copy your font files in the following subfolder:
[CHEMISTRY_INSTALL_DIR]/config/fonts. In this case, there is no
need to define a @font-face in the CSS, just specify the name of the font
directly in the font-family property.
Font Files Next to the CSS
If the font file is not installed in the system, you can place it next to your CSS file.
You will have to declare one or more @font-face structures, with the same
font-family, but with possible different font-weight
and font-style, as in the example below, where the
TitilliumWeb font is a bundle of multiple TTF files, each one for a
specific font-weight and style. The TTF files were placed in a folder next to the CSS,
named fonts/titillium. In simpler cases, you might create a single
@font-face structure.
@font-face {
font-family: titillium;
font-style: normal;
font-weight: 400;
src: url(fonts/titillium/TitilliumWeb-Regular.ttf) ;
}
@font-face {
font-family: titillium;
font-style: normal;
font-weight: 300;
src: url(fonts/titillium/TitilliumWeb-Light.ttf) ;
}
@font-face {
font-family: titillium;
font-style: normal;
font-weight: 200;
src: url(fonts/titillium/TitilliumWeb-ExtraLight.ttf) ;
}
@font-face {
font-family: titillium;
font-style: normal;
font-weight: 600;
src: url(fonts/titillium/TitilliumWeb-SemiBold.ttf) ;
}
section h2 {
font-family: titillium, Serif;
}
Font Embedding
CSS Font Embedding
All the font families that are referenced from the CSS are embedded automatically in the PDF by Oxygen PDF Chemistry.
Basic Fonts Embedding
Although the basic fonts are guaranteed to be available in all PDF readers, there are some situations where you will have to embed them explicitly when using PDF/Universal Accessibility or Archiving. Because there are some copyright restrictions on these fonts, Oxygen PDF Chemistry cannot redistribute them. You will have to locate the files on your system and declare a set of font faces with the same name as the default ones, as in the following example.
@font-face{
font-family:Times;
font-style: normal;
font-weight:400;
src: url("fonts/TIMES.TTF");
}
@font-face{
font-family:Times;
font-style: italic;
font-weight:400;
src: url("fonts/TIMESI.TTF");
}
@font-face{
font-family:Times;
font-style: italic;
font-weight:700;
src: url("fonts/TIMESBI.TTF");
}
@font-face{
font-family:Times;
font-style: normal;
font-weight:700;
src: url("fonts/TIMESBD.TTF");
}
/* –––––––––––––––––––––––- */
@font-face{
font-family:Helvetica;
font-style: normal;
font-weight:400;
src: url("fonts/ARIAL.TTF");
}
@font-face{
font-family:Helvetica;
font-style: italic;
font-weight:400;
src: url("fonts/ARIALI.TTF");
}
@font-face{
font-family:Helvetica;
font-style: italic;
font-weight:700;
src: url("fonts/ARIALBI.TTF");
}
@font-face{
font-family:Helvetica;
font-style: normal;
font-weight:700;
src: url("fonts/ARIALBD.TTF");
}
/* –––––––––––––––––––––––- */
@font-face{
font-family:Courier;
font-style: normal;
font-weight:400;
src: url("fonts/COUR.TTF");
}
@font-face{
font-family:Courier;
font-style: italic;
font-weight:400;
src: url("fonts/COURI.TTF");
}
@font-face{
font-family:Courier;
font-style: italic;
font-weight:700;
src: url("fonts/COURBI.TTF");
}
@font-face{
font-family:Courier;
font-style: normal;
font-weight:700;
src: url("fonts/COURBD.TTF");
}
/* –––––––––––––––––––––––- */
@font-face{
font-family:Symbol;
font-style: normal;
font-weight:400;
src: url("fonts/SYMBOL.TTF");
}
/* –––––––––––––––––––––––- */
@font-face{
font-family:"Zapf Dingbats";
font-style: normal;
font-weight:400;
src: url("fonts/WINGDING.TTF");
}
/* –––––––––––––––––––––––- */
@font-face{
font-family:Any;
font-style: normal;
font-weight:400;
src: url("fonts/TIMES.TTF");
}
@font-face{
font-family:Any;
font-style: italic;
font-weight:400;
src: url("fonts/TIMESI.TTF");
}
@font-face{
font-family:Any;
font-style: italic;
font-weight:700;
src: url("fonts/TIMESBI.TTF");
}
@font-face{
font-family:Any;
font-style: normal;
font-weight:700;
src: url("fonts/TIMESBD.TTF");
}