I work on a MFC C++ Open Source program. I have recently added a feature that puts non-English (in fact - Unicode characters) on controls dervied from the MFC CButton class via setting the font to 'Arial Unicode MS' and using SetWindowText. Each button has 0, 1, 2 or 3 unicode characters (wchar_t) depending on the language.

Having found references to Uniscribe and James' tutorial, is there an easy way to set the displayed characters on a MFC CButton via Uniscribe?

I need this since, a number of QA users, who have this font installed, are getting results back from the start-up font check (using EnumFontFamiliesEx) that this font is not installed!

I assume that it will use some owner draw function . It has to be fairly fast (well, as fast as SetWindowText). I can preprocess all the buttons and save the necessary data for display, if necessary. No text processing is required except displaying the text - i.e. no edit functions, no caret functions etc. etc.

Lastly, would this approach completely remove the need for the user's PC to have this font installed?

Many thanks,

David

A further reason for finding

A further reason for finding another solution is that Arial Unicode MS is a proprietry font that not all users will have - one of the users that the EnumFontFamiliesEx check failed had the font on his system but not 'installed'. Once installed, all was well. However, another user just doesn't have this font.

So I do need a solution to show characters on MFC buttons for many different langauges (only one language per button at any given time) without requiring every user to have this font installed.

I am using C++ VS2005 MFC (not .Net).

David

Buttons are already Unicode?

As long as you use CreateWindowExW (the Unicode version of CreateWindow), or more generally have your program compiled with the UNICODE definition, then your buttons should be Unicode already?

The standard buttons will already be using DrawText (or ExtTextOut) so there should be no need to resort to Uniscribe, as DrawText will handle the Unicode font-display automatically. Send the button a WM_SETFONT message with the font you require, and it should just work, no?

Yes - but...

Yes (and no).

Yes they are Unicode and yes I can/do set the font to be "Arial Unicode MS", which has over 50,000 Unicode symbols. However, this font is Microsoft Propriety. It is there if you use MS Office - but some user's don't have MS Office and it costs 99 USD to licence it from the company Microsoft passed the right to sell it (in my personal view - MS should give it free to the i18n community - but that is only my opinion).

OK - Lucida Sans Unicode is free but, for example, it does not display Japanese or Chinese characters.

This particular requirement is for a Virtual Keyboard for a portable application, where I have the correct characters to display on the keyboard for over 90 keyboards. Therefore, the user could put it on a USB stick and run it on a 'foreign' PC that might not have their home country language or have a font that would display their keyboard. So, I need a way to display all these characters on these keyboards where I do not have to depend on a particular font being installed on the PC the user is running the portable application.

Thanks,

David

bitmaps

Uniscribe is not going to help you in this case. If the user doesn't have the correct font installed, then there is no way to display the characters you want. If you are displaying single characters (glyphs) then I would suggest storing bitmaps of all the characters you want to display, this will ensure that you can display any character without the font being installed.

If you are able to bundle any

If you are able to bundle any fonts, then you can "temporarily" install them with AddFontResource[Ex], then create a logical object with CreateFont and use that to paint with. Then call RemoveFontResource[Ex] when you are done with them.

Microsoft Visual C++ 2008

Microsoft Visual C++ 2008 Express is currently available for download virtual private servers, free of charge, from Microsoft's site. It allows you to create programs for backup of .NET framework as well as native Win32 programs. It comes with an optimizing C++ compiler, linker, debugger, static libraries (including the Standard C++ Library and STL), and Microsoft SQL Server 2005 Express Edition credit card processing.

good

You will surprise to find the high quality tiffany jewelry in much.Everyone will focus on the shinning of
tiffany co jewelry without awareness of
rovide 100% sterling silver Tiffany jewelry,you can buy discount Tiffany & Co jewelry here.Tiffany And Co Jewelry is the best jewellry.
discount tiffany jewelry, Tiffany Jewelry, Tiffany Jewellery, Tiffany Silver, Tiffany, Tiffanys, Tiffany's Jewelry.We Provide a wide range of fashionable
tiffany co jewelry, including
In 1950 Tiffany's had its biggest boost in popularity as Truman Capote's Breakfast at Tiffany's was published. Tiffany's was shot to worldwide fame in 1961 when the film adaptation staring Audrey Hepburn was released. This film and its star became icons, as did Tiffany's
Tiffany Bracelets
Tiffany Rings
cheap tiffany with.Discounted Tiffany & Co silver jewelries are provided in our Tiffany’s online outlet store
Tiffany Earrings
Tiffany Necklaces
Links Of London
Links Of London

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.