Hi,

I'm using PoDoFo to extract character displacement to update a text matrix
correctly. This is a code fragment of mine:

PdfString str, ucode_str;
std::stack<PdfVariant> *stack;const PdfFontMetrics *f_metrics;...
/* Convert string to UTF8 */
str = stack->top().GetString();
ucode_str = ts->font->GetEncoding()->ConvertToUnicode(str,
ts->font);stack->pop();
c_str = (char *) ucode_str.GetStringUtf8().c_str();
/* Font metrics to obtain a character displacement */
f_metrics = ts->font->GetFontMetrics();
for (j = 0; j < strlen(c_str); j++) {
    str_w = f_metrics->CharWidth(c_str[j]);

    /* Adjust text matrix using str_w */
    ...}

It works well for some PDF files (str_w contains a useful width), but
doesn't work for others. In these cases str_w contains 0.0. I took a look
at the PoDoFo 0.9.5 sources and found CharWidth() implemented for all
sub-classes of PdfFontMetrics.

Am I missing something important during this string conversion?

-- 
Kind regards,

Dmitry Salychev
darkness....@gmail.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to