If you are running on a Unix or Linux server and the template has some Windows font (i.e. wingdings) that are not on the server, does the document still render?
Please read this blog article on Red Hat's website that does a very good job of explaining why you cannot use Microsoft Fonts on Unix based systems.
This is an interesting question. And the answer is, it depends. The server needs the fonts to get the font metrics (the size of each glyph). So first off, if you install wingdings on the server, then it works fine for all situations.
If you don’t have wingdings, then it will use the best match it can find. In the case of wingdings it will use symbol. In the case of Arial, it will use Helvetica. Sometimes these mapped fonts are very close, sometimes they are not. This difference matters primarily for pdf & text reports.
For other output formats, the final report file does not have line breaks in it. In rtf & WordML Word will handle all line breaks when it displays. For html the browser will. Same for xls and SpreadsheetML and Excel. So you should have no problems in the final report, assuming the system it is viewed on has the required font.
For pdf (and text) the font metrics are used to determine the length of text to place soft line breaks and the height of text to place page breaks. The closer the substituted font matches the true font, the more accurate this will be. If it is a lose match, and there is no character formatting within a paragraph, and the paragraphs are left aligned, you might see no difference. But you are generally going to have problems in this situation.
Finally for pdf you can set the system to use either Acrobat’s internal fonts or to embed the fonts used in the final pdf file. The pdf will look well laid out in this case, but it will use the fonts from the server. This is not a good solution if you need wingdings but is a very good solution when mapping Arial to Helvetica.
So the bottom line is that for formats other than pdf and text, it should not be a problem if a font is not on the server. For pdf and text, you want to install the needed font on the server unless it is an identity mapping like Arial to Helvetica.
How to check
Run the Java program in your WindwardReports.jar file net.windward.tools.ShowFonts. It will list out all fonts it can find on the system. If this does not find a font, then Windward cannot find it. Make sure it uses the same WindwardReports.properties file as you use with the engine.
Where do I get fonts?
We suggest you contact the company that sold you your operating system as this is different for each O/S. You must install the fonts, it is not sufficient to just copy them to your system. Make sure they are True Type fonts (.ttf) and that they have been tested on your version of Linux.
Windward recommends using Ascender Fonts as they have been approved by Microsoft to sell/distribute fonts to unix based installations and are reasonably priced.
Other Useful Font Sites:
http://www.ehow.com/how_2034259_install-fonts-unix.html - How to install fonts on a Unix based system
How to find which fonts are installed on your system with Show Fonts
You can use the show fonts utility to see which fonts Windward currently recognizes on your target system. To see how to use this utility go to this page and scoll down to find "show fonts"
PDF Standard fonts
Acrobat has 14 standard fonts that are embedded in the program. These fonts will not be embedded in a PDF, even if embedding is turned on, because the fonts exist in Acrobat.
- 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)
- Zapf Dingbats
Acrobat also has 7 standard CJK (Chinese, Japanese, & Korean) fonts for CJK documents. These are installed as an automatic download/AddIn when Acrobat opens a file with CJK characters in it. These again are not embedded in the PDF but does require the one-time AddIn download/install the first time they are used.
- STSong-Ling: Simplified Chinese font with variable-width strokes
- MHei-Medium: Traditional Chinese font with fixed-width strokes
- MSung-Light: Traditional Chinese font with variable-width strokes
- Heisei Kaku Gothic W5: Japanese font with fixed-width strokes
- Heisei Mincho W3: Japanese font with variable-width strokes
- HYS Myeongjo Medium: Korean font with variable-width strokes
- HY Gothic Medium: Korean font with fixed-width strokes
Additional Useful Information
Here is some additional information on how fonts come into play on a Unix based system where Java and iText (PDF output only) see two different sets of fonts.
Fonts come in to play in a couple of ways and it is based on the output.
- There are two sets of fonts on a system. The first are the fonts Java sees. The second are the fonts iText sees. On Windows these are generally the same set of fonts as iText can pull fonts from Windows. But on other operating systems this has to be specifically configured.
So there can be a font installed on Linux that only Java sees, only iText sees, both see, or neither see.
- Windward needs the fonts to get their metrics to layout the final report, determining where to put soft line and page breaks. These metrics Windward normally pulls from the fonts installed in Java but that can be overridden to use the iText fonts. This step is run for all output types.
- For PDF output it must use the iText fonts to create the PDF report. This step occurs only for PDF reports.
- The most common problem is that Java on a server does see all the fonts used in the templates, but iText does not. To correct this a systems administrator would need to point iText at those additional fonts. There is a how to guide that shows how to do this listed in the Java Engine User Guide.
- Also, If the fonts installed are not designed for the target operating system, then the output in PDF can be wrong - by a lot. Copying fonts from Windows to Linux usually gives a bad layout. This only matters for PDF because formats like RTF are laid out by Word when a user opens them.
To get fonts working on AIX
Note: I think we could have just set font.files to point to the lpp directory where the fonts are but we used this other directory for historical reasons
- Moved some TrueType fonts from a Sun Solaris 5.9 server to the lpp directory on the AIX server.
- Created a symbolic link to a directory called /opt/gvm/fonts/
- In our windwardReports.properties file set...
- Uncommented the "line.break=internal" line in the windwardReports.properties file.
- We bought some TrueType fonts from the company that sold us AIX but they didn't have the .ttf extension. I think Windward requires font files with the .ttf extension. In any case, these fonts didn't work for us and in the end we didn't use them.
- I must have missed the Windward documentation that explains that the font.files entry in the windwardReports.properties file is only used when line.break=internal, i.e. when iText is used to do the line breaks.
- I also think there's some confusion with running the showFonts utility, i.e. I don't think it uses the windwardReports.properties file we use with our app so it's not going to pick up font files as specified by the font.files entry.
What fonts work with which language and what font to use
A font is a collection of glyphs (characters) that are drawn in an identical style. This paragraph is written in Times New Roman and is using the glyphs in the Latin range. Characters are the individual letters such as A or $. So A is the character A in the Courier New font.
Now here is where it gets tricky. Creating a font requires creating a glyph to map to each character than will be rendered. This take time and is expensive. As there are approximately 64,000 characters in the unicode standard, this could become incredibly expensive, especially when English and the Western European languages only need about 256 of those 64,000 characters rendered.
So most fonts only have glyphs for part of the full character set. This becomes a problem is you use a font such as Arial that does not have Asian glyphs to write out Chinese text. What you will get is blank spaces for the text. And it’s not just Asian or no Asian, the font MingLiU has glyphs for Chinese and Japanese, but not Korean.
When you write in Word, it will map in a font that has the characters you are typing. But when you have an out tag, Word has no way of knowing what characters will be brought in at that tag. So you can have an out tag using Arial and the data is an Asian character set and all you get is blanks.
In many cases Word and Excel will not have a problem with generated reports using fonts that have no glyphs for the characters used as it will substitute (not always). And browsers also handle this pretty well. But for PDF you must use a font that has the required glyphs.
If you think this is happening, the first step to check is to use the font Arial Unicode MS (which this paragraph is in). This font contains a glyph for every character. (The reason this font is more spread out is it needs room for characters from any language.)
Click here to open a zip file with a sample template, xml file with text in multiple languages, and the pdf created from running it. The text is not shown here because the html page does not handle the fonts the same as Word or Acrobat. Below is a screenshot of the generated PDF using the various fonts.
Running in Headless Mode
Headless mode is running java without any GUI available to java. This commonly occurs in a unix environment. It is probably impossible to run in headless mode in a Windows or Mac environment as the GUI always exists. And each flavor of Linux seems to handle this a little differently so we can provide help here, but it may not be everything you need.
While x-Windows is not running in headless mode, you generally do need to install it. In many cases java uses the installed libraries and/or fonts for many of the java library calls.
You must set line.break=internal in your WindwardReports.properties file. This tells Windward to calculate all line and page breaks without using the java font classes.
You must set font.files=/usr/somedir/*.ttf in your WindwardReports.properties file. This tells Windward where to find the font files to use when calculating breaks. If Windward cannot find a true type font file for a font used in your report, it cannot calculate breaks correctly.
Where do I get fonts?
A common question we get is where can you get the fonts you need and where should you install them. We suggest you contact the company that sold you your operating system as this is different for each O/S.
If you are using Red Hat Enterprise Linux then I suggest you read this blog article that talks about the main issue you face with Microsoft fonts on a Unix based system and what Red Hat has done with the help of Ascender Fonts to remedy the issue.