CreateFontIndirect() ->
1.:
"If it fails to find an exact match, it provides an alternative whose characteristics match as many of the requested characteristics as possible."
2.:

"The fonts for many East Asian languages have two typeface names: an English name and a localized name.*CreateFont* <https://msdn.microsoft.com/de-de/library/windows/desktop/dd183499%28v=vs.85%29.aspx>and*CreateFontIndirect*take the localized typeface name only on a system locale that matches the language, while they take the English typeface name on all other system locales. The best method is to try one name and, on failure, try the other. Note that*EnumFonts* <https://msdn.microsoft.com/de-de/library/windows/desktop/dd162622%28v=vs.85%29.aspx>,*EnumFontFamilies* <https://msdn.microsoft.com/de-de/library/windows/desktop/dd162619%28v=vs.85%29.aspx>, and*EnumFontFamiliesEx* <https://msdn.microsoft.com/de-de/library/windows/desktop/dd162620%28v=vs.85%29.aspx>return the English typeface name if the system locale does not match the language of the font."
Src:
https://msdn.microsoft.com/de-de/library/windows/desktop/dd183500(v=vs.85).aspx

-> 1:
This means if you e.g. only provide a name and a charset in the LOGFONT struct you can basically get any font on the PC... if the PC doesnt have your exact font.

-> 2:
The program for which i wrote that code is using EnumFontFamilies to show the fonts on the PC to the user. If the user has a japanese system with an english Languangepack. Meiyro and Gothic and other fonts will have japanese name in the UI event though i have a languagepack installed which should switch the locale (im guessing on this one ;D ) Therefore i first look up the locale variant of the font and see if it matches, if it doesnt i look for the english version of the font and use that if it matches. Works like a charm for my Software at least ^_^ (needs a refactor though, i dont like how the code looks...)

TTF:
TTFs are easier to handle because they are not Collections of fonts :D
But actually i dont know that much about how podofo handles them... (maybe only the winApi calls will do the trick?) I only know that no TTF font ever had any problem i know off when used in podofo :D

Greetings Dennis

Am 11.02.2016 um 17:35 schrieb Jaseem Ali K T:
Hi

The fix is probably unsafe, but still I have the following questions(just out 
of curiosity)

Before the call to GetFontFromCollection , two Microsoft functions , 
CreateFontIndirect() and GetFontData are called in order. Of these the first 
function will give ok only if it can find font with characteristics 
provided(font name, style etc), and then we have to pass GetFontData function 
also. So can't we be pretty much sure we have the font we wanted?

,Currently we go only by name in  GetFontFromCollection(as you mentioned). If 
we also check for bold italic etc, wont this give problems in future?
  Because for some fonts italic or bold version may not be available, so we 
will get the regular font instead(I think this is the desired functionality). 
If we tag this as failure here wont it be a problem?

  Are there similar verification done for TTF fonts?    

Thanks and Regards

-----Original Message-----
From: dennis [mailto:dennis.v...@dots.de]
Sent: Wednesday, February 10, 2016 1:22 PM
To: podofo-users@lists.sourceforge.net
Subject: Re: [Podofo-users] TTC Font Support

As i said, a colleague of mine will provide a patch in (hoepfully) short time.

Just setting if(true) is not going to solve the problem. You cant even be sure 
if you have the right font if you always copy the buffer...
Second: the functionalty was build so that it could be refactored to reconize 
bold, italic etc. (it doesnt care about those attributes atm it only goes by 
name).

But well, if your fix fixes your problem for the moment, just remember to 
update if podofo has a new version ;-)




------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to