[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] Turkish character problem

From: Gregor Mückl
Subject: Re: [ft] Turkish character problem
Date: Tue, 3 Jan 2017 08:14:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 01/02/2017 06:42 PM, ERCAN ARSLAN wrote:
My fonts contain Turkish characters such as ç, ş, ö, ü, ğ , İ , Ö, Ü.

There are no turkish characters in the C header file.

Why does not it create a bitmap of turkish characters.

I want to print turkish characters on my 1.8 TFT lcd screen.

I can not print the C header file as I want on the screen, even if there

are no Turkish characters.


with a quick Google search I determined that you most likely use the Adafruit GFX Library for Arduino. This is important information!

The author of the "fontconvert" program that comes with that library is in a better position to answer your questions correctly than the people on this mailing list. This list concerns itself mostly with the Freetype library, which is used by that program, but written by different people.

From a quick glance over the code of the GFX library I get the impression that the library as a whole is limited to 8 bit character sets. This is a valid decision in the context of a microcontroller with limited resources. There are many more characters in the world's languages than can be represented in 256 character codes. Therefore, different mapping tables have been created for different languages. This is the part where handling characters and text becomes amazingly complicated.

As a rule of thumb, most of these tables share the first 127 characters, but start to differ wildly beyond that. The characters you are asking for are not contained in these common 127 characters. So you need to choose a character encoding which contains the characters you need. A good 8 bit encoding table candidate for Turkish seems to be ISO 8859-3 (also called Latin-3) or ISO 8859-9 (also called Latin-5). Another option is to use Unicode with UTF-8 encoding. I recommand against it, because this character encoding has a variable number of bytes per character and would require considerable changes to the Adafruit GFX Library.

Implementing that encoding requires a list of steps that can be quite tricky, however. You need to accomplish two things here:

- have fontconvert output a font table that correspond to your chosen encoding - have the text strings you want to show to the user in the same encoding in your compiled program.

Unfortunately, this is far trickier than it sounds!

First, you need to extend the fontconvert program to map from the font's character map (most likely Unicode) to Latin-3 or Latin-5. This means that you need to extend the program with a mapping table that contains at least your requested characters.

Second, you need to use a text editor for your program source code that saves the source files in the encoding of your choice. The Arduino IDE does not seem capable of doing this (it looks to be hard-wired for UTF-8). There are many text editors out there that allow you to select the character encoding for a text file. Pick one for your platform, configure it correctly and stick to that configuration religiously once it works. It is usually quite simple to trip up and save a text file in an unwanted encoding, which in turn can cause interesting bugs.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]