HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › Issue with font family on chinese characters
- This topic has 10 replies, 3 voices, and was last updated Sep 10, 2015
 11:50:51 byAnonymous. 
- 
		AuthorPosts
- 
		
			
				
August 11, 2015 at 12:14#27039Hi We were using PD4ML version 361, now we have upgraded to latest one Now we have a problem with the font for example, 
 for the paragraphs which contain both the english and chinese characters are rendered with the Mingliu font we are using for chinesethe below is our piece of code. 
 WENJUN Money 育暮趣所及定平関島指形由幹設 Laundering in UNITED KINGDOM IS NOT functional nowstyle used is, .match-text{font-size: 11pt;font-family: Times New Roman,MingLiu;} In the old version of PD4ML, we were getting the english in times new roman and only the chinese characters in the Mingliu font. But in the latest pd4ml version, we are seeing everything on the Mingliu font version and not getting the correct style we expected. Please help us to resolve this issue Regards 
 SarinAugust 11, 2015 at 14:35#29814Do you have a font mapping for Times New Roman in pd4fonts.properties? Does it load the .ttf file during a conversion? Times New Roman=times.ttf August 12, 2015 at 05:03#29815Yes, we have defined this in pd4fonts.properties Arial=arial.ttf 
 Arial Bold=arialbd.ttf
 Arial Bold Italic=arialbi.ttf
 Arial Italic=ariali.ttf
 Courier New=cour.ttf
 Courier New Bold=courbd.ttf
 Courier New Bold Italic=courbi.ttf
 Courier New Italic=couri.ttf
 Times New Roman=times.ttf
 Times New Roman Bold=timesbd.ttf
 Times New Roman Bold Italic=timesbi.ttf
 Times New Roman Italic=timesi.ttf
 Calibri Bold=calibribd.ttf
 Calibri=calibri.ttf
 Calibri Italic=Calibrii.ttf
 MingLiU=mingliu.ttc_0The issue happens only when the english and chinese characters inside one span or tag, If the chinese in in another span, it is working properly. But in our case, it will come together inside one span, please help us to resolve this. Otherwise it would a big blow for us as the existing functionality will be broken with the upgrade Regards 
 SarinAugust 14, 2015 at 12:25#29816We plan to address the issue on Monday. I’ll let you know asap. August 18, 2015 at 06:01#29817Ok, thanks, we will wait for your reply August 19, 2015 at 12:56#29818Hello PD4ML support, please can you respond on this issue as this is blocking our timelines and resources. August 19, 2015 at 13:03#29819Sorry it takes that long. We’ve been still working on the issue. I’ll let you know. August 20, 2015 at 18:16#29820In current DEV build we implemented a solution for the issue. It is a very sensitive part of the rendering engine and the patched version still cannot pass QA by “exotic” test cases (a mix of Chinese and Arabic scripts), so we made the patch conditionally switchable on/off. Currently by default it is switched off. In order to enable it you should either run your Java (app server?) with the following JVM parameter: -Dpd4ml.fix.20150816=true Alternatively you may trigger PD4ML API to achieve the same effect: HashMap map = new HashMap(); 
 map.put( PD4Constants.PD4ML_FIX20150816, “true” );
 pd4ml.setDynamicParams(map);Hopefully the workaround is ok for you. We currently work on a totally refactored PD4ML v4.x, which should implicitly solve such kind of issues. We’ll send you an updated library by request to support pd4ml com September 9, 2015 at 15:02#29821Hi, thank you for your solution. Would like to know, Whether we have any workaround without upgrading the library, we are using the v397 licenced version and not easy to change the JAR again. Do we have any workaround where we can solve this. we really appreciate your support, please give us some suggestions how we can fix this Regards 
 SarinSeptember 10, 2015 at 11:29#29822A workaround is to preprocess input HTML and to isolate CJK portions of text to separate spans. 
 WENJUN Money 育暮趣所及定平関島指形由幹設 Laundering in UNITED KINGDOM IS NOT functional now
 to 
 WENJUN Money 育暮趣所及定平関島指形由幹設 Laundering in UNITED KINGDOM IS NOT functional now
 Is it doable on your side? September 10, 2015 at 11:50#29823thanks for your support 
 we have changed it to call this function before showing the contentimport java.util.regex.Matcher; 
 import java.util.regex.Pattern;public class CJKFinder { public static void main(String[] args) { 
 String str = ” 育暮 1 Great Work M R 12 13 14 育暮趣所及定平関島指形由幹設世戸 122 育暮趣所$及定平関 島指形由幹設世戸 hello. aiguë διαίρεσις”;
 System.out.println(applyCJKStyle(str));
 }public static String applyCJKStyle(String text){ 
 Pattern pattern = Pattern.compile(“([u4E00-u9FFF]{1,})”);
 Matcher matcher = pattern.matcher(text);
 StringBuffer output = new StringBuffer();
 while (matcher.find()){
 matcher.appendReplacement(output, “$1“);
 }
 matcher.appendTail(output);
 return output.toString();
 }} 
- 
		AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.

