10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.6 Addressing Characters and GlyphsSome environments require the programmer to write source code in 8-bit encodings(such as winansi, macroman, or ebcdic). This makes it cumbersome to include isolatedUnicode characters in 8-bit encoded text without changing all characters in the text tomulti-byte encoding. In order to aid developers in this situation, PDFlib supports severalauxiliary methods for expressing text.4.6.1 Escape SequencesPDFlib supports a method for easily incorporating arbitrary values within text stringsvia escape sequences (similar sequences are supported in many programming languages).For example, the \t sequence in the default text of a text block can be used to includetab characters which may not be possible by direct keyboard input. Similarly, escape sequencesare useful for expressing codes in symbol fonts.Escape sequences are a shortcut for creating certain byte values. The values createdfrom escape sequences will always be interpreted in the selected encoding (unlike characterreferences, which will always be interpreted in Unicode). The byte values resultingfrom resolving escape sequences are listed in Table 4.7; some differ between ASCII andEBCDIC platforms. Only byte values in the range 0-255 can be expressed with escape sequences.Table 4.7 Escape sequences for byte valuesSequenceMac, Windows,Linux, UnixEBCDIC platforms(zSeries/iSeries)common interpretation\f 0C 0C form feed\n 0A 15/25 line feed\r 0D 0D carriage return\t 09 05 horizontal tabulation\v 0B 0B line tabulation\\ 5C E0 backslash\xNN\NNNtwo hexadecimal digits specifying a byte valuethree octal digits (up to \377) specifying a byte valueEscape sequences will not be converted by default; you must explicitly set theescapesequence parameter or option to true if you want to use escape sequences in contentstrings:p.set_parameter("escapesequence", "true");Cookbook A full code sample can be found in the Cookbook topic fonts/escape_sequences.Escape sequences will be evaluated in all content strings, hypertext strings, and namestrings after BOM detection, but before converting to the target format. If textformat=utf16le or utf16be escape sequences must be expressed as two byte values according tothe selected format. If textformat=utf8 the resulting code will not be converted to UTF-8.88 Chapter 4: Unicode and Legacy Encodings

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

Saved successfully!

Ooh no, something went wrong!