Skip to content

Correct placement of RTL symbols

Daniel Kahn Gillmor requested to merge dkg/libgnomekbd:fix-rtl-drawing into master

RTL symbols were being drawn overlapped when AltGr options are available, because the glyphs that were supposed to be on the left side of each key were drawn in a box that is the full width of the key.

I tried several other alternatives before landing on this solution. I tried:

  • making left-hand symbols drawn in a half-width box as well (this fails because it truncates names like CapsLock, and also truncates particularly wide symbols, like ش (U+0634 ARABIC LETTER SHEEN) even when they are the default symbol for the key stroke)
  • forcing all symbols to be drawn LTR, by turning off Pango.Layout's auto_dir (this seems dubious because a key could potentially be mapped to a series of Unicode characters; if those characters are RTL, then turning off auto_dir will display them in the wrong order)
  • for RTL characters, swap which box gets full-width and which box gets half-width (this is dubious because a single key could be mapped such that the AltGr symbols are RTL while the non-AltGr symbols are LTR or neutral; it also means that the default, left-displayed (non-AltGr) RTL symbols would be more likely to be ellipsized, like ش)

So i think the approach described here is the most principled and reasonable way to go.

Another possible approach would be to leave the full-width/half-width boxes as they are, and just add the alignment guidance; but the problem with that is the truncation of wide AltGr symbols.

Closes: #8 (closed)

Merge request reports