Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4, 3.0.0 PDFBox
    • Fix Version/s: 2.0.5, 3.0.0 PDFBox
    • Component/s: None
    • Labels:
      None

      Description

              PDDocument doc = new PDDocument();
              PDType0Font font = PDType0Font.load(doc, new FileInputStream("c:/windows/fonts/arial.ttf"));
              System.out.println(font.hasGlyph('\n'));
              PDPage page = new PDPage();
              doc.addPage(page);
              PDPageContentStream cs = new PDPageContentStream(doc, page);
              cs.beginText();
              cs.setFont(font, 100);
              cs.showText("\n");
      

      The output:

      true
      Exception in thread "main" java.lang.IllegalArgumentException: No glyph for U+000A in font ArialMT
      	at org.apache.pdfbox.pdmodel.font.PDCIDFontType2.encode(PDCIDFontType2.java:402)
      	at org.apache.pdfbox.pdmodel.font.PDType0Font.encode(PDType0Font.java:351)
      	at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:316)
      	at org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:362)
      

      Either this is a bug in hasGlyph(), or it is a documentation (javadoc) problem, e.g. because the parameter to hasGlyph isn't a character code but something else, then this should be clarified.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tilman Tilman Hausherr
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: