Project

General

Profile

WPdfImage does not support unicode

Added by Vladimir Savchik over 4 years ago

1. WPdfImage

        for (Constructor<?> c : Font.class.getConstructors()) {
            Class<?>[] paramTypes = c.getParameterTypes();
            if (paramTypes.length == 4 &&
                    paramTypes[0] == PDF.class &&
                    paramTypes[1] == java.io.InputStream.class &&
                    paramTypes[2].isPrimitive() && paramTypes[2].equals(java.lang.Integer.TYPE) &&
                    paramTypes[3].isPrimitive() && paramTypes[3].equals(java.lang.Boolean.TYPE)) {
                fontConstructor = c;

included pdfjet-4.75.jar does not contain this constructor, 5.x versions as well.

therefore fontConstructor = null ALWAYS

2. then if you draw language text

    private Font createFont(WFont font) {
        if (fontConstructor != null) {
            FontMatch fm = trueTypeFonts.matchFont(font);

... (not a case, and addFontCollection does not work)

        String name = PdfUtils.toBase14Font(font);
        try {
            Font f = new Font(pdf, name);
// Constructor for CJK - Chinese, Japanese and Korean fonts.

... for others 4.x makes single-char 1252 corefont, 5.x - raises exception