Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,191 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

Start by tracing how BaseFont.createFont handles the supplied subset OTF with Identity-H, then follow how PdfContentByte.showText maps the characters to glyphs. Reproduce with the provided snippet and font file, comparing it with a full font that works. Done means identifying why the subset font renders no text and confirming a fix or a clear limitation; the issue does not name a test or source file.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
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?

Lingua principale
Java
Stelle
4.4k
Fork
714
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di LibrePDF/OpenPDF

Tutte le issue di LibrePDF/OpenPDF

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.