C++/Unicode character print using C or C++
I want to print some unicode character(of Hindi language) as output. what are the procedure I have to follow? Is there any library function or header file for Unicode character printing. Please help me. if possible please give some example. Thank you in advance.
This is really not my expertise, but I will try to help as much as I can.
The first thing you will have to do is set your machine to be able to type Hindi fonts. You may already know this, but I am not sure from the question whether you do or not. I do not have access to a system that is set up to type Hindi fonts. Even so, if you know the two byte code (short) for the fonts you want to represent you may not have to have Language support for Hindi fonts. But you will have to use the exact code instead of the actual font (in a string) in a string of such codes. The next thing you need is some Hindi fonts. I went on fontfreak.com and I found one Hindi font you can download for free. Then you will have to set the font in your application. Below is a code sample for setting font for a CEditView in Visual C++:
// TODO: Add your specialized code here and/or call the base class
CEdit &curEditor = GetEditCtrl();
CFont *SimpleFont = new CFont;
SimpleFont->CreatePointFont(120, "Times New Roman");
Finally you will declare the character strings in the code. Unicode characters are two bytes long each not the one byte characters of the ASCI character string. Below, is a coding sample that will help you set that up in the code:
#define _UNICODE // Tell C we're using Unicode, notice the _
#include <tchar.h> // Include Unicode support functions
typedef unsigned short wchar_t;
#define UNICODE // No underscore this time
wchar_t mystring = _TEXT("flipcode");
I hope this helps you. I tried to cover all bases.
Also, you can create your own characters. You will find the format of a font file at http://support.microsoft.com/kb/65123
. You can also use software applications to help you create your fonts http://desktoppub.about.com/gi/dynamic/offsite.htm?zi=1/XJ/Ya&sdn=desktoppub&zu=
. First you get bitmap images of each character, then you put each on into the software to represent each character. The example I saw was mapping English characters, however.