Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#1,191 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?

Lenguaje dominante
Java
Estrellas
4.4k
Forks
714
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de LibrePDF/OpenPDF

Todos los issues de LibrePDF/OpenPDF

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.