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

Vertical text creation

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Patch

    Description

      I needed to output vertical Japanese text, but was stymied by several limitations:

      • No API to load a TTF as Identity-V encoding
      • No support for 'vert' glyph substitution
      • No support for vertical metrics ('vhea' and 'vmtx' tables are parsed but not used at all)

      I have attached a series of patches that implement the above features. Highlights:

      • The GSUB glyph substitution table is parsed (limitation: type 1 lookups only; this is sufficient for many features including 'vert'/'vrt2' vertical glyph substitution)
      • Cmap lookup makes use of GSUB when features are enabled on a TTF
      • 'vhea' and 'vmtx' metrics are applied to PDCIDFont when appropriate, and are embedded/subsetted correctly through the DW2/W2 CIDFont dictionary
      • An API has been added for loading a TTF as a vertical font, setting Identity-V encoding and enabling 'vert'/'vrt2' substitution

      Each patch could approximately be split out into a separate ticket, if desired.

      Also attached is some sample code that exercises these patches and illustrates the effect of vertical glyph positioning. The sample output PDF is also attached.

      Attachments

        1. FIX-0001-PDFBOX-4106-Remove-early-outs-leading-to-spurious-wa.patch
          2 kB
          Aaron Madlon-Kay
        2. FIX-0003-PDFBOX-4106-Correct-deltaGlyphID-data-size.patch
          2 kB
          Aaron Madlon-Kay
        3. FIX-0006-PDFBOX-4106-Fix-non-embedded-vertical-font-rendering.patch
          1 kB
          Aaron Madlon-Kay
        4. FIX-0002-PDFBOX-4106-Document-GlyphSubstitutionTable-public-m.patch
          2 kB
          Aaron Madlon-Kay
        5. FIX-0008-PDFBOX-4106-Rename-misleading-field.patch
          2 kB
          Aaron Madlon-Kay
        6. FIX-0010-PDFBOX-4106-Correct-vmtx-embedding-for-proportional-.patch
          15 kB
          Aaron Madlon-Kay
        7. FIX-0004-PDFBOX-4106-Remove-unnecessary-vertical-displacement.patch
          8 kB
          Aaron Madlon-Kay
        8. FIX-0009-PDFBOX-4106-Allow-retrieving-vmtx-topSideBearing.patch
          1 kB
          Aaron Madlon-Kay
        9. FIX-0005-PDFBOX-4106-Remove-duplicate-DW2-creation.patch
          1 kB
          Aaron Madlon-Kay
        10. FIX-0007-PDFBOX-4106-Fix-incorrect-parsing-of-W2-first-format.patch
          1 kB
          Aaron Madlon-Kay
        11. 0008-Implement-vertical-metrics-support-when-embedding-subsetting.patch
          11 kB
          Maruan Sahyoun
        12. 0001-Add-OpenTypeScript-class-to-get-OT-script-tags-for-c.patch
          179 kB
          Aaron Madlon-Kay
        13. 0003-Parse-GSUB-table.patch
          27 kB
          Aaron Madlon-Kay
        14. 0002-Optimize-Unicode-script-storage-and-lookup.patch
          4 kB
          Aaron Madlon-Kay
        15. 0004-Abstract-cmap-lookup-into-an-interface.patch
          12 kB
          Aaron Madlon-Kay
        16. 0005-Implement-GSUB-substitution-on-TrueTypeFont.patch
          5 kB
          Aaron Madlon-Kay
        17. 0006-Use-vhea-vmtx-to-fix-vertical-displacements-in-PCIDF.patch
          7 kB
          Aaron Madlon-Kay
        18. 0007-Add-factory-methods-for-loading-TTF-as-vertical-font.patch
          8 kB
          Aaron Madlon-Kay
        19. sample_code.txt
          2 kB
          Aaron Madlon-Kay
        20. vertical.pdf
          13 kB
          Aaron Madlon-Kay

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tilman Tilman Hausherr
            amake Aaron Madlon-Kay
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment