Looking through Java product API there is some Font.get* functions with predefined names to get some fonts. I can't find any data on how to use other fonts I have like "Bookman Old Style" or "Tahoma".
That would be great if someone could shed some light on this problem.
How do I use an arbitrary font?
Re: How do I use an arbitrary font?
Forum member · Jan 5, 2006And it may happen that I don't have .ttf file. What if I work on Linux?
Re: How do I use an arbitrary font?
Support · Jan 5, 2006Hello,
You can add any TrueType or Type1 fonts without any problem. Following is the code snippet that will allow you to add those fonts:
// Create a TrueType font class.
TrueTypeFont trueTypeFont = new TrueTypeFont("verdana.ttf");
// Use the TrueType font in a text area Page Element.
page.getElements().add(new TextArea("Text", 0, 0, 200, 12, trueTypeFont, 12));
// Create a Type 1 font.
Type1Font type1Font = new Type1Font("[PhysicalPath]/Eras.pfm", "[PhysicalPath]/Eras.pfb");
// Use the Type 1 font in a text area Page Element.
page.getElements().add(new TextArea("Text", 0, 0, 200, 12, type1Font, 12));
You will need to have the font file in order to use any font apart from the 14 core fonts and 7 CJK fonts.
Yes, these fonts will work on Linux system without any problem as long you have the appropriate font file.
Thanks,
ceTe Software Support Team