MTK language and Font Library

Source: Internet
Author: User
Tags vector font
Fonteditor v1.3 is available

Font format conversion: ttf2bdf, bdf2fnt, bdf2fnb, fnt2bdf, fnb2bdf, fnt2fnb, fnb2fnt

Fonteditor
It is a powerful font editing and Conversion Tool, supporting 32*32 full font. The TTF and OTF Vector Fonts can be converted to BDF fonts, so that Windows
The vector font that has been installed in the system is converted to the BDF font, And the TTF and OTF files can be directly converted to the BDF format. Mutual conversion of the BDF, fnt, and FNB file formats is supported.
Windows fonts are used in various embedded systems. Conversion of gb2312, big5, and GBK to ucs2, utf8, and ucs2 and utf8 encoding is supported.

This software has been applied to multiple embedded platforms, such as MTK, Qualcomm, Ti, and Zhan Xun.

Main functions of the software:
1. Font dot matrix editing, supporting 32*32 dot matrix full font
2. Support mutual conversion between BDF, fnt, and FNB formats, and BDF <--> fnt,
BDF <--> FNB, fnt <--> FNB

3. directly convert the TTF and OTF files to the BDF, fnt, and FNB formats.
4. Import TTF and OTF installed in windows into the BDF, fnt, and FNB formats.
5. Export the character lattice as a bitmap file and provide the character lattice width index.
6. Conversion of gb2312, big5, and GBK to ucs2 and utf8 is supported, and mutual conversion of ucs2 and utf8 encoding is supported.

Running Environment: win2003, WINXP, Win2000, NT, winme
Release Notes:
V1.2
(1) mutual conversion of BDF, fnt, and FNB font formats
(2) convert TTF installed in Windows to BDF format
(3) import the TTF file into the BDF, fnt, and FNB formats.
(4) Chinese character code Query

V1.25
(1) Remove invalid characters when the TTF font has been installed in windows and imported to BDF.
(2) Export BDF, fnt, and FNB as bitmap files and character width indexes.
(3) Conversion of gb2312, big5, and GBK to ucs2, utf8, and ucs2 and utf8

V1.25.03
(1) Export a single character as a bitmap file
(2) Solve the Problem of incorrect exported files with less than 256 characters when exporting the bitmap font.
(3) solve the problem that the characters in the export selection are actually exported to all characters.

V1.26
(1) added the character matrix correction function to adjust the dot matrix size and displacement of all characters or the characters on the current page.
(2) fixed the problem that the export bitmap file in v1.25.03 could not exit the program after it was selected.

V1.3
(1) added the bitmap Method for exporting the full font library and supported binary export and ASCII code export.
(2) Enhanced compatibility in reading BDF files
(3) added the function of manually removing invalid characters.

You are welcome to contact me for a three-day experience.

========================================================== ========================================================== =
TTF to BDF

 

Because the TTF font library can be converted to any BDF font library of any size, and the BDF font library that can be found is fixed in size, in actual production of BDF font files, TTF font is also required. The method for converting TTF to BDF is as follows:

./Ttf2bdf source. TTF-P yoursize-O destination. BDF

That is, the source file source. TTF can be converted to a file destination. BDF in yoursize BDF format by using the software ttf2bdf. In the program
How does one convert TTF to BDF? The internal storage structure of TTF is described by 2.2.1 and 2.2.2. For more information, see [3. The core part is
12-byte file table in TTF File Format: The table directories are listed in ascending order by TAG.

 

Type Name Description
Ulong Tag 4-byte identifier
Ulong Checksum Checksum In the table
Ulong Offset Offset of the Start offset of the TrueType font file
Ulong Length Table Length


There is also information about the offset table, including the version number, number of tables, and search range. Portal selection, conversion range.

The operation file table is used to extract the data in the description table and write the data in the format defined by the BDF font to generate the corresponding font. For example, a short C language program is provided, which is used to calculate the position of the current checksum.

Ulong
Calctablechecksum (ulong * Table, ulong length)
{
Ulong sum = 0l;
Ulong * endptr = table + (Length + 3 )&
~ 3)/sizeof (ulong );
While (Table <endptr)
Sum + = * Table ++;
Return sum;
}

This program can be used to separate the information of each font and extract the information of each font from the file to operate on each font. In the process of switching from TTF to BDF, only the window function is used.
Is very inconvenient, the most convenient way is to use the C language to operate the font. I will list the most important parts of the conversion process here.
Values: pixel_size, point_size, resolution_x, resolution_y, font_descent, font_ascent, swidth, dwidth, and bbx.
These values determine the distortion between the final BDF font and TTF font, because TTF is scalable and BDF is fixed in size, so distortion will occur during the conversion process.

 

