sitimoen / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

I would like to be judged string is not Chinese...but I can't find field. #279

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.used chinese
2.Set the font.If I set font,All text used this font.So,judged string is not 
Chinese.If it's chinese,used I write-->"C:/Windows/Fonts/arialuni.ttf", 
BaseFont.IDENTITY_H, BaseFont.EMBEDDED.

Please provide any additional information below.
Options options = 
Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.ODFDOM).subOptions(PdfOp
tions.create().fontProvider(new IFontProvider() {
                @Override
                public Font getFont(String familyName, String encoding, float size, int style, Color color) {
                    System.out.println("familyName:" + familyName);
                    System.out.println("encoding:" + encoding);
                    System.out.println("size:" + size);
                    System.out.println("style:" + style);
                    System.out.println("color:" + color);
                    try {
                        //I would like to be judged string is not Chinese...but I can't find field.
                        BaseFont bfChinese = BaseFont.createFont("C:/Windows/Fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
                        System.out.println("bfChinese.getDifferences():"+bfChinese.getDifferences()[0]);
                        Font fontChinese = new Font(bfChinese, size, style, color);
                        if (familyName != null) {
                            fontChinese.setFamily(familyName);
                        }
                        return fontChinese;
                    } catch (Throwable e) {
                        e.printStackTrace();
                        return ITextFontRegistry.getRegistry().getFont(familyName, encoding, size, style, color);
                    }
                }
            }));

Original issue reported on code.google.com by ZhaoQianJava@gmail.com on 8 Jul 2013 at 3:03

GoogleCodeExporter commented 8 years ago
Hi ZhaoQianJava,

I suggest you to try the 1.0.3 (which is not released) because we have worked 
about this topic (chineese character). The basic idea is to test for each 
character if it's asian or not character and use the well font.

Tell if it works with your case.

Regards Angelo

Original comment by angelo.z...@gmail.com on 8 Jul 2013 at 9:55

GoogleCodeExporter commented 8 years ago
Dear Angelo:

    Ok,got it.I will have time to send the test results.
    I really really like this project.

Thanks for you help.

Original comment by ZhaoQianJava@gmail.com on 9 Jul 2013 at 5:51