I am wondering that is there some difference between character set and fonts in operating system? . I know character set maps set of characters to their integer value but when fonts comes in to the scene I get vague feeling.. . I wonder how they are related ?
Share
Font files contain the information mapping characters (by “index” of the character) to displayable vector or bitmap data. Read http://v1.jontangerine.com/log/2008/08/typeface–font for a better overview.
A character set – see e.g http://www.iana.org/assignments/character-sets/character-sets.xml doesn’t involve the keyboard, it is a map from indices (the integer) to a character (conceptual, not a specific glyph).
The thing you describe is named keymap (afaik).
I think that should be enough for your purpose and give you some pointers to delve deeper if you want to.
UPDATE
The magical chain (probably a little hazy and I didn’t research it, please fix any errors you find):
You press a key on your keyboard – you trigger an interrupt, it’s a key event. I don’t know the wire-protocol between the keyboard and the computer, but I guess it’s just a byte per key, something like 0..127 for key down and -1..-128 for key up.
Your operating system receives an interrupt from the keyboard and updates its internal state, aggregating information like ctrl / shift / alt modifiers pressed, … Knowledge of the layout of your keyboard (keymap) and the charset you use is taken into account, so you get a character (e.g. key event for “a” + “shift” -> “A”, which is easy. But you could also type something like “Ä”, which isn’t contained in every charset and isn’t contained on every keyboard). Now you know which character was pressed. But that’s not something you can display – it’s just a concept (see next step).
If no hotkey handler or whatnot intercepts your key and it gets through to your application, it needs to know what to draw to the screen or printer. “A”s aren’t all alike, if you take two hand-written ones they’ll probably look different. Fonts are used to draw or print something representing the character – the image of the character. For most users and in most programs, font encompasses the look of the characters, the file containing the data to produce it and all variants like regular, bold, italic, caps and combinations thereof.
Type experts (I am not one, just an enthusiast) don’t really like that lack of distinguation.
A typeface is a family of font variants (see above) which are stored in font files containing descriptive data for the glyphs (character with a specific look). The font may also contain kerning (distance between characters), hinting (specifics on how to display it in certain sizes), alternatives (alternate glyphs for a letter) and ligatures (how to combine a group of characters into a single glyph. The different font file formats (truetype, open type, all those web-font formats) have different capabilites.
There’s bitmap fonts for a single resolution which look mushy if they are not displayed in a multiple of the original bitmap. There’s vector fonts containing a mathematical description of their outline which can scale to any resolution you like and may still look crisp (that’s where hinting can be important. And cleartype, antialiasing, subpixel antialiasing).
Fonts can be classified by their look: proportional (“i” is slimmer than “m”) vs monospace (every glyph has the same width), sans serif vs serif. They are classified as font families when they have certain similiarities. grotesque, fracture, symbol, signature, …
That’s all I’ve got for now and I probably didn’t get everything right. But it’s a start. For more details, paste anything bold into your favorite search engine. If you, dear reader, spotted an error: I’d appreciate a comment and will update this.