A
A
Alexander2020-02-15 01:30:47
Programming
Alexander, 2020-02-15 01:30:47

How does the system understand which font glyphs to display to represent a binary number?

Let's say that the binary number 10111111100 (1532 in decimal notation) is stored in memory. But this number must be displayed using glyphs (of some font) corresponding to the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. That is, each of these glyphs has a specific character code, but how does the computer system know to select glyphs 1, 5, 3, and 2? This is a mystery to me.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
mayton2019, 2020-02-16
@mayton2019

It is not clear why the author discusses glyphs and fonts? This task consists of two parts.
1) Converting a binary number (eg int) to a string representation of a binary number.
2) Printing this line on the screen using (or not using) an explicit indication of fonts and so on.
And it seems to me that the author did not solve point (1) of this problem. This item is mandatory in the first lessons of computer science. It's called Number Systems. Positional. Non-positional. Transfer from one system to another and so on. This is where the discussion should start.

X
xmoonlight, 2020-02-15
@xmoonlight

The font stores a character table with pointers to the starting sector of reading a particular character.

R
Roman Mirilaczvili, 2020-02-15
@2ord

Each glyph has a specific code (code point / position) - ASCII number (simplified), by which you can get its graphical representation in the font. When some program needs to display text on the screen (text rendering), which is a sequence of glyph codes, it accesses the font and asks it to give a graphical representation of each of them in turn (turning vector outlines into a raster). Then drawing is performed on a certain area of ​​the screen by system tools (glyph rendering API).
Wikipedia:
ASCII, Unicode, Font rasterization, FreeType
Added in comments.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question