Fundamentals 11 min read

How to Render Chinese Characters on an LCD: Fonts, Bitmaps, and Encoding Explained

This guide explains how LCDs work as LED matrices, how to create and use dot‑matrix font libraries, the various modulo methods for mapping bits to bytes, differences between vector and bitmap fonts, and the Chinese character encodings (GB2312, GBK, GB18030) needed for multilingual embedded displays.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Render Chinese Characters on an LCD: Fonts, Bitmaps, and Encoding Explained

LCD matrix basics

An LCD screen is a matrix of monochrome points. Each point can be either on (1) or off (0), so a single bit represents its state. By grouping bits into bytes, a row of the matrix can be described, and a complete character is rendered by lighting the appropriate points.

Dot‑matrix font representation

For a fixed‑size glyph (e.g., a 16×16 Chinese character), each row uses two bytes (high‑order bit first). The bitmap of the character "德" is stored as a C array of 32 bytes:

unsigned char de_dot[32] = {
    0x10, 0x40, 0x10, 0x40, 0x2F, 0xFE, 0x40, 0x40,
    0x97, 0xFC, 0x14, 0xA4, 0x24, 0xA4, 0x67, 0xFC,
    0xA0, 0x00, 0x2F, 0xFE, 0x20, 0x40, 0x20, 0x24,
    0x25, 0x22, 0x25, 0x05, 0x29, 0x08, 0x20, 0xF8
};

During runtime the array is read bit‑by‑bit and each bit is mapped back to the LED matrix, reproducing the glyph on the screen.

Storing font data

Embed the byte array directly in source code (suitable for a small set of characters).

Store bitmap images and extract glyphs via a custom .FNT file.

Package many glyph arrays into a binary file and locate characters by index.

Use standard font formats such as TrueType (TTF) or BDF.

Bit‑packing (modulo) schemes

Bit‑packing defines how individual bits are ordered inside a byte. A common scheme for Chinese dot‑matrix fonts is horizontal packing with the most‑significant bit first. The packing order must match the way the array was generated; otherwise the displayed glyph will be corrupted.

Typical glyph sizes and ASCII compatibility

Common Chinese glyph sizes are 12x12, 16x16 and 24x24. On a 128×64 LCD, a 12×12 glyph allows five lines of text. ASCII characters usually occupy half the width of a Chinese glyph (e.g., 12×6 for a 12×12 Chinese character, 16×8 for a 16×16 glyph).

Vector fonts and FreeType

Vector fonts describe glyph outlines with mathematical curves (TrueType, OpenType, Type1, etc.). The open‑source FreeType library can rasterize these outlines into bitmaps of any size, which can then be sent to the LCD. Vector fonts enable arbitrary scaling without distortion, although rendering very small sizes may lose detail for complex characters.

Character encodings

Characters are stored as byte sequences according to an encoding. For Chinese text the most widely used standards are:

GB2312 (1981): 7 445 characters, double‑byte encoding.

GBK (1995): Extends GB2312 to 21 003 characters, still double‑byte.

GB18030 (2000): Covers Chinese, Japanese, Korean and minority scripts; uses single‑, double‑ and four‑byte encodings and is backward compatible with GBK/GB2312.

These encodings define a two‑byte region that maps directly to positions in a dot‑matrix font library.

Obtaining bitmap fonts

Bitmap font libraries may be sourced from:

Legacy “Han cards” or other historical computer font dumps (often found on GitHub).

Old DOS fonts such as HZ1616 or HZ1212 (generally GB2312‑compliant).

Extracted bitmap glyphs from TrueType/OTF files using tools like zimo3 or FreeType‑based converters.

Open‑source projects that include English or multilingual bitmap fonts (e.g., tslib).

Open‑source vector fonts such as Google’s Noto (思源) which can be freely converted to bitmap form for embedded use.

When converting a vector font to a bitmap, the resulting bitmap inherits the original font’s license; only fonts released under permissive or open‑source licenses may be used without additional fees.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Ccharacter encodingbitmap fontFreeTypeLCD
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.