hankivy / text2pdf2

An enhanced version of text2pdf, as in the PDF::API2 perl module at https://cpan.org
GNU General Public License v3.0
0 stars 0 forks source link

No support for cjkfont #4

Open hankivy opened 5 years ago

hankivy commented 5 years ago

The font cjk is not supported. (See PDF::API2 in CPAN.)

The following method is not supported. $font = $pdf->cjkfont($cjkname, [%options])

The documentation in PDF::API2 in CPAN follows:

$font = $pdf->cjkfont($cjkname, [%options]) Returns a new CJK font object.

Examples:

$font = $pdf->cjkfont('korean'); $font = $pdf->cjkfont('traditional');

Valid %options are: -encode
Changes the encoding of the font from its default.

See Also: PDF::API2::Resource::CIDFont::CJKFont

Support could be added in a style similar to the other font support support that currently exists.

  1. Design - Offer changes to documentation to show your design for the commands in the text file. Checkpoint with the owner.

  2. Create text file for testing one CJK font. 2A. Include multiple successful uses, that test a wide range of characters. 2B. Include multiple examples of bad uses, that demonstrate syntax checking, error messages, and out of limit values. A bad use should not result in not processing the rest of the file. 2C. Include text that explains the expected results. 2D. Include text with other currently supported fonts.

  3. Checkpoint once with the owner.

  4. Add code to support that font.

  5. Checkpoint once with the owner.

  6. Test, debug, and correct until the text file and the code are good.

  7. Repeat steps 2, 3, and 4 for any other desired CJK font.

  8. Checkpoint and release with the owner.

PhilterPaper commented 3 years ago

CJK fonts are kind of tricky to use, especially if you're not familiar with the language in question, to see if it's being messed up.

You might want to look at PDF::Builder's support for HarfBuzz::Shaper, and the example given for CJK text (including vertical). It also does bidirectional (RTL) text such as Hebrew and Arabic, and South/Southeast Asian texts.