[
https://issues.apache.org/jira/browse/PDFBOX-4106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16368124#comment-16368124
]
Aaron Madlon-Kay commented on PDFBOX-4106:
------------------------------------------
[~tilman] {quote}No, I don't have a better solution. I've created a test that
fails if somebody in the future isn't carefully enough.{quote}
I have the best solution: That fixup code is unnecessary; I added it before
implementing subsetting, which I now understand obviates any need for fixing up
at that point in the code. I have prepared a patch to remove it.
{quote}Can you explain the "Trying to un-substitute a never-before-seen gid"
message one gets when using mode 3 in the example, i.e. disabling the two
features? Why is this a "bad" thing / is it a bad thing?{quote}
As I intended it, trying to unsubstitute a gid that has never been substituted
before indicates that something is going wrong: substitution is not really
reversible, so without a cache you can't know the original for a given
substitute. However, as you pointed out, due to the early outs in
{{getSubstitution}} you will get spurious warnings. So I have removed the early
outs so lookups are always cached, and added some documentation.
(What *really* should be done is that whoever called {{getSubstitution}} should
keep a map of originals-to-substitutes, and {{getUnsubstitution}} and even
{{CmapLookup.getCharCodes}} should probably never be called. Or,
{{CmapSubtable}} needs to know about GSUB when it builds its gid-to-charcode
map. All this seemed like too big of a change to tackle just yet.)
I am thinking about how best to test the existing changes and my new fixes. In
the meantime, I wanted to ask: Are you OK with this ticket exploding with more
patch attachments? Or might you prefer to grab from my [git
branch|https://github.com/amake/pdfbox/tree/PDFBOX-4106]?
> Vertical text creation
> ----------------------
>
> Key: PDFBOX-4106
> URL: https://issues.apache.org/jira/browse/PDFBOX-4106
> Project: PDFBox
> Issue Type: New Feature
> Components: FontBox, Parsing, Writing
> Reporter: Aaron Madlon-Kay
> Priority: Major
> Labels: embed, gsub, parsing, vertical
> Attachments:
> 0001-Add-OpenTypeScript-class-to-get-OT-script-tags-for-c.patch,
> 0002-Optimize-Unicode-script-storage-and-lookup.patch,
> 0003-Parse-GSUB-table.patch,
> 0004-Abstract-cmap-lookup-into-an-interface.patch,
> 0005-Implement-GSUB-substitution-on-TrueTypeFont.patch,
> 0006-Use-vhea-vmtx-to-fix-vertical-displacements-in-PCIDF.patch,
> 0007-Add-factory-methods-for-loading-TTF-as-vertical-font.patch,
> 0008-Implement-vertical-metrics-support-when-embedding-subsetting.patch,
> sample_code.txt, vertical.pdf
>
>
> 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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]