ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Problem using private fonts with ChartDirector for Java on Solaris
Posted by Greg on Aug-14-2012 23:09
Attachments:
Hi,

I am calling the TextBox.setFontStyle() method and passing in the filename of a private
font. This works on Windows and the font comes out as expected, but on Solaris the text is
displayed but in the wrong font.
I have tried running java with and without the headless option with the same result.
I have attached a zip file with a source code example and a font that demonstrates the
problem. This also contains the shell script used to run the example, the images produced
on windows and solaris, and the output logged during the run. The output contains the
result of the call to Chart.libgTTFTest().

Regards,
Greg
javatest.zip
javatest.zip

104.06 Kb

  Re: Problem using private fonts with ChartDirector for Java on Solaris
Posted by Peter Kwan on Aug-15-2012 01:03
Hi Greg,

The problem is likely because your font is not visible to the Java VM you are using.

Different versions, brands and operating system editions of Java may use different methods to install fonts. You may need to refer to your Java documentation for details. For example:

http://docs.oracle.com/javase/1.3/docs/guide/intl/addingfonts.html

You may use the following script to see all the fonts visible to your Java VM:

String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i)
    System.out.println(f[i]);

Please make sure the fonts you want to use if one of the fonts visible to the Java VM.

In some Java versions, you may use fonts not installed to the Java VM if you provide the full path name of the font, like:

textbox.setFontStyle("/full/path/to/itcblkad.ttf");

For the Chart.libgTTFTest, you may instead use Chart.testFont to test your particular font:

//or use the full path "/full/path/to/itcblkad.ttf"
System.out.println(Chart.testFont("itcblkad.ttf", 0, 10, 10, 0));

Hope this can help.

Regards
Peter Kwan

  Re: Problem using private fonts with ChartDirector for Java on Solaris
Posted by Greg on Aug-15-2012 03:07
Hi Peter,

Thanks for the information and the quick reply.
The full path did the trick.

Regards,
Greg