::pdf4tcl::createFontSpecEnc may check for maximum codepoint count
Brought to you by:
pspjuth
Hi Peter,
thanks for great PDF4TCL !
It would be great, if ::pdf4tcl::createFontSpecEnc could check, if the provided codepoint list has 256 max.
Currently, more are accepted but result in an invalid PDF.
My test is as follows and tries to output chinese characters on Windows platform:
set Text ""
for {set i 0} {$i < 256} {incr i} {
append Text [format %c [expr {$i+0x4e00}]]
}
pdf4tcl::loadBaseTrueTypeFont BaseChina1 {C:\Windows\Fonts\MSYH.TTC}
set TextList [lsort -unique [split $Text ""]]
set subset [lmap c $TextList {scan $c %c}]
pdf4tcl::createFontSpecEnc BaseChina1 CombinedChina1 $subset
pdf4tcl::new PDFobj -compress 0 -paper a4 -unit mm
PDFobj setFont 9 CombinedChina1
PDFobj drawTextBox 20 20 160 200 $Text
PDFobj write -file exp2fonts.pdf
PDFobj destroy
This creates an invalid PDF with an error message in Acrobat Reader.
If only 255 characters are used (the 256 is replaced by 255), then a valid PDF is created.
Take care,
Harald