• sales

    +86-0755-88291180

English Character Display Principle

let's learn how ASCII codes are displayed. The following takes the STM32 program of the 2.13-inch e-Paper HAT as an example to explain. To display characters, you must need fonts first. The files of the Fonts directory in the sample program correspond to different fonts. Open the file and you can see a bunch of data.



Each font has a structure that stores information about the font respectively. The structure includes an array pointer, font width, and font height.



The above fonts are copied from the stm32 official sample program. It is an ASCII character. Now let's explain how we make the font. The picture below is the font modulo of the "A" of Font8, we can use the font modulo software to get the data of the A character.



The font data can be got from the font modulo software which extracts the modulo of the font horizontally and vertically and displays each pixel with an array. For instance, if you want to display the "A" character, you can find the data of the "A" character and then display the font modulo point by point.



One thing to note here is the red box, the font array is stored in ASCII order, the first character is a space " ", and the data size of each character is the same. So subtract the ASCII code of the space bar from the ASCII code of A to find the starting position of the data for the character "A".


String display is to display each character.

TAG: Raspberry Pi Triple LCD HAT Arduino 1.54inch OLED SpotPear Raspberry Pi 14 inch LCD 2K HDMI /Type C Display Capacitive TouchScreen 2160x1440 For Jetson Nano/mini Computer PC Arduino Thermal imaging Raspberry Pi 1.5inch LCD Desktop VGA to TTL CAN FD Raspberry Pi 5 8mp Camera Raspberry Pi 5 PCIe to M.2 NVMe SSD Adapter Board HAT Pi5-PCIe-MPS2242-2230-Board Raspberry Pi 0.96inch OLED Industrial-grade isolated 4-way RS485 hub repeater One RS485 TO Four RS485 X1203 Raspberry Pi 5 UPS Board Uninterruptible Power Supply For Li-Battery (NOT includ) Raspberry Pi 5 PoE MINI HAT(G) Power over RJ45 Ethernet 802.3af/at Moudle for Pi5 Raspberry Pi 13.3 inch DSI MIPI Display 13.3inch LCD Capacitive TouchScreen 1920x1080 Industrial Modbus POE ETH RJ45 To Relay 30CH RTU/Modbus TCP-Ethernet For IOT 5inch Raspberry Pi Touch Display 2 5-inch Official Original 720x1280 LCD DSI/MIPI Screen Arduino Board Managers Tutorial User Guide ESP32 S3 Development Board 2.41 inch AMOLED Display 600x450 TouchScreen For Arduino LVGL With SD-Port/ QMI8658C 6-Axis Sensor