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 , TM4C123FE6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PZ , 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

Creating Custom Fonts for Different Languages

Western languages such as English uses letters to compose words. The number of letters or characters in Western languages is generally small and can be easily encoded using 7-bit character encoding scheme such as ASCII. However, languages such as Chinese consists of tens of thousands of characters. A typical font set for Chinese would have taken up enormous amount of memory in the range of megabytes. Certainly, this is not practical for embedded applications.

An application requiring Chinese language may only need to use a small subset of the Chinese characters. For example, if an application only needs to use 100 unique Chinese characters and if these 100 characters are known ahead of time then the programmer can create a custom font that only supports these 100 characters which will result in a small memory footprint. This is the purpose of creating custom fonts for non-Latin languages.

Examine the code snippet of a simple example shown in Figure 5-1 to demonstrate the effect of using custom font. The full source code can be found in Section A.

  1. Start by setting the grlib to use a 20-pt custom font. In this 20-pt custom font, the only supported characters will be “W”, “e”, “l”, “c”, “o”, “m”, “欢”, “迎”, “您”. The last three characters are the Chinese characters for the word “Welcome” in English.

    For how to generate this custom font: see Section 5.1.

  2. Render the string “Welcome” by calling the grlib primitive function. Cross reference to the first row in the display shown in Figure 5-2.
  3. Render the string “abcdefghijklmnopqrstuvWxyz” by calling the grlib primitive function. Cross reference to the second row in the display. It may appear that something is broken but it is not. This is the intention of this example. As mentioned in step 1, a custom font was created that will support only English characters “W”, “e”, “l”, “c”, “o”, “m”. This means the rest of the 20 characters are not displayable as they are not in the font.
  4. Render the string “欢迎您”. Cross reference to the third row in the display. As the font will only support these three Chinese characters, there is no surprise that the string is displayed properly. Any other characters will not be displayed. In order to display other Chinese characters, a new custom font must be generated.
  5. This demonstrates another way to enter the three Chinese characters “欢”, “迎”, “您” by their corresponding UTF-8 character code. Each Chinese character is encoded by a three-byte codepoint in UTF-8. The character “欢” corresponds to UTF-8 “0xe6,0xac,0xa2”. There are various online tools that will convert any characters (Chinese, Japanese and any accented Latin characters) into their corresponding UTF-8 code. For an example, see Figure 5-3.
GUID-20210607-CA0I-5VBJ-KR1F-CMQLQ0B659S8-low.jpgFigure 5-1 Custom Font Demonstration
GUID-20210607-CA0I-T1PJ-FLMS-FFBXMVLLWXXT-low.jpgFigure 5-2 Custom Font Display
GUID-20210607-CA0I-4KT7-4VWB-KVHDNHLZRDSS-low.jpgFigure 5-3 Unicode Converter