I am working on a project that includes making some ASCII art, except it isn't true ASCII art since I am using a far amount of Windows Alt codes to make it. Anyways, I wanted to make sure that as I am working on it, that it looks exactly how it will in a windows command prompt terminal session. So since command prompt defaults to the Terminal raster font, I figured I would use that. But I quickly noticed that when I use the Terminal typeface in a text editor, it will not render ASCII codes, either at all (as is the case most of the time) or incorrectly. Now, I understand if a font just doesn't support non-ASCII characters, but what I don't get is how the characters do show up correctly in command prompt when they don't in a text editor. I checked the output of the 'chcp' and it was set to 437 by default, which is what I need. Well, either that or 850 but preferably 437 since they got rid of some of the graphics in 437 and replaced them with other Latin characters. Command prompt terminal settings show I am using the Terminal raster font with a 8x12 glyph size. So I try using size 12 in the text editor but no good, even after switching the text encoding to either MS-DOS OEM-US (supposedly an alternative name for CP437) or UTF-8. I just don't get how I am not getting the characters to show up.
Also, if it helps, the art I am making is basically modified screen shots from a game I play called Dwarf Fortress that uses characters from the Terminal/Curses typeset, or at least that is how it is reported in the forums by those who make graphics sets to replace the default character set. However, the game doesn't actually use the system's Terminal font. The game's data files includes a bitmap image that is a grid of all the characters the game uses. So it uses this bitmap to render graphics instead of the actual font file:
I basically want to get a text editor to make it so if I type up some ASCII art to look like a screenshot from Dwarf Fortress, that it will actually look like Dwarf Fortress other than the lack of color. Any help?
Answer
Possible solutions
If you don't need code page 437 characters 0 to 31, try using Notepad with the Terminal font, and use Alt+032 to Alt+0255 (with leading zeros).
If you want to use code page 437 characters 0 to 31, try opening this file in Notepad with the Terminal font and copy and paste characters that you need. Notepad will interpret character 9 as a tab, and the characters sequences 13 10 and 13 13 10 as an enter. The other characters from 0 to 31 and characters 13 and 10 by themselves will show symbols from the Terminal font.
If you are willing to forego the pixely look of the Terminal font, you can use Notepad with the Lucida Console font and use Alt+1 to Alt+255 to insert Unicode equivalents of the code page 437 symbols. When saving the text file, be sure to choose a Unicode encoding like UTF-8.
More information
In Windows, there is a difference between Alt+1 to Alt+255 and Alt+01 to Alt+0255 (with leading zeros).
- When you press Alt+1 to Alt+255, Windows will try to insert a character that is the same symbol as the code page 437 symbol 1 to 255.
- When you press Alt+032 to Alt+0255, Windows will insert the symbol number 32 to 255 from whatever font is in use.
- When you press Alt+01 to Alt+031, most programs do nothing, but some programs may interpret some of these Alt codes as a control codes. For example, in Notepad, Alt+08 is backspace, Alt+09 is tab, and Alt+013 is enter.
The Terminal font acts like a symbol font: It's not linked to a specific character set or mapped to Unicode characters. Because of this, Alt codes give different visual results with the Terminal font then they do with other fonts.
Code page 437 is a set of screen symbols that contains valid symbols for characters 0 to 31. Text files and text editors will use some or all of the characters from 0 to 31 as control codes, making it difficult to store those screen symbols in a text file.
The encoding is used when opening or saving a file. The encoding determines how to translate between the bytes stored in the file and the Unicode characters stored in the editor window. The encoding will probably not affect how Alt codes behave.
No comments:
Post a Comment