To what ASCII codes are attached? - ascii

Let's say I have Q letter in the top-left corner of my QWERTY keyboard and it has 81 ASCII code. On the AZERTY keyboard the top-left key is A. So if I click A on the AZERTY keyboard what code will be fired? Same 81 (if ASCII orients by the geographical key place) or 65 (if ASCII orients by the Latin letters)?
I am curious because I want my WASD keys (for character moving) to be placed in the same geographical place on any keyboard layout. How can I do that?

I am curious because I want my WASD keys (for character moving) to be placed in the same geographical place on any keyboard layout. How can I do that?
Your best bet is probably to offer a configuration stage where the end use chooses the keys they want to use. That way, you not only support different keyboard layouts, but left- and right-handed people, people with disabilities who may prefer a different arrangement, etc.

ASCII encodes letters and not keyboard keys for this reason symbol A is encoded by 81 number no matter where the key is on the keyboard layout.
Some operation systems will allow you to map keys or have special software for that purpose but to give a concrete answer we need more details about your setup (hardware, software, OS e.t.c)

Related

Chess piece ligatures or alternatives for terminal chess client

We're writing a chess app for terminal. We want the squares to be actual squares (or close enough) instead of the 2:1-ish, regular monospace, Unicode character rectangles.
As of right now We're thinking of using some of the available open-source chess fonts and turning them into two character-wide ligatures. We want the custom font to be interoperable with the user's choice of terminal font, assuming it is monospace.
This seems problematic as we would need to override the font only for specific character-pairs.
Another way is to take an already-existing, widely used type face that has wide character variety (say, JetBrains Mono), add the chess piece ligatures to it and package it as the canonical font.
However this seems overly complicated and opinionated route. Are we missing a simple alternative?
We are using Python's Textual library for drawing the actual squares and drawing the square outlines seems relatively straightforward.
Here's the opening position of the game as a reference of what we want to achieve.
BRBNBBBQBKBBBNBR
BPBPBPBPBPBPBPBP
................
................
................
................
WPWPWPWPWPWPWPWP
WRWNWBWQWKWBWNWR
Where one letter-pair is one piece. The first letter signifies the color and the second one signifies type of the piece. Obviously, the letter-pairs are to be replaced with the corresponding chess piece symbols.

Is there a font or (better!) set of unicode characters representing the numbers 0-255 for displaying ASCII character codes (or other uses)?

I have strings that are mostly standard alpha-numeric and other printable ASCII characters, and would like to display these in a console window on Windows. What I'm looking for is either a console font or a unicode set of characters that represent the numbers 0-255 (0-FF) using a single glyph for each. The thing that comes closest that I am aware of is that unicode has a small set of circled numbers, 1-20, and elsewhere numbers 21-50. Something along those lines, but for 0-255 (or 0-FF) is what I'm trying to find.
It seems to me that this would be a relatively common need/desire, but I've been unable to track down a solution. Any help appreciated!
The C0 and C1 controls can be represented by control pictures. The rest of the C0 Controls and Basic Latin, and C1 Controls and Latin-1 Supplement blocks can be represented by themselves. You may have to test a few fonts to find one that supports all these characters.
However, you said "ASCII" and "0-255". But, ASCII has only 128 codepoints. Your codepoints 128-255 must be from an unnamed character set. Although you probably mean one of the well-known ones, they are so numerous that a detailed answer isn't practical.
There is also the Unicode BMP Fallback SIL font that covers U+0000 to U+FFFF (but not U+10000 to U+10FFFF).

TextOut() and the Cambria Math font

The Cambria Math font has UNICODE characters beyond 0xFFFF. You can see them in a Word document, just by inserting a Symbol and selecting the Cambria Math font. By the way, the Windows Character Map does not show these characters. My question is : how to exhibit those UNICODE characters in a Windows app using TextOut() ?
To display these supplementary code points you need to use UTF-16 surrogate pairs.
A surrogate pair is a way of representing single code points beyond 0xFFFF as two wide characters. You simply pass a surrogate pair to TextOut() and it will be displayed.

Which characters to choose when "drawing" a box on Windows console?

I'm trying to port a curses program to Windows. Now one of the problems is that the default ACS_XXXX characters become double-width on Windows console, thus breaking the alignment.
I tried looking for other characters to do the job, like '-' or '|' in basic ASCII, but none of them looks good because the line is not continuous. And finding characters to "draw" corners seems more difficult.
Are there any commonly used characters in such a situation?
I got it to work using the MingLiu font. That is, to draw boxes around Chinese characters with ASCII characters without any alignment issues.
There are border characters in the system font. This includes joints, corners, and both double and single edges. They appear in the higher positions.
Check out http://www.asciitable.com/ for details. They range from 179 to 218 (decimal) in the extended ascii table.
There are a few box drawing characters that were available in the old DOS days - you should be able to use those.
However, keep in mind that the Windows console may require some jumping through hoops to output this as Unicode, which might be a problem unless you accept that your code editor is unlikely to display the character correctly. Michael Kaplan summarizes the problem quite nicely, with information about how to get around this.

