Windows first transforms the text data into the encoding format that it uses internally: Unicode, and then follows the Unicode of the text to find the font image in the font file, and finally displays the image to the window. Summarizing the previous analysis, the text should look like this:
- Step 1: The text is first saved in a file with some kind of encoding.
- Step 2:windows Map the text encoding in the file to Unicode.
- Step 3:windows Find the font image in the font file according to Unicode, and draw it onto the window.
The so-called coding is to use numbers to denote characters, for example, "word" with d7d6. Of course, coding also means the convention , that is, everyone recognizes. From "Talking about Unicode encoding," We know that Unicode is also a type of text encoding, which is unique in that it is designed by international organizations and can accommodate all languages in the world. The text encoding we usually use is for a region of language, text design, only support specific language text. For example, in the example above, the file "Example GBK.txt" uses GBK encoding.
If an error occurs at any of the 3 steps above, the text cannot be displayed correctly, for example:
Error 1: If the code is mistaken, such as BIG5 encoded text as GBK encoding, there will be garbled.
Error 2: If a mapping from a specific encoding to Unicode has an error, such as a character not defined in the encoding scheme in the text data, Windows uses the default character, usually.
- If the current font does not support the characters you want to display, Windows displays the default image in the font file: Blank or square.
Reference: http://www.fmddlmyy.cn/text16.html
The display process after Windows reads a text file