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

Create successful ePaper yourself

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

* retrieve the actual glyph name using the string index */<br />

gn = p.get_parameter("string", gn_idx);<br />

Unicode and glyph name queries. info_font( ) can also be used to perform queries<br />

which are independent from a specific 8-bit encoding, but affect the relationship of Unicode<br />

values and glyph names known to <strong>PDFlib</strong> internally. Since these queries are independent<br />

from any font, a valid font handle is not required.<br />

Query the Unicode value of an internally known glyph name:<br />

uv = (int) p.info_font(-1, "unicode", "glyphname=" + gn + " encoding=unicode");<br />

Query the internal glyph name of a Unicode value:<br />

gn_idx = (int) p.info_font(-1, "glyphname", "unicode=" + uv + " encoding=unicode");<br />

/* retrieve the actual glyph name using the string index */<br />

gn = p.get_parameter("string", gn_idx);<br />

5.6.2 Font-specific Encoding, Unicode, and Glyph Name Queries<br />

The following queries relate to a specific font which must be identified by a valid font<br />

handle. The gn variable can be used to supply internally known glyph names as well as<br />

font-specific glyph names. In all examples below the return value -1 means that the font<br />

does not contain the requested glyph.<br />

Query the 8-bit codes for a Unicode value, glyph ID, named glyph, or CID in a font<br />

which has been loaded with an 8-bit encoding:<br />

c = (int) p.info_font(font, "code", "unicode=" + uv);<br />

c = (int) p.info_font(font, "code", "glyphid=" + gid);<br />

c = (int) p.info_font(font, "code", "glyphname=" + gn);<br />

c = (int) p.info_font(font, "code", "cid=" + cid);<br />

Query the Unicode value for a code, glyph ID, named glyph, or CID in a font:<br />

uv = (int) p.info_font(font, "unicode", "code=" + c);<br />

uv = (int) p.info_font(font, "unicode", "glyphid=" + gid);<br />

uv = (int) p.info_font(font, "unicode", "glyphname=" + gn);<br />

uv = (int) p.info_font(font, "unicode", "cid=" + cid);<br />

Query the glyph id for a code, Unicode value, named glyph, or CID in a font:<br />

gid = (int) p.info_font(font, "glyphid", "code=" + c);<br />

gid = (int) p.info_font(font, "glyphid", "unicode=" + uv);<br />

gid = (int) p.info_font(font, "glyphid", "glyphname=" + gn);<br />

gid = (int) p.info_font(font, "glyphid", "cid=" + cid);<br />

Query the glyph id for a code, Unicode value, or named glyph in a font with respect to<br />

an arbitrary 8-bit encoding:<br />

gid = (int) p.info_font(font, "glyphid", "code=" + c + " encoding" + enc);<br />

gid = (int) p.info_font(font, "glyphid", "unicode=" + uv + " encoding=" + enc);<br />

gid = (int) p.info_font(font, "glyphid", "glyphname=" + gn + " encoding=" + enc);<br />

146 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!