Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilingual fonts not supported properly as typography rules not implemented. #297

Closed
codecracker2014 opened this issue Nov 16, 2019 · 5 comments

Comments

@codecracker2014
Copy link
Contributor

No description provided.

@sixdouglas
Copy link
Contributor

@codecracker2014 thanks for this issue but what would you mean? Any particular issue? Code to reproduce it?

@codecracker2014
Copy link
Contributor Author

Current output:
image

Expected output:
image

This is due to glyph substitutions not done as per TTF file.
Below is link to typography specs:
https://docs.microsoft.com/en-us/typography/opentype/spec/gsub

Below is code for creating simple PDF using TTF font :

`
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;

import java.io.FileOutputStream;
import java.io.IOException;

/**

  • Created by gajendra.jatav on 11/20/2019.
    */
    public class HelloWorld {

    public static void main(String[] args) {

     System.out.println("नमस्ते");
    
     FontFactory.register("C:\\Windows\\Fonts\\NIRMALA.TTF");
     // step 1: creation of a document-object
     Document document = new Document();
     try {
         // step 2:
         // we create a writer that listens to the document
         // and directs a PDF-stream to a file
         PdfWriter.getInstance(document,
                 new FileOutputStream("D:\\workspace\\TMP\\out\\HelloWorld.pdf"));
    
         // step 3: we open the document
         document.open();
         // step 4: we add a paragraph to the document
         document.add(new Chunk(
                 "नमस्ते",
                 FontFactory.getFont("nirmala ui", "Identity-H",false,10,0,null)));
     } catch (DocumentException de) {
         System.err.println(de.getMessage());
     } catch (IOException ioe) {
         System.err.println(ioe.getMessage());
     }
    
     // step 5: we close the document
     document.close();
    

    }
    }

`

@mkl-public

This comment has been minimized.

@codecracker2014
Copy link
Contributor Author

itext2 was used in more then 150 open source libraries, now these libraries can use OpenPDF. But all of them having this limitation. Itext was rewritten just add advanced typography, which is no longer compatible with other open source libraries. I'm working on improving OpenPDF to support advanced typography and got it working. I'll share pull request shortly.

codecracker2014 added a commit to codecracker2014/OpenPDF that referenced this issue Jan 20, 2020
codecracker2014 added a commit to codecracker2014/OpenPDF that referenced this issue Jan 20, 2020
codecracker2014 added a commit to codecracker2014/OpenPDF that referenced this issue Jan 20, 2020
@codecracker2014
Copy link
Contributor Author

Pull requested created- #329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants