For PDF output, MATLAB® Report Generator™ comes configured with default fonts: a serif, a sans serif, and dingbats. It also comes configured to use the font for your language, based on your locale. You can further configure your setup to:
During report generation, the Report Generator™ uses font descriptions to create the text in your report. If you want your report program to use fonts other than the defaults used by the Report Generator for PDF output, copy the font descriptions to a specific folder in your file system before you generate your report.
By default, the Report Generator looks
for additional font descriptions in your personal
in the folder
rptgenFonts. You can specify a different
name for the folder. You can alternatively configure the Report Generator to look in a folder in
the MATLAB installation path.
To change the location for the fonts, edit the configuration
fop_config.xml. Go to the folder where the
file is located using this MATLAB command:
Open the file
fop_config.xml in a text editor.
Set the location in the
The configuration file includes the instructions for editing the location.
This procedure assumes that you are using the default folder
for font descriptions
Copy the font descriptions you need to a convenient folder in your file system.
Add code to your report program that copies your font descriptions to the folder specified in the FOP configuration file. This font description folder is deleted after report generation.
myfontdir to the location of your font
myfontdir = 'x:\rptgenFonts'; copyfile(myfontdir,fullfile(tempdir,'rptgenFonts'));
In Report Explorer, add the code in an
For a DOM API report program, add the code before the program writes
When generating PDF reports, the MATLAB Report Generator uses a font capable of rendering text in these languages:
The Report Generator uses a font map to determine the font appropriate for a particular locale. The font map specifies a default set of fonts. You can modify the map to:
Change the fonts used for a particular locale
Add support for locales other than the default locales
The language font map specifies the font to use on a specific platform (for example, Windows®) and locale for basic report elements such as body text.
If a required non-English font is missing for a report, the generated text includes pound sign characters (#). For example:
PDF stylesheets for the MATLAB Report Generator specify fonts for body text, copyright, quotes, symbols, dingbats, monospace, sans serif, and titles.
The PDF stylesheet settings override the PDF font mapping entries.
If you do not specify a PDF stylesheet, then you can use PDF language font mapping entries to change the default fonts for English reports.
To add or modify non-English PDF font mapping specifications:
Use an XML editor with the
to enter all the PDF font mappings for your reports.
Installing the MATLAB Report Generator software loads the
in the following location:
lang_font_map.xml file includes two sections:
name_map — Contains
that specify the name of the font, the language, and the font usage
in the report (for example, body text).
file_map— Contains entries
for the location of the font files for the fonts specified in the
For example, the following
that provide basic PDF font support for Japanese (
ko), and Russian (
The system from which you generate a report using the language font map must have access to the appropriate non-English fonts.
Use one of these font formats for non-English font support:
Type 1 (PostScript®)
Fonts in other formats, such as bitmap fonts for the X Window System (X11), produce poor MATLAB Report Generator report output.
Some TrueType fonts are grouped into packages called TrueType
Collections. To specify a collection in the language font map file,
specify the individual font within the
In addition to the font name, the weight (e.g., bold) and slant (e.g., italic, oblique) may distinguish one font from another in the same family.
The approach you use to identify font names depends on your computer platform.
name_map section of the
add a separate
name_mapping entry for each combination
of language, font, and usage that you want in PDF reports.
name_mapping element has three attributes:
lang specifies the two letter ISO 639-1 code
corresponding to the language of the report.
platform specifies the operating
win — Windows
mac — Mac OS X
usage specifies the kind of report
element or font:
The text of the
name_mapping element is a
font name, as specified in an XSL-FO stylesheet.
Here is an example
<name_mapping_lang="ja" platform="win" usage="body">MS Gothic</name_mapping>
file_map section, add a
that identifies the location of the font file for each font that you
include in the
Each of the platforms (Windows, Mac, and Linux)
has a different default search path for fonts. If the
file does not contain a full file path for a font, the MATLAB Report Generator uses
a platform-specific approach to search for the font.