prawnpdf / prawn

Fast, Nimble PDF Writer for Ruby
https://prawnpdf.org
Other
4.68k stars 688 forks source link

Support for optical alignment in text blocks #1264

Open odrotbohm opened 2 years ago

odrotbohm commented 2 years ago

Optical alignment is a type setting approach that lets punctuation characters bleed into the text's margins. This might occur at the beginning of a line, in which quotation marks might be shifted a bit left or – and significant if you're using justify alignment and hyphenation – on the end of a line to produce a more homogenous right border.

It would be cool if Prawn supported that. The manual layouting tools I've seen so far (Affinity Publisher et al.) use some default settings (see below) for certain characters.

Screenshot 2022-04-26 at 12 31 09
gettalong commented 2 years ago

This is some rather advanced type of layouting and not seen in many tools. Pull requests for such a feature are definitely welcome but, just to set expectations right, the core team probably won't have time to implement this.

odrotbohm commented 2 years ago

Thanks for the swift feedback. I had hoped you'd answer something different, but was afraid that we're reaching the limits of what can be achieved with a reasonable amount of effort.

gettalong commented 2 years ago

Prawn is not designed to provide high-quality text output out of the box. It provides basic kerning and that's about it. However, since Prawn is quite extendable, one could provide an extension gem that provides all that functionality, probably using information found in the OpenType fonts themselves.