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

Unable to insert text in Identity-H encoding using a subset font file #1191

Open
SirishaGorasa opened this issue Jul 9, 2024 · 2 comments
Open
Labels

Comments

@SirishaGorasa
Copy link

SirishaGorasa commented Jul 9, 2024

Bug description

I am trying to insert one word of text into the PDF page. I have made use of BaseFont class, provided Identity-H as the encoding and the subset font file corresponding to this one word of text. I am not able to see any text that had got created on the page.

Code snippet

 String fontFile="CLQCTE+TradeGothic.otf";
PdfContentByte cb = writer.getDirectContent();
       BaseFont bf1 = BaseFont.createFont(fontFile, BaseFont.IDENTITY_H,BaseFont.EMBEDDED);
       cb.beginText();
       cb.setTextMatrix(70,804);
       cb.setFontAndSize(bf1,12);
       cb.beginMarkedContentSequence(e1);
       cb.showText("ent");
       cb.endMarkedContentSequence();
       cb.endText();

Expected behavior

I wanted to see the PDF with the text "ent" in it.

System

  • OS: Windows OS
  • Used font: Subset font (mentioned in the code)
  • OpenPDF version: 1.3.26

Even after so many trails, I am not able to see the text on the page. When I checked for the glyphs the font file supports,
came to know that these three glyphs "e", "n" and "t" are supported by this subset font file.

Hence, I have tried with a different font, and it worked well. May I know the reason/resolution for the same?

@mkl-public
Copy link
Contributor

Hence, I have tried with a different font, and it worked well. May I know the reason/resolution for the same?

Apparently, therefore, the issue is related to the font file. Can you share it?

@SirishaGorasa
Copy link
Author

The file type is .otf. I am unable to share the file here.

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

No branches or pull requests

2 participants