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.
Query the font-specific name of a glyph specified by code, Unicode value, glyph ID, or<br />
CID:<br />
gn_idx = (int) p.info_font(font, "glyphname", "code=" + c);<br />
gn_idx = (int) p.info_font(font, "glyphname", "unicode=" + uv);<br />
gn_idx = (int) p.info_font(font, "glyphname", "glyphid=" + gid);<br />
gn_idx = (int) p.info_font(font, "glyphname", "cid=" + cid);<br />
/* retrieve the actual glyph name using the string index */<br />
gn = p.get_parameter("string", gn_idx);<br />
Checking glyph availability. Using info_font( ) you can check whether a particular font<br />
contains the glyphs you need for your application. As an example, the following code<br />
checks whether the Euro glyph is contained in a font:<br />
/* We could also use "unicode=U+20AC" below */<br />
if (p.info_font(font, "code", "unicode=euro") == -1)<br />
{<br />
/* no glyph for Euro sign available in the font */<br />
}<br />
Cookbook A full code sample can be found in the Cookbook topic fonts/glyph_availability.<br />
Alternatively, you can call info_textline( ) to check the number of unmapped characters<br />
for a given text string, i.e. the number of characters in the string for which no appropriate<br />
glyph is available in the font. The following code fragment queries results for a<br />
string containing a single Euro character (which is expressed with a glyph name reference).<br />
If one unmapped character is found this means that the font does not contain<br />
any glyph for the Euro sign:<br />
String optlist = "font=" + font + " charref";<br />
if (p.info_textline("€", "unmappedchars", optlist) == 1)<br />
{<br />
/* no glyph for Euro sign available in the font */<br />
}<br />
5.6.3 Querying Codepage Coverage and Fallback Fonts<br />
info_font( ) can also be used to check whether a font is suited for creating text output in<br />
a certain language or script, provided the codepage is known which is required for the<br />
text. Codepage coverage is encoded in the OS/2 table of the font. Note that it is up to the<br />
font designer to decide what exactly it means that a font support a particular codepage.<br />
Even if a font claims to support a specific codepage this does not necessarily mean that<br />
it contains glyphs for all characters in this codepage. If more precise coverage information<br />
is required you can query the availability of all required characters as demonstrated<br />
in Section 5.6.2, »Font-specific Encoding, Unicode, and Glyph Name Queries«, page<br />
147.<br />
The following fragment checks wheth-<br />
Checking whether a font supports a codepage.<br />
er a font supports a particular codepage:<br />
String cp="cp1254";<br />
result = (int) p.info_font(font, "codepage", "name=" + cp);<br />
5.6 Querying Font Information 147