pdf-raku / PDF-Content-raku

Basic PDF content editing and rendering support, including text, images, fonts and general graphics
Artistic License 2.0
2 stars 3 forks source link

Detect and avoid broken wordspace handling #2

Closed dwarring closed 6 years ago

dwarring commented 6 years ago

The PDF 32000 spec discusses the limited applicability of the SetWordspace (Tw) operator:

"Word spacing shall be applied to every occurrence of the single-byte character code 32 in a string when using a simple font or a composite font that defines code 32 as a single-byte code. It shall not apply to occurrences of the byte value 32 in multiple-byte codes"

In short, the Tw operator wont work on multibyte encodings, such as Identity-H.

The flow on effect is that text block justification. is breaking for Identity-H encoded fonts loaded by PDF::Font::Loader. In general, we should warn if WordSpacing has been set, but will be ineffective.

This is at least, easily detected.