Bug 691593 - char_width when call FT_Set_Char_Size
Summary: char_width when call FT_Set_Char_Size
Status: RESOLVED INVALID
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: unspecified
Hardware: PC All
: P4 minor
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-06 08:27 UTC by Flint Ning
Modified: 2011-02-02 15:48 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Flint Ning 2010-09-06 08:27:03 UTC
At the end of loadsimplefont function in pdf_font.c, when no Widths defined in Font Dict, mupdf tries to construct hmtx from font program. The codes of getting advances of glyphs:
504:	else
505:	{
506:		fterr = FT_Set_Char_Size(face, 1000, 1000, 72, 72);
507:		if (fterr)
508:			fz_warn("freetype set character size: %s", ft_errorstring(fterr));
509:		for (i = 0; i < 256; i++)
510:		{
511:			pdf_addhmtx(fontdesc, i, i, ftwidth(fontdesc, i));
512:		}
513:	}

As descibed in FreeType2 doc, the unit of char_width and char_height in FT_Set_Char_Size is "26.6 fractional points". So, char_width and char_height should be 1000*64, not 1000.
Comment 1 Tor Andersson 2011-02-02 15:48:24 UTC
The metrics from ftwidth are not adjusted from fixed point either, so two wrongs make a right in this case. I don't set the character size to 1000*64 because that causes integer overflow problems with some fonts. If you can point me to a specific file that exhibits a bug caused by this, feel free to reopen the bug and attach the PDF.