PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
PDFlib 8 Windows COM/.NET Tutorial
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Fonts with encodings other than a CMap can be used for vertical writing mode by<br />
supplying the vertical font option.<br />
> Font names starting with an ’@’ character will always be processed in vertical mode.<br />
Note The character spacing must be negative in order to spread characters apart in vertical writing<br />
mode.<br />
Standard CJK font example. Standard CJK fonts can be selected with the load_font( ) interface,<br />
supplying the CMap name as the encoding parameter. However, you must take<br />
into account that a given CJK font supports only a certain set of CMaps (see Table 6.6),<br />
and that Unicode-aware language bindings support only UCS2-compatible CMaps. The<br />
KozMinPro-Regular-Acro sample in Table 6.6 can been generated with the following code:<br />
font = p.load_font("KozMinPro-Regular-Acro", "UniJIS-UCS2-H", "");<br />
if (font == -1) { ... }<br />
p.setfont(font, 24);<br />
p.set_text_pos(50, 500);<br />
p.show("\u65E5\u672C\u8A9E");<br />
These statements locate one of the Japanese standard fonts, choosing a Unicode CMap<br />
(UniJIS-UCS2-H) with horizontal writing mode (H). The fontname parameter must be the<br />
exact name of the font without any encoding or writing mode suffixes. The encoding parameter<br />
is the name of one of the supported CMaps (the choice depends on the font)<br />
and will also indicate the writing mode (see above). <strong>PDFlib</strong> supports all of Acrobat’s default<br />
CMaps, and will complain when it detects a mismatch between the requested font<br />
and the CMap. For example, <strong>PDFlib</strong> will reject a request to use a Korean font with a Japanese<br />
encoding.<br />
Forcing monospaced fonts. Some applications are not prepared to deal with proportional<br />
CJK fonts, and calculate the extent of text based on a constant glyph width and<br />
the number of glyphs. <strong>PDFlib</strong> can be instructed to force monospaced glyphs even for<br />
fonts that usually have glyphs with varying widths. Use the monospace option of load_<br />
font( ) to specify the desired width for all glyphs. For standard CJK fonts the value 1000<br />
will result in pleasing results:<br />
font = p.load_font("KozMinPro-Regular-Acro", "UniJIS-UCS2-H", "monospace=1000");<br />
The monospace option is only recommended for standard CJK fonts.<br />
6.5.2 Custom CJK Fonts<br />
Note <strong>PDFlib</strong> GmbH offers the MS Gothic and MS Mincho fonts for free download at www.pdflib.com.<br />
<strong>PDFlib</strong> licensees are entitled to use these fonts without having to obtain a separate<br />
font license.<br />
In addition to Acrobat’s standard CJK fonts <strong>PDFlib</strong> supports custom CJK fonts (fonts outside<br />
the list in Table 6.6) in the TrueType (including TrueType Collections, TTC) and<br />
OpenType formats. Custom CJK fonts will be processed as follows:<br />
> If the embedding option is true, the font will be converted to a CID font and embedded<br />
in the PDF output.<br />
> CJK host font names on <strong>Windows</strong> can be supplied to load_font( ) as UTF-16. Non-Latin<br />
host font names are not supported on the Mac, though.<br />
172 Chapter 6: Text Output (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)