Wingding font

68 views
Skip to first unread message

Emad Steitieh

unread,
Mar 8, 2008, 3:32:51 PM3/8/08
to lib...@googlegroups.com
Hi,
 
I am using LibHaru in a custom application to export output to PDF. The customer complained that when using Wingding truetype font, the application crashes when exporting to PDF. Does this issue has a workaround?
 
Regards,
Emad
 

Antony Dovgal

unread,
Mar 9, 2008, 4:06:21 PM3/9/08
to lib...@googlegroups.com

Do you have a reproduce case or at least a backtrace?

--
Wbr,
Antony Dovgal

Emad Steitieh

unread,
Mar 9, 2008, 4:31:43 PM3/9/08
to lib...@googlegroups.com
I can reproduce it all the time when adding text with Wingding font (actually produces little figures instead of characters). The call stack shows:
 
ErrorHandler
HPDF_CheckError
HPDF_LoadTTFFontFromFile
 
The error handler is called inside HPDF_LoadTTFontFromFile at the following point

if (HPDF_Stream_Validate (font_data)) {

    ret = LoadTTFontFromStream (pdf, font_data, embedding, file_name);

}

else

    ret = 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 4191

Inside 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

Antony Dovgal

unread,
Mar 9, 2008, 4:44:17 PM3/9/08
to lib...@googlegroups.com
On 09.03.2008 23:31, Emad Steitieh wrote:
> I can reproduce it all the time when adding text with Wingding font
> (actually produces little figures instead of characters). The call stack
> shows:
>
> ErrorHandler
> HPDF_CheckError
> HPDF_LoadTTFFontFromFile

I still need a short reproduce code to be able to replicate & debug the issue myself.

--
Wbr,
Antony Dovgal

Emad Steitieh

unread,
Mar 9, 2008, 5:11:43 PM3/9/08
to lib...@googlegroups.com

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
 
Regards,
Emad


 
On 3/9/08, Antony Dovgal <to...@daylessday.org> wrote:

Antony Dovgal

unread,
Mar 9, 2008, 5:27:40 PM3/9/08
to lib...@googlegroups.com
Thanks, I'll take a look at it.

On 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

Antony Dovgal

unread,
Mar 9, 2008, 5:41:35 PM3/9/08
to lib...@googlegroups.com
On 08.03.2008 23:32, Emad Steitieh wrote:

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

Emad Steitieh

unread,
Mar 10, 2008, 1:12:49 AM3/10/08
to lib...@googlegroups.com
The crashing part is my application fault since it should check for the return value in HPDF_LoadTTFontFromFile before using it. I will correct that. But, the text with this font won't appear in my PDF document, is there a way we can workaround this issue?


 
On 3/9/08, Antony Dovgal <to...@daylessday.org> wrote:

Emad Steitieh

unread,
Mar 10, 2008, 1:17:31 AM3/10/08
to lib...@googlegroups.com
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?
 
Regards,
Emad

 
On 3/9/08, Antony Dovgal <to...@daylessday.org> wrote:

Antony Dovgal

unread,
Mar 11, 2008, 4:49:34 AM3/11/08
to lib...@googlegroups.com
On 10.03.2008 08:12, Emad Steitieh wrote:
> The crashing part is my application fault since it should check for the
> return value in HPDF_LoadTTFontFromFile before using it. I will correct
> that. But, the text with this font won't appear in my PDF document, is there
> a way we can workaround this issue?

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

Reply all
Reply to author
Forward
0 new messages