How important is mirroring the _entire_ user interface for Arabic speakers?

I've been researching about adding Arabic localisation into our software. I understand that mirroring of some controls is essential, such as the relationship of labels and textboxes: any labels that are to the left of textboxes in left-to-right languages need to be to the right of the textboxes in Arabic and other right-to-left languages. But I can't find a definite answer on whether the entire layout of the graphical user interface should be mirrored.
For example in our software we have a panel with a map in it on the left of a window and secondary information in a panel on the right. Should the position of these panels be reversed for right-to-left languages?
The main reason I ask is that Microsoft Windows takes the path of mirroring everything when in Arabic, but I just noticed in the new support for Arabic in the iPhone OS 3.0, virtually nothing is mirrored, not even label-textbox examples. I would have thought this to be quite bad on Apple's part, but is this sort of thing widely accepted in the Arab world?
In Arabic, we read and scan graphic elements right-to-left
You will need to horizontal-flip the whole display, except for the images and text (the BiDi library - usually in the OS - handles that). You're only flipping the locations of the control.
A control bound by (x1,y1,x2,y2) in a w*h screen becomes (w-x2,y1,w-x1,y2), the contents of the rectangle are not to be flipped, just the position. It would keep its dimensions.
For example, compare Google news in English, and Arabic... notice the menu, the images, the news items.
Usually, one exception is acceptable, media players are still left-to-right for historical reasons (The tape recorders, VHS video devices were never localized).
Its important. Imagine if you were using some software written by an Arabic speaker that was translated into English and some things were not correctly flipped.
In general, Windows (Vista and WIn7 in particular) and Office are very well translated for right to left reading languages. You can use this as an example of what to do - this is especially true for the top level UI elements
I would agree that purely graphical elements may not need to be flipped, but you should consider doing the right thing for anything that is generally scanned in reading order.
Mirroring is extremely important, not just because the text will be displayed properly, but because of the "mental model" of the user.
When a language is written right-to-left, the entire expectation of the user is shifted, but an even more interesting effect is the change of terminology. What we usually term positioning "left" and "right" actually end up being "beginning" and "end" (or "before" and "after") which makes mirroring the interface a little more elaborate.
On top of that, you will have elements that should not be mirrored. There are several examples in software that indiscriminantly mirrors all buttons and creates hilarious (horrible...) results. A few examples:
"Undo" and "Redo" buttons: Undo means 'go backwards'; in English (LTR) this means go-to-the-left, but in Arabic or Hebrew, it means go-to-the-right, so the button is flipped, and the same goes to the redo button. However, in RTL, the order of those two buttons is also flipped, which means you "double flipped" their representation, which essentially gives you a pair of buttons in RTL that look exactly the same as the pair in LTR, except with different meanings. This can be confusing to implement.
Icon mirroring #1 (lists): For the most part, icons are usually mirrored. For instance, an icon representing a bullet list will be bullets-on-the-left for LTR and bullets-on-the-right for RTL. Most software "simply" mirror it, which is fairly reasonable. However, there are a few pieces of software (OpenOffice is one, unfortunately) that also mirror the numbered list. This creates a situation where the numbers themselves are flipped (so the number 2 in that icon looks like a 5).
Icon mirroring #2 (question mark): Another example is a "help" button that is usually represented with a question mark. This is even more elaborate, because it is different for several RTL languages. Some RTL languages like Arabic display question mark reversed (؟) but others, like Hebrew, display it the same as English (?). This mirroring is dependent on language, not just on RTL/LTR.
Another challenge is having a mixed-content software. For example, if your software displays some set content but allows the user to change the interface language, you may run into interesting flip-no-flip issues.
If you have some software that lets you read RSS feeds, for example, the content may consistently be LTR, but if your user switches their interface to RTL, then some interface elements should mirror while others shouldn't. If we go by the icon examples above, for instance, then "bullet lists" shouldn't flip in this case, because while the interface is RTL, the actual content you insert is expected LTR, so the bullet will practically be left-to-right, and the bullet represents that.
The challenge in these cases is deciding which piece of your software is "content" and which is "interface" and while it is doable, it's a challenging endeavor.
To sum up - mirroring interfaces is not as straight forward as it sounds, and many times really depends on the purpose and context of your software. I would say it is extremely important, because RTL users' mental model (in terms of where things "start" and "end") is reverse, and just like LTR users' eyes are automatically drawn to the top-left (which is why logos are usually placed there) RTL users' eyes are usually automatically drawn to the top-right - and your interface should respect that. That said, you should analyze your interface and the way your content and interface are displayed in general, and beware of cases where flipping/mirroring is actually not suitable.
Hope this helps.

Resources