Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3379

PDType0Font Subsetting Monospace DejaVuSansMono

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.2, 2.0.3, 3.0.0 PDFBox
    • 2.0.3, 3.0.0 PDFBox
    • FontBox
    • None

    Description

      Hi,
      we came across the problem that the monospace font dejaVuSansMono has problems with spaces in strings if they are rendered in a pdf and a PDFType0Font is used for subsetting. If a space is placed within the strings the letters from every word are placed overlapping each other, see attached files. Seems that the advancedWidth array int the HorizontalMetricsTable contains a wrong, very low value as 3rd entry after subsetting the font. We compared it with a second monospace font, and it worked there. The difference between the two fonts is that the dejaVu Mono only contains 4 advanceWidth entries and the second one contains an entry for every glyph. This second font was VeraMono.ttf . The fonts are loaded via PDType0Font.load(doc, fontfile).

      Attachments

        1. PDFBox3379.java
          2 kB
          Tilman Hausherr
        2. PDFBOX-3379-solved.pdf
          11 kB
          Tilman Hausherr
        3. PDFBOX-3379-chinese-bad.pdf
          11 kB
          Tilman Hausherr
        4. PDFBOX-3379-chinese-good.pdf
          11 kB
          Tilman Hausherr
        5. VeraMono.ttf
          48 kB
          Christian Maierhofer
        6. DejaVuSansMono.ttf
          310 kB
          Christian Maierhofer
        7. TTFFontTestPDFBox2.java
          1 kB
          Christian Maierhofer
        8. doTest.pdf
          9 kB
          Christian Maierhofer

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              maifi Christian Maierhofer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: