17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

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.

if (result == -1)<br />

System.err.println("Codepage coverage unknown");<br />

else if (result == 0)<br />

System.err.println("Codepage not supported by this font");<br />

else<br />

System.err.println("Codepage supported by this font");<br />

Retrieving a list of all supported codepages. The following fragment queries a list of<br />

all codepages supported by a TrueType or OpenType font:<br />

cp_idx = (int) p.info_font(font, "codepagelist", "");<br />

if (cp_idx == -1)<br />

System.err.println("Codepage list unknown");<br />

else<br />

{<br />

System.err.println("Codepage list:");<br />

System.err.println(p.get_parameter("string", cp_idx));<br />

}<br />

This will create the following list for the common Arial font:<br />

cp1252 cp1250 cp1251 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 cp874 cp932 cp936 cp949<br />

cp950 cp1361<br />

Query fallback glyphs. You can use info_font( ) to query the results of the fallback font<br />

mechanism (see Section 5.4.6, »Fallback Fonts«, page 139, for details on fallback fonts).<br />

The following fragment determines the name of the base or fallback font which is used<br />

to represent the specified Unicode character:<br />

result = p.info_font(basefont, "fallbackfont", "unicode=U+03A3");<br />

/* if result==basefont the base font was used, and no fallback font was required */<br />

if (result == -1)<br />

{<br />

/* character cannot be displayed with neither base font nor fallback fonts */<br />

}<br />

else<br />

{<br />

idx = p.info_font(result, "fontname", "api");<br />

fontname = p.get_parameter("string", idx);<br />

}<br />

148 Chapter 5: Font Handling (Edition for <strong>COM</strong>, .<strong>NET</strong>, and REALbasic)

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

Saved successfully!

Ooh no, something went wrong!