PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting Dynamic font substitution logic does not work for me? Re: Re: Dynamic font substitution logic does not work for me?

#28513

@PD4ML wrote:

In order to find an appropriate font to display a text string, PD4ML walks the following lists:
[language=java:o60jhw85]private static String[] serifFallback = new String[] {
“Times New Roman”,
“MS Mincho”,
“MingLiU”,
“SimSun”,
“Mangal”,
“David”,
“Batang”,
“Wingdings”,
“Symbol”,
“Lucida Sans Regular”,
};

private static String[] sansFallback = new String[] {
“Arial”,
“MS Gothic”,
“MingLiU”,
“SimSun”,
“Mangal”,
“David”,
“Gulim”,
“Wingdings”,
“Symbol”,
“Lucida Sans Regular”,
};

private static String[] monoFallback = new String[] {
“Courier New”,
“MS Gothic”,
“MingLiU”,
“SimSun”,
“Mangal”,
“David”,
“GulimChe”,
“Wingdings”,
“Symbol”,
“Lucida Sans Regular”,
};[/language:o60jhw85]

I guess, in your case an existence of SimSun among available fonts should help.

Thanks, this was very very helpful – I’d sure go insane without this information!
However, the paths to fonts and pd4fonts.properties have to be monitored and corrected carefully. Even the http://pd4ml.com/examples.zip I downloaded did not work in Linux nor in Windows. I had to set the absolute paths to files in run.sh, and then it worked. I suppose the person(s) who made the example were working in root directory, or something like that, and that therefore it worked for them.

Also, setting of the fallback fonts would be great option in the future, but at the moment it can be easily hacked – if you do not want to/cannot use some font from the list above, simply change in pd4fonts.properties the line of some existing font <br /> #this is an autogenerated file. please remove manually any references to copyrighted fonts<br /> #Tue Apr 19 06:51:26 GMT-07:00 2011<br /> # font.dir.location=fonts<br /> KaiTi_GB2312=SIMKAI.TTF
change KaiTi_GB2312 to some font from the hardcoded list
#this is an autogenerated file. please remove manually any references to copyrighted fonts<br /> #Tue Apr 19 06:51:26 GMT-07:00 2011<br /> #font.dir.location=fonts<br /> SimSun=SIMKAI.TTF
and everything will work fine.