You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Aaron Madlon-Kay <aa...@madlon-kay.com> on 2017/11/12 12:46:37 UTC

Re: Creating vertical text

I received some spot-on advice from PDFBox contributor John Hewson, so I wanted to share it in case anyone else has the same issue:

> John Hewson wrote:
> 
> …
> 
> First of all, Identity-V seems like the right approach. PDFBox should be able to handle the basics of vertical text layout using that. However, as you say advanced OpenType features such as GSUB are not supported in PDFBox. That’s because OpenType is not supported in PDF* as it’s too new. So it’s up to the program/library which generates the PDF to apply the positioning or substitution itself and place the correct glyph on the page. PDFBox doesn’t implement that functionality, because it’s pretty complex - though we’d certainly like to!
> 
> * not entirely true, but PDF viewers have very limited support for it.
> 
> The way OpenType Layout works is that there are various abstract "features” which are identified by “tags” such as “vert”. These are simply used as keys to turn on/off various positioning or substitutions, which can be found in the GSUB and GPOS tables, respectively. So when an application wants, say, the vertical version of a font, it enables the “vert” feature by applying all the relevant substitutions/positionings. This could be as simple as a substitution rule which switches a horizontal glyph for a vertical one, or a complex state machine for some Indic language. In the case of “vert”, it’s going to be the former.
> 
> Given that GSUB and GPOS support are not coming to PDFBox anytime soon and assuming that you are just wanting to use a limited set of vertical fonts then I’d recommend “freezing” the “vert” feature into the font. This means creating a special subset of the font which already has the positioning and substitutions applied to the glyphs themselves. The resulting font won’t have any need for GSUB or GPOS tables for “vert” any more, and will only support vertical writing. You can find a tool for generating such fonts here: https://github.com/twardoch/fonttools-utils/tree/master/pyftfeatfreeze
> 
> For debugging, if you’re looking for a tool to inspect the table inside fonts, I recommend the free DTL OTMaster Light available here: http://fontmaster.nl, Microsoft’s OpenType spec is also helpful: https://www.microsoft.com/en-us/Typography/OpenTypeSpecification.aspx


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org