Hello, Mr. TrueType Font. Do you support Bengali?

by Michael S. Kaplan, published on 2007/03/26 11:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/03/26/1952689.aspx

Torifat asks:

Hi Michael,

I'm a vb programmer (You can assume me as a neophyte user :)). I want to get the name of those fonts, whose glyphs contain Bengali characters...

I've tried some codes [IMLangFontLink::GetFontCodePages and ...] from your blog but probably I've made some mistake...

Please, Can you assist me something...

[Sorry for my poor English :(]

For Bengali, IMLangFontLink::GetFontCodePages is not such a great bet, since Bengali is not a part of any code page the method would recognize. A better bet is IMLangFontLink2::GetFontUnicodeRanges.

But to be honest, and even better bet is the GDI function GetFontUnicodeRanges (although the function is not supported until Windows 2000, the truth is that adequate Bengali support is not available in fonts or in Uniscribe until the version that shipped with XP SP2, and the Vista version is a significant update to that).

There is even as VB sample using the GetFontUnicodeRanges function on vbmonster.com right here, which takes care of the bulk of the hard parts (all that is left is the font enumeration, the selecting a font into an HDC, and then looking through the WCRANGE array for Bengali character support.

More advance usage would be to look for OpenType support, which when you consider how important it can be for Bengali that has a chance of looking right. You know, like the various OpenType features/layout tables that are needed:

But to be honest, while GetFontData is perhaps something that can be tamed without too much difficulty (like I did here), that is far cry from knowing what are the right OpenType tables to look at. You would have to do a whole bunch of digging into the OpenType Specification, and the info on the Bengali script in particular.

All to learn that the font you are looking for is Vrinda, which this post would have told you. :-)


This post brought to you by ржд (U+09a4, a.k.a. BENGALI LETTER TA)

rifat on 28 Mar 2007 11:49 AM:

Dear Michael, Thanks for your valuable reply :D

rifat on 28 Mar 2007 4:42 PM:

Eureka ;), I've done it. Thanks again... But Can you explain me-

Private Type typWCRANGE

iLow As Integer

iGlyphs As Integer

End Type

Michael S. Kaplan on 28 Mar 2007 5:18 PM:

Just the VB-ized version of the WCRANGE structure....

go to newer or older post, or back to index or month or day