PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
0x20 will be interpreted as control characters if the symbolic font does not contain<br />
any glyph for the code. This is true for the majority of symbolic fonts.<br />
Character references. Character references are supported for symbolic fonts. However,<br />
symbolic fonts generally do not include any glyph for the ampersand character U+0026<br />
’&’ which introduces character references. The code 0x26 cannot be used either since it<br />
could be mapped to an existing glyph in the font. For these reasons symbolic fonts<br />
should be loaded with encoding=unicode if character references must be used. Character<br />
references do not work with encoding=builtin.<br />
5.4.3 Example: Selecting a Glyph from the Wingdings Symbol Font<br />
Since there are many different ways of selecting characters from a symbol font and<br />
some will not result in the desired output, let’s take a look at an example.<br />
Understanding the characters in the font. First let’s collect some information about<br />
the target character in the font, using the <strong>Windows</strong> charmap application (see Figure 5.1):<br />
> Charmap displays the glyphs in the Wingdings font, but does not provide any Unicode<br />
access in the Advanced view. This is a result of the fact that the font contains<br />
symbolic glyphs for which no standardized Unicode values are registered. Instead,<br />
the glyphs in the font use dummy Unicode values in the Private Use Area (PUA). The<br />
charmap application does not reveal these values.<br />
> If you look at the lower left corner of the charmap window or hover the mouse over<br />
the smileface character, the Character code: 0x4A is displayed. This is the glyph’s byte<br />
code.<br />
This code corresponds to the uppercase J character in the Winansi encoding. For example,<br />
if you copy the character to the clipboard the corresponding Unicode value<br />
U+004A, i.e. character J will result from pasting the clipboard contents to a text-only<br />
application. Nevertheless, this is not the character’s Unicode value and therefore<br />
U+004A or J can not be used to select it in Unicode workflows.<br />
> The Unicode character used internally in the font is not displayed in charmap. However,<br />
symbolic fonts provided by Microsoft use the following simple rule:<br />
Unicode value = U+F000 + (character code displayed in charmap)<br />
For the smileface glyph this yields the Unicode value U+F04A.<br />
> The corresponding glyph name can be retrieved with a font editor and similar tools.<br />
In our example it is smileface.<br />
You can use info_font( ) to query Unicode values, glyph names or codes, see Section 5.6.2,<br />
»Font-specific Encoding, Unicode, and Glyph Name Queries«, page 147.<br />
Addressing the symbol character with <strong>PDFlib</strong>. Depending on the information which is<br />
available about the target character you can select the Wingdings smileface glyph in several<br />
ways:<br />
> If you know the PUA Unicode value which is assigned to the character in the font you<br />
can use a numerical character reference (see »Numerical character references«, page<br />
114):<br />
<br />
130 Chapter 5: Font Handling (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)