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

Message ListMessage List     Post MessagePost Message

  Set a global Font parameter instead of setting the font for every title/lable/component?
Posted by Taquin Ho on Jul-31-2012 20:17
We are migrating to unicode and using the Google Unicode font
which has name "unifont-5.1.20080907.ttf".

To do this, we need to set the font explicitly constantly for all titles, lables and so on.

Is it possible to set some global chartDirector variable or registry entry to cause
chartDirectory to use this font by default?

Thanks,

Taquin

  Re: Set a global Font parameter instead of setting the font for every title/lable/component?
Posted by Peter Kwan on Aug-01-2012 07:29
Hi Taquin,

You may modify the default font by using the setDefaultFonts API, but you still need to insert this line of code in all your scripts. One common method is to put this line of code in a separate file and "include" the file in all your scripts. (The exact method to "include" a file depends on your programming language.)

If setDefaultFonts is not used, the default fonts are hard coded to be "arial.ttf" (Arial - for normal text) and "arialbd.ttf" (Arial Bold - for default bold text such as the chart title). If you are running on Linux or FreeBSD or Solaris, ChartDirector will look for the fonts in the "fonts" subdirectory. If the default fonts are not found, ChartDirector will use default substitute fonts that come with ChartDirector (and therefore should always be available). So for Linux, FreeBSD and Solaris, one way to "globally" set the default font without any code changes is to rename your fonts to "arial.ttf" and "arialbd.ttf", or to make a symbolic link to link "arial.ttf" and "arialbd.ttf" to your desired font files.

Note that the same method will not work on Windows or Mac OS X, because in these OS, ChartDirector will look up the fonts in the operating system fonts directory, and "arial.ttf" and "arialbd.ttf" always exist in these OS (they come with the OS). So for these OS, you would need to use the "include" file method.

Regards
Peter Kwan