SPMA082 August   2021 TM4C1230C3PM , TM4C1230D5PM , TM4C1230E6PM , TM4C1230H6PM , TM4C1231C3PM , TM4C1231D5PM , TM4C1231D5PZ , TM4C1231E6PM , TM4C1231E6PZ , TM4C1231H6PGE , TM4C1231H6PM , TM4C1231H6PZ , TM4C1232C3PM , TM4C1232D5PM , TM4C1232E6PM , TM4C1232H6PM , TM4C1233C3PM , TM4C1233D5PM , TM4C1233D5PZ , TM4C1233E6PM , TM4C1233E6PZ , TM4C1233H6PGE , TM4C1233H6PM , TM4C1233H6PZ , TM4C1236D5PM , TM4C1236E6PM , TM4C1236H6PM , TM4C1237D5PM , TM4C1237D5PZ , TM4C1237E6PM , TM4C1237E6PZ , TM4C1237H6PGE , TM4C1237H6PM , TM4C1237H6PZ , TM4C123AE6PM , TM4C123AH6PM , TM4C123BE6PM , TM4C123BE6PZ , TM4C123BH6PGE , TM4C123BH6PM , TM4C123BH6PZ , TM4C123BH6ZRB , TM4C123FE6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PZ , TM4C123GH6ZRB , TM4C1290NCPDT , TM4C1290NCZAD , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1297NCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C129CNCPDT , TM4C129CNCZAD , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XNCZAD

 

  1.   Trademarks
  2. 1TFT LCD Overview
    1. 1.1 Typical Interfaces
    2. 1.2 Frame Buffer
      1. 1.2.1 Frame Buffer Size Calculation
    3. 1.3 Frame Rate (FPS)
    4. 1.4 Touch Display
  3. 2LCD Controller Overview
    1. 2.1 Block Diagram
      1. 2.1.1 Raster Controller
      2. 2.1.2 LIDD Controller
  4. 3TivaWare Graphics Library (grlib)
    1. 3.1 Graphics Library Structure
      1. 3.1.1 Display Driver Overview
      2. 3.1.2 Low-Level Primitive Graphics API Overview
      3. 3.1.3 Widget API Overview
      4. 3.1.4 Input Driver Overview
  5. 4Display Driver Adaptation
    1. 4.1 Off-Screen Display Drivers
    2. 4.2 Individual Display Driver Functions
      1. 4.2.1 Init
      2. 4.2.2 ColorTranslate
      3. 4.2.3 PixelDraw
      4. 4.2.4 PixelDrawMultiple
      5. 4.2.5 LineDrawH
      6. 4.2.6 LineDrawV
      7. 4.2.7 RectFill
      8. 4.2.8 Flush
  6. 5Fonts
    1. 5.1 Creating Custom Fonts for Different Languages
  7. 6Useful Utilities
    1. 6.1 Pnmtoc
    2. 6.2 mkstringtable and ftrasterize
  8. 7References
  9.   A Appendix A

mkstringtable and ftrasterize

The strings for the application example described in Section 5.1 is saved in the language.csv file (encoded in UTF8 format) to allow accented characters and Asian language ideographs to be included. The mkstringtable tool is used to generate two versions of the string table, one which remains encoded in UTF8 format and the other one that is remapped to a custom codepage allowing the table to be reduce in size compared to the original UTF8 text. The tool also produces character map files listing each character used in the string table. These are then provided as input to the ftrasterize tool which generates two custom fonts for the application, one indexed using Unicode and a smaller one indexed using the custom codepage generated for this string table. The command line parameters required for mkstringtable and ftrasterize can be found in the Makefile in C:\ti\TivaWare_C_Series-2.2.0.295\third_party\fonts\lang_demo.

The ftrasterize utility uses the FreeType font rendering package to convert a font into the format that is recognized by the graphics library. Any font that is recognized by FreeType can be used, which includes TrueType®, OpenType®, PostScript® Type 1, and Windows® FNT fonts. A complete list of supported font formats can be found on the FreeType web site at http://www.freetype.org.

There is an already a language.csv file in the existing \third_party\fonts\lang_demo directory which is created for the lang_demo example described in Table 3-1. The file can be modified for the string table to be used in the example shown in Section 5.1.

  1. Open a command window and go to \third_party\fonts\lang_demo directory.
  2. Create or modify the existing string table source language.csv file and save it in a comma separated values (CSV) file format, which is a plain text file that contains a list of data.
    GUID-20210607-CA0I-TPRN-96WZ-XBHJQJC2NZ9Q-low.jpg Figure 6-3 String Table in CSV Format
  3. At the command line, run the make command. If needed, view the Makefile in the directory for details. The Makefile calls the mkstringtable tool to generate the string table and then use the generated string table as an input to the ftrasterize tool. The ftrasterize tool generates a subset custom fonts based on the string table and the complete font sets (fireflysung.ttf for Chinese characters and NanumMyeongjo for Korean). The original Makefile is intended for the lang_demo example that display the various characters for different languages. For this simple example that is intended to display only English ASCII characters and Chinese characters, only the fireflysung.ttf is required.
    #
    # Build our string table from the CSV file.
    #
    language.c: language.csv
    	 ../../../tools/bin/mkstringtable -u -f language.csv -b language -s utf8 -t
    
    #
    # Build our remapped string table from the CSV file.
    #
    langremap.c: language.csv
    	 ../../../tools/bin/mkstringtable -u -c 0x8000 -f language.csv -b langremap -s utf8 -r
    
    #
    # Build the custom font used by the application based on the output of the
    # mkstringtable step.  We build 2 fonts, one for use with the remapped 
    # string table and the other indexed using normal Unicode codepoints.
    #
    fontcustom14pt.c: language.c AndBasR.ttf fireflysung.ttf  NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
    	../../../tools/bin/ftrasterize -u -c language.txt -r -f custom -s 14 AndBasR.ttf fireflysung.ttf NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
    	
    
    fontcustomr14pt.c: langremap.c AndBasR.ttf fireflysung.ttf  NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
    	../../../tools/bin/ftrasterize -u -c langremap.txt -r -z 0x8000 -f customr -s 14  AndBasR.ttf fireflysung.ttf NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
    
    fontcustom20pt.c: language.c AndBasR.ttf fireflysung.ttf  NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
    	../../../tools/bin/ftrasterize -u -c language.txt -r -f custom -s 20 AndBasR.ttf fireflysung.ttf NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
    
    
    fontcustomr20pt.c: langremap.c AndBasR.ttf fireflysung.ttf  NanumMyeongjo-Regular.ttf sazanami-gothic.ttf	
    	../../../tools/bin/ftrasterize -u -c langremap.txt -r -z 0x8000 -f customr -s 20 AndBasR.ttf fireflysung.ttf NanumMyeongjo-Regular.ttf sazanami-gothic.ttf
  4. For the simple welcome example, copy only the files language.h, language.c, fontcustom14pt.c, and fontcustom20pt.c to the project directory.