-3

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?

enderland
  • 12,091
  • 4
  • 51
  • 63
Minh Tran
  • 115
  • 11
  • 2
    Possible duplicate of [How Do Computers Work?](http://programmers.stackexchange.com/questions/81624/how-do-computers-work) – gnat Dec 20 '15 at 14:25
  • 2
    @gnat: That would be a good canonical reference if it actually answered the OP's question, but it doesn't. – Robert Harvey Dec 20 '15 at 14:32
  • 2
    @RobertHarvey it covers the part (of this incredibly broad and vague, [zero effort](http://meta.programmers.stackexchange.com/questions/6559/why-is-research-important) question) that goes between keyboard and software. Another part is likely covered by [How does font rendering actually work?](http://programmers.stackexchange.com/questions/174826/how-does-font-rendering-actually-work) There maybe more to it, hard to tell – gnat Dec 20 '15 at 14:41
  • I'm not sure if this really deserves the downvotes. The answer is simply "There's this thing called a 'font'", which is useful to anyone that lacks the technical background to know that fonts are actual files/programs in computers, not just the set of shapes generated by a computer. I can easily see this as being one of those questions you can't research yourself until you know the magic word that Google is expecting. – Ixrec Dec 20 '15 at 14:42
  • 1
    @Ixrec asker mentioning Unicode is [just one click way](https://en.wikipedia.org/wiki/Unicode#Fonts) from that font thing – gnat Dec 20 '15 at 14:46
  • @gnat I edited this to clarify what I think the real question is asking, which I don't believe is a duplicate of that at all. – enderland Dec 20 '15 at 15:51
  • @gnat I apologize if you believe my question is "vague" and "zero-effort". I'm currently writing code on an arduino to display text on a little 128x64 oLed display. While getting a single pixel to light up, I realized how complicated and time consuming it must be to define a set of pixels in bits/bytes that, for instance, represents the character 'a'. I know a computer does it well but I don't understand what data is stored, how it is accessed, so that the character can be displayed at an arbitrary position. – Minh Tran Dec 21 '15 at 00:43
  • It's difficult for me to formulate a specific question that isn't too vague because I don't know what academic disciplines study such questions nor do I know what topics are relevant. I have a display on which I can put an arbitrary pixel. I can probably create a data structure to store bitmap images of characters (and therefore a character set/arbitrary symbols). But suppose I wanted to display the bitmap image of the letter A rotated 35 degrees clockwise. How do I do such a transformation? – Minh Tran Dec 21 '15 at 00:51
  • Suppose I wanted to "enlarge" the bitmap image of the character 'A'. Is there an algorithm that does that or do I have to create another bitmap version of the character set that is bigger in size? I'm not sure *what* to look into to answer these questions. I can try to figure it out on my own/come up with an implementation but I'd probably be reinventing the wheel. – Minh Tran Dec 21 '15 at 00:54

2 Answers2

2

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.

Robert Harvey
  • 198,589
  • 55
  • 464
  • 673
0

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.

Ixrec
  • 27,621
  • 15
  • 80
  • 87