Post by h***@public.gmane.orgI am porting a PDF generator from the fpdf class to Zend_PDF. The
text input, in English as well as several European languages and
Japanese, is all encoded in UTF-8. European diacritics display
without a hitch in Zend_PDF-generated documents, but Japanese text
renders blank. I've been googling for the past half hour, but have
yet to find anything on this subject.
Zend_Pdf's Unicode support is currently incomplete. It can only
handle Latin-1 characters right now as it lacks the code to generate
a custom Encoding dictionary for a font. We're currently using the
built-in WinAnsiEncoding, hence the Latin-1 limitation (see PDF 1.6
Reference § 5.5.5).
If you're embedding a TrueType font, there is a way to indicate that
the font's cmap tables should be used instead, but this requires
special support within the font program. There is currently no code
to verify that the required support exists. Some PDF generators can
add it if missing, and we could too, but it's a bit of rather
involved code. I eventually want to add support for font subsetting,
which rewrites font programs on-the-fly. When that's done, it will be
easier to add the required cmaps.
Because of the large character sets, CJK (Chinese, Japanese, Korean)
fonts are best handled in PDF as composite (CID-Keyed) fonts, which
use pure Unicode character maps (see PDF 1.6 Reference § 5.6). In
fact, this is a pretty efficient way to handle any non-Latin writing
system, such as Arabic, Hebrew, Thai, et al. It's far easier to
maintain than the myriad of language-specific ISO encodings in the
wild today. CID-Keyed fonts will also make it easier to support
advanced typography features such as ligatures.
CID-Keyed font support is on my personal roadmap for a future
contribution to Zend_Pdf, but I haven't had a project that required
it yet, and free time is scarce. If it's something that you really
need for your current project, I'm available for hire. ;-)
--
Willie Alberty, Owner
Spenlen Media
willie-***@public.gmane.org
http://www.spenlen.com/