Do you have a reproduce case or at least a backtrace?
--
Wbr,
Antony Dovgal
ret = LoadTTFontFromStream (pdf, font_data, embedding, file_name);
}
elseret = NULL;
The HPDF_Stream_Validate returns TRUE, then calling LoadTTFontFromStream. The ret from LoadTTFontFromStream is NULL. I traced inside this function and found the following information:def = HPDF_TTFontDef_Load (pdf->mmgr, font_data, embedding);
The def returned from this function is NULL. I passed TRUE for the embedding parameter and this is the first time the font is embedded.
I traced further inside HPDF_TTFontDef_Load and found that the function fails at:
ret = LoadFontData (fontdef, stream, embedding, 0);
The ret value is 4191 decimal
I stepped inside LoadFontData and found that the function fails at:
if
((ret = ParseCMap (fontdef)) != HPDF_OK) returning 4191Inside ParseCMap it cannot find a unicode or a byte map and returning invalid format.
The font displays correctly on the screen
Hope this helps
Regards,
Emad
I still need a short reproduce code to be able to replicate & debug the issue myself.
--
Wbr,
Antony Dovgal
HPDF_Doc pdf;
HPDF_Page page;
const char *detail_font_name;pdf = HPDF_New (error_handler, NULL);
if (!pdf) { return 1;}
page = HPDF_AddPage (pdf);
detail_font_name = HPDF_LoadTTFontFromFile (pdf,
"C:\\WINDOWS\\fonts\\WINGDING.TTF", HPDF_TRUE); // here detail_font_name is NULL. This is where the failure happenOn 10.03.2008 00:11, Emad Steitieh wrote:
> HPDF_Doc pdf;
>
> HPDF_Page page;
>
> const char *detail_font_name;
>
> pdf = HPDF_New (error_handler, NULL);
>
> if (!pdf) {
>
> return 1;
>
> }
>
> page = HPDF_AddPage (pdf);
>
> detail_font_name = HPDF_LoadTTFontFromFile (pdf,
> "C:\\WINDOWS\\fonts\\WINGDING.TTF", HPDF_TRUE);
> // here detail_font_name is NULL. This is where the failure happen
--
Wbr,
Antony Dovgal
wingding.ttf appears to be special font and it doesn't contain Unicode cmap
which is required for obvious reason.
Hence ParseCMAP() function fails, the error handler (if any) is called and the
result of HPDF_LoadTTFontFromFile() is NULL.
I'm not sure what you meant by applications crashes, though.
Could you elaborate?
--
Wbr,
Antony Dovgal
No, not that I know of.
> Also, one thing I noticed in ParseCMAP that there are 2 cmaps in the font
> file, but they cannot be handled in the function. Is there away we can
> extend ParseCMAP to handle the two special cmaps?
I'd appreciate if you look into this issue.
But to my understanding regular character maps are required to write using
the font, since you're supposed to write _text_, not some special symbols.
--
Wbr,
Antony Dovgal