Bug 20769

Summary: Incorrect text scaling with substituted fonts on SplashOutputDev.
Product: poppler Reporter: Kesarev Alexander <kav>
Component: splash backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: koleygr, linuxhippy
Version: unspecified   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Invalid text scaling sample. 2nd & 3rd lines

Description Kesarev Alexander 2009-03-20 08:46:42 UTC
In the case when some font, which is substituted, is used inside one text object with several sizes, there can be incorrect text scaling when size is changed.
Sample PDF enclosed.

It seems that the problem concerns the fonts cache in SplashFontEngine. It uses the same FT_Face instance for all the instances of SplashFTFont of the same font. After you use some new size that not in the cache, the new instance of SplashFTFont sets the size into FT_Face. It works well until you try to use another size which was set for that font before. It is found in cache, but different size in FT_Face has already been set by previous SplashFTFont constructor call and that's a problem. It tries to calculate scale for substituted font in SplashOutputDev::doUpdateFont() and uses incorrect width of 'm' character.

I think, it would be nice to add some activation procedure after it find the font in cache.

To solve the problem I added method 
void SplashFTFont::activate() {
	FT_Activate_Size(sizeObj);
}
and corresponding virtual void activate() {} in SplashFont
and call it after the font is found in cache. It seems that it can solve the problem.
Comment 1 Albert Astals Cid 2009-03-20 16:39:14 UTC
the sample pdf got lost, can you add it?
Comment 2 Kesarev Alexander 2009-03-22 23:58:22 UTC
Created attachment 24146 [details]
Invalid text scaling sample. 2nd & 3rd lines
Comment 3 Albert Astals Cid 2009-03-25 14:19:04 UTC
I fixed it in a different way, please check it works for you, see http://cgit.freedesktop.org/poppler/poppler/commit/?id=e4b3f7cbcb6ccdfa8b18d8da5f7074f4140b776a
Comment 4 Kesarev Alexander 2009-03-26 08:00:34 UTC
(In reply to comment #3)
> I fixed it in a different way, please check it works for you, see
> http://cgit.freedesktop.org/poppler/poppler/commit/?id=e4b3f7cbcb6ccdfa8b18d8da5f7074f4140b776a
> 

It works, thanks
Comment 5 Albert Astals Cid 2009-05-19 13:49:20 UTC
*** Bug 21821 has been marked as a duplicate of this bug. ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.