English Polski
English Polski

 

 

KazFont - free programmer font for Windows

Up Previous  

5. Flexible encoding selection

If you do not mix language families, you do not need enhanced functionalities of KazFont. But today's software market is international, so sooner or later you will encounter some issues.

The ultimate solution for the following troubles would be to use only Unicode or UTF-8 files and some TrueType font. Unfortunately many compilers do not accept Unicode source files, so usually we use files encoded in any of 8 bit encoding.

5a. KazFont.fon

Every font name contain bitmaps for both Western (CP1252) and Central European (CP1250) encodings. You can choose font script (encoding) through Font Common Dialog.

Font name Font bitmap Encoding name Real encoding
Kaz KazFont Western Western Western
KazFont CE Central European Central European
Kaz 8859 KazFont 8859-1 Western 8859-1
KazFont 8859-2 Central European 8859-2
Kaz UTF8 KazFont UTF8 Western UTF8
Central European UTF8
Kaz Hex KazFont Hex Western Hex
Central European Hex

Why UTF8 and Hex fonts have two encodings ?

There is advanced setting named "Language for non-Unicode programs in "Regional and Language Options" item in the Control Panel. This is the same as preffered encoding of the language.

The system match this preffered encoding with the encoding of the actual font. If a character in preffered encoding isn't available in the font encoding, magic value 7F appears. In the table below you can see the result of this matching while displaying the same ASCII text using different encodings:

Preffered encoding = Western
font = Kaz (Western script) font = Kaz (CE script)
Western script CE script
Preffered encoding = CE
font = Kaz (Western script) font = Kaz (CE script)
Western script CE script

Analogous effect occurs in UTF8 and Hex fonts. Here the magic value is 5F.

Preffered encoding = Western
font = Kaz Hex (Western script) font = Kaz Hex (CE script)
Western script CE script
Preffered encoding = CE
Kaz Hex (Western script) Kaz Hex (CE script)
Western script CE script

When using TrueType Unicode font, you will also get wrong results. Characters belong to the language of the preffered encoding no matter which script is used:

Preffered encoding = Western
font = Courier New (Western script) font = Courier New (CE script)
Western script CE script
Preffered encoding = CE
font = Courier New (Western script) font = Courier New (CE script)
Western script CE script

Here is the example of multilanguage problem. We have two words in Icelandic and in Polish. The languages belong to different encodings. How do this words appear in the editor ?

Correct appearance
Gardabear Wolnosc
Preffered encoding = Western
font = Kaz (Western script) font = Kaz (CE script)
Western script CE script CE script CE script
Preffered encoding = CE
font = Kaz (Western script) font = Kaz (CE script)
CE script CE script CE script CE script

To make things worse, many editors do not present an option to choose the font script. Some editors do not tolerate any font encoding other than Western.

To resolve this issues and to give full control of the encoding, KazFontPlus has been created.

5a. KazFontPlus.fon - the enhanced solution

Every font name contains bitmap for only one encoding, according to the name. You can choose font script (encoding) by choosing the font name. The font encoding information, built into the font, can be different than the real encoding.

Font name Font bitmap Encoding mark Real encoding
Kaz Western KazFont Western Western Western
Kaz Western as CE Central European
Kaz CE KazFont CE Central European Central European
Kaz CE as Western Western
Kaz 8859-1 KazFont 8859-1 Western 8859-1
Kaz 8859-1 as CE Central European
Kaz 8859-2 KazFont 8859-2 Central European 8859-2
Kaz 8859-2 as Western Western
Kaz UTF8 Western KazFont UTF8 Western Western UTF8
Kaz UTF8 CE Central European
Kaz Hex Western KazFont Hex Western Hex
Kaz Hex CE Central European

When using KazFontPlus enhanced fonts, simple choose the font according to your preffered encoding and actual text encoding.

Preffered encoding = Western
font = Kaz Western font = Kaz CE as Western
Western script CE script
Preffered encoding = CE
font = Kaz Western as CE font = Kaz CE
Western script CE script

Correct appearance
Gardabear Wolnosc
Preffered encoding = Western
font = Kaz Western font = Kaz CE as Western
Kaz Western Kaz CE as Western
Preffered encoding = CE
font = Kaz Western as CE font = Kaz CE
CE script CE script


Copyright © 2004-2013 Omega Computer