Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm working on TFT. I'm supposed to display hindi fonts. How to go for it. It is not so as english fonts. when i researched in internet, i found that the technique it follows is unicode. what is it, how to start for it. Kindly help.
Posted
Comments
Sergey Alexandrovich Kryukov 31-Jul-12 1:08am    
Everything is Unicode these days, even English. What's the problem?
--SA

What's the problem, hard to read about Unicode, while nearly everything uses it?

http://en.wikipedia.org/wiki/Unicode[^],
http://unicode.org/[^].

You profile tells us that you are from India. I can never understand Indian software developers (!) who don't even know that there is no such thing as "Hindi font". Such thing cannot exist, because modern Hindi is just one of the several languages using Devanagari script, notably, including Sanskrit. And this script is more than popular; it is supported by default by nearly every modern system.

I don't know how else to help as you did not share what exactly you need to achieve, but most likely, this is something quite trivial. If you face any problems, please feel free to ask more specific questions.

As to Devanagari, Hindi and other languages and related matter, I think that the richest Indian culture, your own native culture and the culture of your neighbors deserve way more respect.

—SA
 
Share this answer
 
v3
Well, Unicode is a method by which many, many different characters may be represented. The english language does not have very many characters - 0-9 (10) plus a-z (26) plus A-Z (26) for a total of 62 characters.

In ASCII text, each character is represented by an 8bit character code - this allows for up to 256 distinct characters. So, english numbers and letters consume 62 of these characters and symbols/line drawing characters/control-codes make up the remaining characters in the set of 256.


Unfortunately, this encoding scheme does not represent all of the different characters that may be found in non-Latin based languages - e.g Chinese, Japanese, Arabic, Hindi characters.

To solve this problem, it was decided that each character should be represented by at least 16 bits - allowing for a minimum of at least 65536 characters.

These (at least) 2-byte long character codes are used to make up the Unicode character set. Well, at least roughly speaking, anyway.



In order to represent a bitmapped font on a screen, we must store 'pictures' of each character in an array - a font. We then use the character code for each letter as an index into that array(font).

To complete this task, I can see two general options.

1) Find and download a bitmapped Hindi font.
2) Create one yourself, using the fonts already installed on your machine.

To do number 2, you have a number of options. You may choose to make each character's bitmap the same width/height, or you may choose to make each character's bitmap just big enough to hold the required bits. Take for example the letters 'i' and 'w', or '.' & 'O' - each of these characters are a different width and height.

It is much simpler to make the character bitmaps all the same size. It looks better if each bitmap is just large enough to hold the character that it represents.

In the first case, you may decide that 16x16 is large enough to represent each character. You just need (num chars in font) * 16x16 bitmap

In the second case, you need for each character in your font to hold both (1) a bitmap and (2) some size information.


If you are programming on Windows, you can get the minimum width and height of each charater by using the DrawText[^] function, specifying the DT_CALCRECT flag. If you loop through all of the characters that you wish to represent, you can one-by-one get the required size, draw the character then make a copy of the char and save it to disk.

It's been over 15 years since I last dealt with bitmapped fonts explicitly, at which time I was plucking them out of the VGA bios in DOS. I hope that my memory is clear enough to give you some direction and a place to start. :)
 
Share this answer
 
hello enhzflep,
Thanks for your answer, I want to give you an overview of the task that I'm supposed to do. My task is to display hindi text on TFT screen,TFT controller is SSD1963. When i was working with english fonts, i downloaded a const array (in C) for all the alphabets [lower case letters (a-z), upper case letters (A-Z), 0-9 & all special characters]. For this const array, i wrote a function, wherein it would read all those characters arrays. When I typed a character 'A' on keyboard, it would read from the font array that I had created, which would match with the ascii value of the letter 'A'.

Now in the same scenario, I'm supposed to display hindi text on TFT screen, when for example I would type letter 'a','aa', 'ka','kaa' it should display corresponding hindi letter. I'm new to this kind of concept. So when i was doing R & D on this I found out about the concept called, "Unicode".

Can I get any help wherein I can get those font arrays, same as I have for english fonts? I searched lots but not able to find them. I also have the bipmap to array converter software, but the problem is, how to map the bitmap arrays that are created with the letters that I type in keyboard? (i.e., it should match with the ascii values of the english letters that I type). Kindly help.
 
Share this answer
 
Comments
Joan M 6-Aug-12 3:39am    
You can answer directly to the person you want, you should not put new parts of the question itself as an answer. This will not work well as there is people that looks for unanswered questions only. You will see "HAVE A QUESTION OR COMMENT" under each message, there is where you should add your questions or comments. enhzflep probably would have not seen this message.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900