10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.3 Strings in PDFlib4.3.1 String Types in PDFlibPDF and operating system requirements impose different string handling in PDFlib dependingon the purpose of a string. The PDFlib API defines and uses the following stringtypes:> Content strings: these will be used to create genuine page content (page descriptions)according to the encoding chosen by the user for a particular font. All text parametersof the page content functions fall in this class.> Hypertext strings: these are mostly used for interactive features such as bookmarksand annotations, and are explicitly labeled Hypertext string in the function descriptions.Many parameters and options of the functions for interactive features fall inthis class, as well as some others.> Name strings: these are used for external file names, font names, block names, etc.,and are marked as name string in the function descriptions. They slightly differ fromHypertext strings, but only in language bindings which are not Unicode-aware.Content strings, hypertext strings, and name strings can be used with Unicode and 8-bitencodings. Non-Unicode CJK CMaps can only be used in non-Unicode-compatible languagebindings. The details of string handling depend on the language binding, and arediscussed in Section 4.3.2, »Strings in Unicode-aware Language Bindings«, page 76 andSection 4.3.3, »Strings in non-Unicode-aware Language Bindings«, page 77.4.3.2 Strings in Unicode-aware Language BindingsIf a development environment supports the string data type, uses Unicode internally,and the corresponding PDFlib language wrapper supports the language’s Unicodestrings we call the binding Unicode-aware. The following PDFlib language bindings areUnicode-aware:> COM> .NET> Java> Python> REALbasic> RPG> TclString handling in these environments is straightforward: all strings will automaticallybe provided to the PDFlib kernel as Unicode strings in native UTF-16 format. The languagewrappers will correctly deal with Unicode strings provided by the client, and automaticallyset certain PDFlib parameters. This has the following consequences:> The PDFlib language wrapper applies all required conversions so that client-suppliedhypertext strings will always arrive in PDFlib in utf16 format and unicode encoding.> Since the language environment always passes strings in UTF-16 to PDFlib, UTF-8 cannot be used with Unicode-aware languages. It must be converted to UTF-16 before.> Using unicode encoding for the contents of a page is the easiest way to deal with encodingsin Unicode-aware languages, but 8-bit encodings and single-byte text forsymbol fonts can also be used if so desired.76 Chapter 4: Unicode and Legacy Encodings

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!