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

Glyphs rendered in wrong width

    XMLWordPrintableJSON

Details

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

    Description

      Fonts rendered in wrong size. The cause is related to wrong values in the /WIDTHS table and this code in PageDrawer:

                  // stretch non-embedded glyph if it does not match the width contained in the PDF
                  if (!font.isEmbedded())
                  {
                      float fontWidth = font.getWidthFromFont(code);
                      if (fontWidth > 0 && // ignore spaces
                              Math.abs(fontWidth - displacement.getX() * 1000) > 0.0001)
                      {
                          float pdfWidth = displacement.getX() * 1000;
                          at.scale(pdfWidth / fontWidth, 1);
                      }
                  }
      

      I suspect that there must be another condition to skip the stretching, but I didn't find out which one.

      Attachments

        1. PDFJS-7523.pdf
          7 kB
          Tilman Hausherr
        2. PDFJS-5550.pdf
          183 kB
          Tilman Hausherr
        3. gs-bugzilla693663-p9.pdf
          144 kB
          Tilman Hausherr
        4. overlapping.png
          2 kB
          John Hewson
        5. gs-bugzilla693663-p91_part.png
          56 kB
          Andreas Lehmkühler
        6. osx.png
          47 kB
          John Hewson
        7. gs-bugzilla693663-p9-stretchdisabled.png
          33 kB
          Tilman Hausherr
        8. PDFBOX_3457.patch
          5 kB
          John Hewson
        9. PDFBOX-2642-HACK.pdf
          201 kB
          John Hewson
        10. PDFBOX_3457_v2.patch
          11 kB
          John Hewson
        11. bug864847.pdf
          1 kB
          Tilman Hausherr

        Issue Links

          Activity

            People

              tilman Tilman Hausherr
              tilman Tilman Hausherr
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: