DynaPDF Manual - Page 458

Previous Page 457   Index   Next Page 459

Function Reference
Page 458 of 839
was used, the array contains the 8 bit codes which could not be found. If the wide string version was
used the missing 16 bit codes will be returned.
If the active font is a CID font that uses an external CMap, a missing character code was maybe
constructed from a sequence of bytes or from two 16 bit codes (if a wide string function was used).
However, the 32 bit code can be easily converted back to the original code sequence. If the Ansi
version of a string function was used the algorithm looks as follows (C++):
UI32 i, p, value, count;
UI32* missingGlyphs = pdfGetMissingGlyphs(pdf, count);
// More than 4 bytes cannot be encoded in a 32 bit integer
BYTE sequence[4];
for (i = 0; i < count; i++)
{
value = missingGlyphs[i];
p
= 0;
while (value)
{
sequence[p] = (BYTE)value;
value >>= 8;
++p; // This is the string length when the loop returns
}
// You can now process the sequence...
}
Because the wide string versions use 16 bits per character, the conversion looks as follows:
UI32 i, p, value;
// More than two 16 bit values cannot be encoded in a 32 bit integer
UI16 sequence[2];
for (i = 0; i < count; i++)
{
value = missingGlyphs[i];
p
= 0;
shift = 0;
while (value)
{
sequence[p] = (UI16)value;
value >>= 16;
++p; // This is the string length when the loop returns
}
}
All string functions report the warning for a missing glyph only once. For example, if you call
GetTextWidth() with a text like "This is an €uro" and if the Euro character is not available in the font
then a warning is produced. However, if you output the same or another text again that contains the
missing Euro character too then no further warning is produced.
 

Previous topic: GetMissingGlyphs

Next topic: GetMiterLimit, GetMovieAction