How does my computer associate a keystroke with a set of pixels corresponding to the keystroke letter on-screen? [closed]

  softwareengineering

For most applications, when you type a key on your keyboard it often prints onto screen the letter corresponding to the keystroke.

By “printing” I mean the set of pixels associated with the keystroke gets displayed on-screen.

How does your computer translate the keyboard input into the pixels you see on the screen?

9

Each letter on the keyboard corresponds to a number that has been assigned to it called a scan code. The operating system software maps this scan code to a Unicode, so when a particular scan code is typed, it knows which character to use.

Unicode is just a standard that allows the computer to associate each character with a number that never changes. This number is different from the scan code, and there are enough numbers in Unicode to assign numbers to the characters in many different languages.

The actual display of the character is carried out with a “font.” In its simplest terms, a font just tells the computer which pixels to turn on or off for a given character.

It has nothing to do with Unicode. Unicode (at least, the core part of it) is simply a mapping from numbers to characters.

What you’re looking for is called a font. Quoth Wikipedia:

A computer font (or font) is an electronic data file containing a set of glyphs, characters, or symbols such as dingbats. Although the term font first referred to a set of metal type sorts in one style and size, since the 1990s it is generally used to refer to a scalable set of digital shapes that may be printed at many different sizes.

LEAVE A COMMENT