========================================================== ========================================================== ==========

MTK
I hope you can post it after reading this article.

1
. Mmi_featurespluto.h
(Plutommi/customer/custresource/pluto_mmi)


# DEFINE _ mmi_lang_sm_chinese __
//
Define macro Switch

 

2
. Fontres. c
(Plutommi/customer/lcdresource/mainlcd240x320)


<1>


# Ifdef _ mmi_16x16_chinese_font __


# Include "l_pluto_16x16_ch.h"
//
Introduce font header files


# Else

 


<2>


Const rangedata
Xxx_rangedata [a] = {
...}

 


<3>


Const 2010mtk_gmaxdeployedlangs = 1;

 


<4>


# If defined (_ mmi_lang_sm_chinese __)


Sfontfamily pluto_ch_standardfamily =
{6, {& pluto_ch, & pluto_ch,
& Pluto_ch, & pluto_ch,
& Pluto_ch, & gvirtualkeyboardfont }};


# Endif

 


<5>


# If defined (_ mmi_lang_sm_chinese __)


{


{(Char) 0x80, (char) 0x7b, (char) 0x53, (char) 0x4f, (char) 0x2d, (char) 0x4e, (char) 0x87, (char) 0x65, (char) 0x00, (char) 0x00}, // Language
Name


"* #0086 #", // ssc string name


0,


{& Pluto_ch_standardfamily },


"ZH"


},


# Endif

 

Note: <2>
The font length, width, height, and deviation value,


<3>
Corresponding to the number of languages added,


<4>
Defines the font of a specific module on the interface, such as gvirtualkeyboardfont
Corresponding to the font display problem in the virtual keyboard


<5>
(Mtk_glanguagearray
) Corresponding to the language to be added and Its display order in the mobile phone language list (pay attention to the order of various languages)



The problem we usually encounter is that there is a problem with the font display in some places on the real machine (such as a virtual keyboard or calendar ), each language has a corresponding language family (such as pluto_en_standardfamily
Pluto_ch_standardfamily
), When there is a problem (virtual keyboard), first locate the problematic language (), find the corresponding module in the language used in it (virtual_keyboard_latin
), And modify it. For more information, see copy and modify the corresponding modules in other similar projects (virtual_keyboard_latin
When the font library is missing, add the font library in fontres. C.
Add)

 

MTK
Multi-language experience

I,

Port multiple languages

Porting a multi-country language mainly involves migrating mmi_features.h (
Macro Control definition file of the entire project)
, Fontres. C (
Font Resource files)
And add the corresponding font file.

1
,

Macro language control Modification

In mmi_features.h
The switch used to control various languages is similar to _ mmi_lang_english __
To open the macro, the project supports this language. Sometimes, you need to enable some macros related to the language, such as the Arabic encoding mode and the Chinese encoding mode. (Of course, this encoding mode is usually set up, but there are some exceptions. you can do it yourself)

2
,

Font File Addition

In the MTK
In, the font library is mainly two files, one is *. h
File, there is also a corresponding fontres. c
File.

① Font acquisition

There are two methods: 1
Directly go to the Internet to find the font files of the corresponding language. 2
) Use MTK
MCT provided by the company
6.0
Tool to create a font. However, mct6.0
To create a font, use. BDF.
The source file of the dot matrix font, which can be found on the Internet is basically. TTF
Vector font file, which requires the TTF
Convert files to BDF
Third-party software of the file, and the conversion will directly affect the final use of mct6.0
Generated font file (currently we use otf2bdf3
, Free, so the effect is not very good ).



② Font usage. First, let's check MTK.
Rochelle 1_pluto_large.h
The location where it is stored, and then convert our *. h
Also put in the same folder; next we need to put our fontres. c
File and MTK
Original fontres. c
Merge files into a fontres. c
File: For the merge method, refer to the original fontres. C.
The code distribution method of the Chinese and English font of the file is as follows:
The code in the file is written into MTK using macro-control language.
Original fontres. c
File.


3
Modify the default display Language



You only need to modify C
:/Neotel26_06b_w07.20.mp.v21_mmi/custom/APP/neotel26 _

06b_bb
Nvram_cust_pack.c under this directory
File (for different versions, the file is located in different locations. Here it is 6225.
). The file contains the following:


0x00,

This 0x00
A value is used to set the location of a language on the language interface. If you want to change the default display language to simplified Chinese, and set the language interface to 6th
Then we will 0x00
This value is changed to 0x05.
You can.

 

Turn: http://blog.sina.com.cn/s/blog_4cd5d2bb0100jnv4.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.