Resending as the previous mail was held because of mail length From: Jaseem Ali K T Sent: Thursday, August 04, 2016 9:27 PM To: podofo-users@lists.sourceforge.net; 'dennis.v...@dots.de' <dennis.v...@dots.de> Subject: RE: [Podofo-users] TTC font related issues in Windows
Hi Please find my fix for the issue. I have tested this with all fonts in my system. This time I have taken some care about the (code format.. tabs , spaces etc,) . Still it may not be perfect. Please let me know if further refactoring required. Regards Ali From: dennis [mailto:dennis.v...@dots.de] Sent: Thursday, July 21, 2016 12:00 PM To: Jaseem Ali K T <jaseemal...@hcl.com<mailto:jaseemal...@hcl.com>> Subject: Re: [Podofo-users] TTC font related issues in Windows Hey, sounds good to me. To be honest: I think that we should let the windows-api do as much work as possible when it comes to fonts, so go for it :-) Just try to test it with different fonts if possible (otherwise i will have to do all the testing ;-) ). Greetings, Dennis Am 20.07.2016 um 20:21 schrieb Jaseem Ali K T: Hi I have a fix ready for the issue, but I have taken slightly different route to fix the issue To get the font buffer we are using the function GetFontData() by windows(https://msdn.microsoft.com/en-us/library/windows/desktop/dd144885(v=vs.85).aspx). For ttc files currently we are taking the entire font file buffer and checking each font to verify if it matches the required font, and once the required font is found, we are creating the buffer for this by adjusting the offsets in the tables , and copying required tables. As per the documentation of GetFontData() for the second parameter dwTable <<If this parameter is zero, the information is retrieved starting at the beginning of the file for TrueType font files or from the beginning of the data for the currently selected font for TrueType Collection files. To retrieve the data from the beginning of the file for TrueType Collection files specify 'ttcf' (0x66637474).>> So if pass zero we will get the data from the beginning of the font required. But this cannot be directly used as the offsets will not be correct. But the job of matching font is done here. So we can copy the table directory table headers from here. And then copy other tables and adjust offsets in similar to way to the existing way. I think this method is better as the job of matching the font will be done by GetFontData(), and we have to worry about only creating the correct buffer.(In matching the font manually we have to worry about the language of the font name , style etc, ) So if this is ok , please let me know .... Additionally ,while loading fonts with freetype when file path is mentioned,(or in other os guess the font manager will provide the path), the face index passed is always zero. This is fine for ttf fonts, But for ttc fonts this will always the give the first font , which may not be correct. So there should be code to handle loading of correct face. Since I am working In windows I can't test this. But I have the observed the behavior when font file path is explicitly passed in windows environment. Regards Ali ::DISCLAIMER:: ---------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ----------------------------------------------------------------------------------------------------------------------------------------------------
PdfFontCache.diff
Description: PdfFontCache.diff
------------------------------------------------------------------------------
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users