You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR:UAX #11 quoted below states that East Asian Ambiguous width characters should be treated as Narrow in non-East Asian contexts (LtR/RtL); and Wide in known East Asian contexts (vertical rendering), such as given languages, scripts, fonts, or legacy character encodings: so unless mintty is rendering known Wide characters in contexts such as the characters or lines above or below, East Asian Ambiguous should be rendered as East Asian Narrow by default, as suggested in the second last paragraph quoted below:
"4 Definitions
... ED6. East Asian Ambiguous (A): All characters that can be sometimes wide and sometimes narrow. Ambiguous characters require additional information not contained in the character code to further resolve their width.
Ambiguous characters occur in East Asian legacy character sets as wide characters, but as narrow (i.e., normal-width) characters in non-East Asian usage. (Examples are the basic Greek and Cyrillic alphabet found in East Asian character sets, but also some of the mathematical symbols.) Private-use characters are considered ambiguous by default, because additional information is required to know whether they should be treated as wide or narrow.
When they are treated as wide characters, ambiguous characters would typically be rendered upright in vertical text runs.
Because East Asian legacy character sets do not always include complete case pairs of Latin characters, two members of a case pair may have different East_Asian_Width properties:
Ambiguous: 01D4 LATIN SMALL LETTER U WITH CARON
Neutral: 01D3 LATIN CAPITAL LETTER U WITH CARON
Canonical equivalents of ambiguous characters may not be ambiguous themselves. For example, U+212B Å ANGSTROM SIGN is Ambiguous, while its decomposition, U+00C5 Å LATIN CAPITAL LETTER A WITH RING ABOVE, is Neutral.
...
4.2 Ambiguous Characters
Ambiguous width characters are all those characters that can occur as fullwidth characters in any of a number of East Asian legacy character encodings. They have a “resolved” width of either narrow or wide depending on the context of their use. If they are not used in the context of the specific legacy encoding to which they belong, their width resolves to narrow. Otherwise, it resolves to fullwidth or halfwidth. The term context as used here includes extra information such as explicit markup, knowledge of the source code page, font information, or language and script identification. For example:
Greek [and Cyrillic] characters resolve to narrow when used with a standard Greek font, because there is no East Asian legacy context.
Private-use character codes and the replacement character have ambiguous width, because they may stand in for characters of any width.
Ambiguous quotation marks are generally resolved to wide when they enclose and are adjacent to a wide character, and to narrow otherwise.
The East_Asian_Width property does not preserve canonical equivalence, because the base characters of canonical decompositions almost always have a different East_Asian_Width than the precomposed characters. East Asian Width is designed for use with legacy character sets so the property value is not designed to respect canonical equivalence. Modern Rendering Practice. Modern practice is evolving toward rendering ever more of the ambiguous characters with proportionally spaced, narrow forms that rotate with the direction of writing, making a distinction within the legacy character set. In other words, context information beyond the choice of font or source character set is employed to resolve the width of the character. This annex does not attempt to track such changes in practice; therefore, the set of characters with mappings to legacy character sets that have been assigned ambiguous width constitute a superset of the set of such characters that may be rendered as wide characters in a given context. In particular, an application might find it useful to treat characters from alphabetic scripts as narrow by default. Conversely, many of the symbols in the Unicode Standard have no mappings to legacy character sets, yet they may be rendered as “wide” characters if they appear in an East Asian context. An implementation might therefore elect to treat them as ambiguous even though they are classified as neutral here.
5 Recommendations
When mapping Unicode to East Asian legacy character encodings
Wide Unicode characters always map to fullwidth characters.
Narrow (and neutral) Unicode characters always map to halfwidth characters.
Halfwidth Unicode characters always map to halfwidth characters.
Ambiguous Unicode characters always map to fullwidth characters.
When mapping Unicode to non-East Asian legacy character encodings
Wide Unicode characters do not map to non-East Asian legacy character encodings.
Ambiguous Unicode characters always map to regular (narrow) characters.
When processing or displaying data
Wide characters behave like ideographs in important ways, such as layout. Except for certain punctuation characters, they are not rotated when appearing in vertical text runs. In fixed-pitch fonts, they take up one Em of space.
Halfwidth characters behave like ideographs in some ways, however, they are rotated like narrow characters when appearing in vertical text runs. In fixed-pitch fonts, they take up 1/2 Em of space.
Narrow characters behave like Western characters, for example, in line breaking. They are rotated sideways, when appearing in vertical text. In fixed-pitch East Asian fonts, they take up 1/2 Em of space, but in rendering, a non-East Asian, proportional font is often substituted.
Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). If the context cannot be established reliably, they should be treated as narrow characters by default.
[UTS51]emoji presentation sequences behave as though they were East Asian Wide, regardless of their assigned East_Asian_Width property value."
Thanks for the reference. However, in the case of a terminal, the notion of "context" can hardly be resolved by anything else than "locale" because that's what the wcwidth/wcswidth API is based on and, in turn, this is the only API for an application to determine text width in a reliable way (unless the application would actually probe the terminal for the effective width in a number of cases).
This rules out any finer-grained concept of a text context suggested above, including the last statement about emoji presentation sequences.
In cygwin, you can force ambiguous characters to be rendered narrow by a locale modifier, e.g. LC_ALL=zh_TW.utf8@cjknarrow mintty.
Please consider that you have an issue raised by someone who appears to probably be in a CJK/East Asian locale complaining about incorrect rendering of ambiguous characters in a recent version, which appears to have incompatibly changed behaviour.
Please remember mintty is in Cygwin base and must maintain backward compatibility for how ever many hundreds of thousands of users run it.
Please remember that Cygwin has a strict backward compatibility requirement to not break existing installations with new features or changed defaults; that should be modifiable through detection of platform changes, otherwise explicit option settings.
None of us who have never had to select any narrowing in locales, should not have to start now, because of recent changes: they should be hidden behind options that maintain strictly backward compatible behaviour.
Character width should not be such an issue in a terminal emulator which renders mainly ASCII/Latin/Symbol characters in fixed cells.
Everything else should be the exception, so most of us can ignore it.
All fonts are fixed width, and most may now be using ISO-10646-1 encodings to handle their locales, so as character rendering is mainly LtR, and they are not legacy encodings, should default ambiguous to narrow: as far as I know vertical rendering is not a mintty option.
All characters should be rendered within a fixed cell, by default without any manipulation: if a character width requires using the next cell, track that for wrapping and skip to the next boundary for the next character, but ignore it otherwise.
If options are needed to request making wide or fullwidth character glyphs narrower to fit in a regular monospace fixed font character cell, or CJK/East Asian character cells bigger than the regular monospace fixed font to default space to that of Wide or Fullwidth characters, then please consider supporting allowing those who need those features to select the appropriate options, assuming that information is readily available in or derivable from the font metrics, or an appropriate option is provided to ebnable such behavious, or add or change the metrics for each font and point size selected, if that is what is required, and then provide clear documentation of when and how to use each option, what is affected and how is it affected.
Folks should select fonts that result in characters rendered how they want to see them, given the restrictions of TrueType/OpenType fonts, ClearType, Uniscribe, Windows, and the platform limits.
I use an ISO-10646-1 font which clearly distinguishes similarly shaped Latin glyphs and provides a wide selection of other symbols, languages, and scripts, with generic fallbacks which show me groups and codes, for unsupported groups.
I would hate to have to return to using Windows fonts and encodings just to ensure stable character set rendering in the terminal.
Folks who have a problem with one character rendering in one font they chose should try some others, or configure their fonts and fallbacks to suit their requirements.
Please keep mintty a great, consistent, robust, generic terminal.
It is great to be responsive to those with major issues.
Please try to resist the urge to help everyone who as the easiest way with no cost and little effort to themselves to magically fix their minor issue signs up on github to ask for a code change, which may not be strictly orthogonal to, and may interact (badly) with, existing features, at the cost of possible bloat and instability to all Cygwin users (some of whom still appear to be happy using just cmd!)
If there are interactions, you may want to check and consider whether those issues are handled by PuTTY, xterm, and libncursesw, and if so, how.
If you choose to provide a fix, please require them to explicitly enable their special behaviour using a new .minttyrc option, without affecting the base of users.
If an option value has to be changed from the default, please require them to explicitly change that default in .minttyrc, without affecting the base of users.
Remember: a design is complete, not when there is nothing left to add, but when there is nothing left to remove.
The standard considers use of context essential to any use of East_Asian_Width, and also allows context to override East Asian Width.
If you choose not to use context, then please do not choose to treat Ambiguous as Wide, regardless of locale, outside of CJK/East Asian Wide or Fullwidth groups/ranges, as many LATIN named characters and normal symbols across many classes/categories are defined as Ambiguous:
00A1;A # Po INVERTED EXCLAMATION MARK
00A4;A # Sc CURRENCY SIGN
00A7;A # Po SECTION SIGN
00A8;A # Sk DIAERESIS
00AA;A # Lo FEMININE ORDINAL INDICATOR
00AD;A # Cf SOFT HYPHEN
00AE;A # So REGISTERED SIGN
00B0;A # So DEGREE SIGN
00B1;A # Sm PLUS-MINUS SIGN
00B4;A # Sk ACUTE ACCENT
00B8;A # Sk CEDILLA
00B9;A # No SUPERSCRIPT ONE
00BA;A # Lo MASCULINE ORDINAL INDICATOR
00BF;A # Po INVERTED QUESTION MARK
00C6;A # Lu LATIN CAPITAL LETTER AE
00D0;A # Lu LATIN CAPITAL LETTER ETH
00D7;A # Sm MULTIPLICATION SIGN
00D8;A # Lu LATIN CAPITAL LETTER O WITH STROKE
00E6;A # Ll LATIN SMALL LETTER AE
00F0;A # Ll LATIN SMALL LETTER ETH
00F7;A # Sm DIVISION SIGN
00FC;A # Ll LATIN SMALL LETTER U WITH DIAERESIS
00FE;A # Ll LATIN SMALL LETTER THORN
0101;A # Ll LATIN SMALL LETTER A WITH MACRON
0111;A # Ll LATIN SMALL LETTER D WITH STROKE
0113;A # Ll LATIN SMALL LETTER E WITH MACRON
011B;A # Ll LATIN SMALL LETTER E WITH CARON
012B;A # Ll LATIN SMALL LETTER I WITH MACRON
0138;A # Ll LATIN SMALL LETTER KRA
0144;A # Ll LATIN SMALL LETTER N WITH ACUTE
014D;A # Ll LATIN SMALL LETTER O WITH MACRON
016B;A # Ll LATIN SMALL LETTER U WITH MACRON
01CE;A # Ll LATIN SMALL LETTER A WITH CARON
01D0;A # Ll LATIN SMALL LETTER I WITH CARON
01D2;A # Ll LATIN SMALL LETTER O WITH CARON
01D4;A # Ll LATIN SMALL LETTER U WITH CARON
01D6;A # Ll LATIN SMALL LETTER U WITH DIAERESIS AND MACRON
01D8;A # Ll LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE
01DA;A # Ll LATIN SMALL LETTER U WITH DIAERESIS AND CARON
01DC;A # Ll LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE
0251;A # Ll LATIN SMALL LETTER ALPHA
0261;A # Ll LATIN SMALL LETTER SCRIPT G
02C4;A # Sk MODIFIER LETTER UP ARROWHEAD
02C7;A # Lm CARON
02CD;A # Lm MODIFIER LETTER LOW MACRON
02D0;A # Lm MODIFIER LETTER TRIANGULAR COLON
02DD;A # Sk DOUBLE ACUTE ACCENT
02DF;A # Sk MODIFIER LETTER CROSS ACCENT
0401;A # Lu CYRILLIC CAPITAL LETTER IO
0451;A # Ll CYRILLIC SMALL LETTER IO
2010;A # Pd HYPHEN
2016;A # Po DOUBLE VERTICAL LINE
2018;A # Pi LEFT SINGLE QUOTATION MARK
2019;A # Pf RIGHT SINGLE QUOTATION MARK
201C;A # Pi LEFT DOUBLE QUOTATION MARK
201D;A # Pf RIGHT DOUBLE QUOTATION MARK
2030;A # Po PER MILLE SIGN
2035;A # Po REVERSED PRIME
203B;A # Po REFERENCE MARK
0451;A # Ll CYRILLIC SMALL LETTER IO
2010;A # Pd HYPHEN
2016;A # Po DOUBLE VERTICAL LINE
2018;A # Pi LEFT SINGLE QUOTATION MARK
2019;A # Pf RIGHT SINGLE QUOTATION MARK
201C;A # Pi LEFT DOUBLE QUOTATION MARK
201D;A # Pf RIGHT DOUBLE QUOTATION MARK
2030;A # Po PER MILLE SIGN
2035;A # Po REVERSED PRIME
203B;A # Po REFERENCE MARK
203E;A # Po OVERLINE
2074;A # No SUPERSCRIPT FOUR
207F;A # Lm SUPERSCRIPT LATIN SMALL LETTER N
20AC;A # Sc EURO SIGN
2103;A # So DEGREE CELSIUS
2105;A # So CARE OF
2109;A # So DEGREE FAHRENHEIT
2113;A # Ll SCRIPT SMALL L
2116;A # So NUMERO SIGN
2126;A # Lu OHM SIGN
212B;A # Lu ANGSTROM SIGN
2189;A # No VULGAR FRACTION ZERO THIRDS
21D2;A # Sm RIGHTWARDS DOUBLE ARROW
21D4;A # Sm LEFT RIGHT DOUBLE ARROW
21E7;A # So UPWARDS WHITE ARROW
2200;A # Sm FOR ALL
220B;A # Sm CONTAINS AS MEMBER
220F;A # Sm N-ARY PRODUCT
2211;A # Sm N-ARY SUMMATION
2215;A # Sm DIVISION SLASH
221A;A # Sm SQUARE ROOT
2223;A # Sm DIVIDES
2225;A # Sm PARALLEL TO
222E;A # Sm CONTOUR INTEGRAL
2248;A # Sm ALMOST EQUAL TO
224C;A # Sm ALL EQUAL TO
2252;A # Sm APPROXIMATELY EQUAL TO OR THE IMAGE OF
2295;A # Sm CIRCLED PLUS
2299;A # Sm CIRCLED DOT OPERATOR
22A5;A # Sm UP TACK
22BF;A # Sm RIGHT TRIANGLE
2312;A # So ARC
25B6;A # So BLACK RIGHT-POINTING TRIANGLE
25B7;A # Sm WHITE RIGHT-POINTING TRIANGLE
25C0;A # So BLACK LEFT-POINTING TRIANGLE
25C1;A # Sm WHITE LEFT-POINTING TRIANGLE
25CB;A # So WHITE CIRCLE
25EF;A # So LARGE CIRCLE
2609;A # So SUN
261C;A # So WHITE LEFT POINTING INDEX
261E;A # So WHITE RIGHT POINTING INDEX
2640;A # So FEMALE SIGN
2642;A # So MALE SIGN
266F;A # Sm MUSIC SHARP SIGN
26BF;A # So SQUARED KEY
26E3;A # So HEAVY CIRCLE WITH STROKE AND TWO DOTS ABOVE
26F4;A # So FERRY
273D;A # So HEAVY TEARDROP-SPOKED ASTERISK
FFFD;A # So REPLACEMENT CHARACTER
I absolutely agree that mintty should put priority on stability, and that's what I'm trying to achieve, no worries.
About this issue, the point is it does not reproduce for me, and my suspicion is that the user uses different locales in the two examples; that's what I was asking for, response pending.
And yes, U+2500 has ambiguous width.
which appears to have incompatibly changed behaviour
I should have stated this before: behaviour has not changed, to the best of my knowledge. U+2500 has always been wide when running mintty in an unmodified CJK locale, at least since 1.2.0.
In non-CJK/East Asian contexts and locales, where East_Asian_Width is irrelevant, I would also expect the following regular symbols to be rendered in default/neutral/regular/narrow width:
2329;W # Ps LEFT-POINTING ANGLE BRACKET
232A;W # Pe RIGHT-POINTING ANGLE BRACKET
23F0;W # So ALARM CLOCK
23F3;W # So HOURGLASS WITH FLOWING SAND
267F;W # So WHEELCHAIR SYMBOL
2693;W # So ANCHOR
26A1;W # So HIGH VOLTAGE SIGN
26CE;W # So OPHIUCHUS
26D4;W # So NO ENTRY
26EA;W # So CHURCH
26F5;W # So SAILBOAT
26FA;W # So TENT
26FD;W # So FUEL PUMP
2705;W # So WHITE HEAVY CHECK MARK
2728;W # So SPARKLES
274C;W # So CROSS MARK
274E;W # So NEGATIVE SQUARED CROSS MARK
2757;W # So HEAVY EXCLAMATION MARK SYMBOL
27B0;W # So CURLY LOOP
27BF;W # So DOUBLE CURLY LOOP
2B50;W # So WHITE MEDIUM STAR
2B55;W # So HEAVY LARGE CIRCLE
as well as the anomalous "Wide" symbols in the ranges:
1F000..1F003;N # So [4] MAHJONG TILE EAST WIND..MAHJONG TILE NORTH WIND
1F004;W # So MAHJONG TILE RED DRAGON
1F005..1F02B;N # So [39] MAHJONG TILE GREEN DRAGON..MAHJONG TILE BACK
--
1F0C1..1F0CE;N # So [14] PLAYING CARD ACE OF DIAMONDS..PLAYING CARD KING OF DIAMONDS
1F0CF;W # So PLAYING CARD BLACK JOKER
1F0D1..1F0F5;N # So [37] PLAYING CARD ACE OF CLUBS..PLAYING CARD TRUMP-21
--
1F170..1F18D;A # So [30] NEGATIVE SQUARED LATIN CAPITAL LETTER A..NEGATIVE SQUARED SA
1F18E;W # So NEGATIVE SQUARED AB
1F18F..1F190;A # So [2] NEGATIVE SQUARED WC..SQUARE DJ
--
1F3F1..1F3F3;N # So [3] WHITE PENNANT..WAVING WHITE FLAG
1F3F4;W # So WAVING BLACK FLAG
1F3F5..1F3F7;N # So [3] ROSETTE..LABEL
--
1F43F;N # So CHIPMUNK
1F440;W # So EYES
1F441;N # So EYE
--
1F568..1F579;N # So [18] RIGHT SPEAKER..JOYSTICK
1F57A;W # So MAN DANCING
1F57B..1F594;N # So [26] LEFT HAND TELEPHONE RECEIVER..REVERSED VICTORY HAND
--
1F597..1F5A3;N # So [13] WHITE DOWN POINTING LEFT HAND INDEX..BLACK DOWN POINTING...
1F5A4;W # So BLACK HEART
1F5A5..1F5FA;N # So [86] DESKTOP COMPUTER..WORLD MAP
--
1F6C6..1F6CB;N # So [6] TRIANGLE WITH ROUNDED CORNERS..COUCH AND LAMP
1F6CC;W # So SLEEPING ACCOMMODATION
1F6CD..1F6CF;N # So [3] SHOPPING BAGS..BED
--
1F6D3..1F6D4;N # So [2] STUPA..PAGODA
1F6D5;W # So HINDU TEMPLE
1F6E0..1F6EA;N # So [11] HAMMER AND WRENCH..NORTHEAST-POINTING AIRPLANE
rendered:
Ambiguous
¡ U+000A1 INVERTED EXCLAMATION MARK
¤ U+000A4 CURRENCY SIGN
§ U+000A7 SECTION SIGN
¨ U+000A8 DIAERESIS
ª U+000AA FEMININE ORDINAL INDICATOR
U+000AD SOFT HYPHEN
® U+000AE REGISTERED SIGN
° U+000B0 DEGREE SIGN
± U+000B1 PLUS-MINUS SIGN
´ U+000B4 ACUTE ACCENT
¸ U+000B8 CEDILLA
¹ U+000B9 SUPERSCRIPT ONE
º U+000BA MASCULINE ORDINAL INDICATOR
¿ U+000BF INVERTED QUESTION MARK
Æ U+000C6 LATIN CAPITAL LETTER AE
Ð U+000D0 LATIN CAPITAL LETTER ETH
× U+000D7 MULTIPLICATION SIGN
Ø U+000D8 LATIN CAPITAL LETTER O WITH STROKE
æ U+000E6 LATIN SMALL LETTER AE
ð U+000F0 LATIN SMALL LETTER ETH
÷ U+000F7 DIVISION SIGN
ü U+000FC LATIN SMALL LETTER U WITH DIAERESIS
þ U+000FE LATIN SMALL LETTER THORN
ā U+00101 LATIN SMALL LETTER A WITH MACRON
đ U+00111 LATIN SMALL LETTER D WITH STROKE
ē U+00113 LATIN SMALL LETTER E WITH MACRON
ě U+0011B LATIN SMALL LETTER E WITH CARON
ī U+0012B LATIN SMALL LETTER I WITH MACRON
ĸ U+00138 LATIN SMALL LETTER KRA
ń U+00144 LATIN SMALL LETTER N WITH ACUTE
ō U+0014D LATIN SMALL LETTER O WITH MACRON
ū U+0016B LATIN SMALL LETTER U WITH MACRON
ǎ U+001CE LATIN SMALL LETTER A WITH CARON
ǐ U+001D0 LATIN SMALL LETTER I WITH CARON
ǒ U+001D2 LATIN SMALL LETTER O WITH CARON
ǔ U+001D4 LATIN SMALL LETTER U WITH CARON
ǖ U+001D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON
ǘ U+001D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE
ǚ U+001DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON
ǜ U+001DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE
ɑ U+00251 LATIN SMALL LETTER ALPHA
ɡ U+00261 LATIN SMALL LETTER SCRIPT G
˄ U+002C4 MODIFIER LETTER UP ARROWHEAD
ˇ U+002C7 CARON
ˍ U+002CD MODIFIER LETTER LOW MACRON
ː U+002D0 MODIFIER LETTER TRIANGULAR COLON
˝ U+002DD DOUBLE ACUTE ACCENT
˟ U+002DF MODIFIER LETTER CROSS ACCENT
Ё U+00401 CYRILLIC CAPITAL LETTER IO
ё U+00451 CYRILLIC SMALL LETTER IO
‐ U+02010 HYPHEN
‖ U+02016 DOUBLE VERTICAL LINE
‘ U+02018 LEFT SINGLE QUOTATION MARK
’ U+02019 RIGHT SINGLE QUOTATION MARK
“ U+0201C LEFT DOUBLE QUOTATION MARK
” U+0201D RIGHT DOUBLE QUOTATION MARK
‰ U+02030 PER MILLE SIGN
‵ U+02035 REVERSED PRIME
※ U+0203B REFERENCE MARK
‾ U+0203E OVERLINE
⁴ U+02074 SUPERSCRIPT FOUR
ⁿ U+0207F SUPERSCRIPT LATIN SMALL LETTER N
€ U+020AC EURO SIGN
℃ U+02103 DEGREE CELSIUS
℅ U+02105 CARE OF
℉ U+02109 DEGREE FAHRENHEIT
ℓ U+02113 SCRIPT SMALL L
№ U+02116 NUMERO SIGN
Ω U+02126 OHM SIGN
Å U+0212B ANGSTROM SIGN
↉ U+02189 VULGAR FRACTION ZERO THIRDS
⇒ U+021D2 RIGHTWARDS DOUBLE ARROW
⇔ U+021D4 LEFT RIGHT DOUBLE ARROW
⇧ U+021E7 UPWARDS WHITE ARROW
. U+02200..U+022FF: Mathematical Operators
∀ U+02200 FOR ALL
∋ U+0220B CONTAINS AS MEMBER
∏ U+0220F N-ARY PRODUCT
∑ U+02211 N-ARY SUMMATION
∕ U+02215 DIVISION SLASH
√ U+0221A SQUARE ROOT
∣ U+02223 DIVIDES
∥ U+02225 PARALLEL TO
∮ U+0222E CONTOUR INTEGRAL
≈ U+02248 ALMOST EQUAL TO
≌ U+0224C ALL EQUAL TO
≒ U+02252 APPROXIMATELY EQUAL TO OR THE IMAGE OF
⊕ U+02295 CIRCLED PLUS
⊙ U+02299 CIRCLED DOT OPERATOR
⊥ U+022A5 UP TACK
⊿ U+022BF RIGHT TRIANGLE
⌒ U+02312 ARC
▶ U+025B6 BLACK RIGHT-POINTING TRIANGLE
▷ U+025B7 WHITE RIGHT-POINTING TRIANGLE
◀ U+025C0 BLACK LEFT-POINTING TRIANGLE
◁ U+025C1 WHITE LEFT-POINTING TRIANGLE
○ U+025CB WHITE CIRCLE
◯ U+025EF LARGE CIRCLE
☉ U+02609 SUN
☜ U+0261C WHITE LEFT POINTING INDEX
☞ U+0261E WHITE RIGHT POINTING INDEX
♀ U+02640 FEMALE SIGN
♂ U+02642 MALE SIGN
♯ U+0266F MUSIC SHARP SIGN
⛣ U+026E3 HEAVY CIRCLE WITH STROKE AND TWO DOTS ABOVE
⛴ U+026F4 FERRY
✽ U+0273D HEAVY TEARDROP-SPOKED ASTERISK
� U+0FFFD REPLACEMENT CHARACTER
Wide
〈 U+02329 LEFT-POINTING ANGLE BRACKET
〉 U+0232A RIGHT-POINTING ANGLE BRACKET
⏰ U+023F0 ALARM CLOCK
⏳ U+023F3 HOURGLASS WITH FLOWING SAND
♿ U+0267F WHEELCHAIR SYMBOL
⚓ U+02693 ANCHOR
⚡ U+026A1 HIGH VOLTAGE SIGN
⚿ U+026BF SQUARED KEY
⛎ U+026CE OPHIUCHUS
⛔ U+026D4 NO ENTRY
⛪ U+026EA CHURCH
⛵ U+026F5 SAILBOAT
⛺ U+026FA TENT
⛽ U+026FD FUEL PUMP
✅ U+02705 WHITE HEAVY CHECK MARK
✨ U+02728 SPARKLES
❌ U+0274C CROSS MARK
❎ U+0274E NEGATIVE SQUARED CROSS MARK
❗ U+02757 HEAVY EXCLAMATION MARK SYMBOL
➰ U+027B0 CURLY LOOP
➿ U+027BF DOUBLE CURLY LOOP
⭐ U+02B50 WHITE MEDIUM STAR
⭕ U+02B55 HEAVY LARGE CIRCLE
Anomalous Wide in Narrow group
🀃 U+1F003 MAHJONG TILE NORTH WIND
🀄 U+1F004 MAHJONG TILE RED DRAGON
🀅 U+1F005 MAHJONG TILE GREEN DRAGON
--
🃎 U+1F0CE PLAYING CARD KING OF DIAMONDS
🃏 U+1F0CF PLAYING CARD BLACK JOKER
🃑 U+1F0D1 PLAYING CARD ACE OF CLUBS
--
🆍 U+1F18D NEGATIVE SQUARED SA
🆎 U+1F18E NEGATIVE SQUARED AB
🆏 U+1F18F NEGATIVE SQUARED WC
--
🏳 U+1F3F3 WAVING WHITE FLAG
🏴 U+1F3F4 WAVING BLACK FLAG
🏵 U+1F3F5 ROSETTE
--
🐿 U+1F43F CHIPMUNK
👀 U+1F440 EYES
👁 U+1F441 EYE
--
🕹 U+1F579 JOYSTICK
🕺 U+1F57A MAN DANCING
🕻 U+1F57B LEFT HAND TELEPHONE RECEIVER
--
🖣 U+1F5A3 BLACK DOWN POINTING BACKHAND INDEX
🖤 U+1F5A4 BLACK HEART
🖥 U+1F5A5 DESKTOP COMPUTER
--
🛋 U+1F6CB COUCH AND LAMP
🛌 U+1F6CC SLEEPING ACCOMMODATION
🛍 U+1F6CD SHOPPING BAGS
--
🛔 U+1F6D4 PAGODA
🛕 U+1F6D5 HINDU TEMPLE
🛠 U+1F6E0 HAMMER AND WRENCH
Brian, I'm wondering by what reasoning you would expect wide characters to be displayed narrow. This is absolutely inconsistent with the POSIX locale mechanism. You may well question the categories in the Unicode database, and I would agree in a number of cases, but that's how we have them as a matter of life.
What you can do is create your own locale (and maybe even make it popular for inclusion in cygwin) which handles certain character widths in a more "reasonable" way, deviating from Unicode. That would work well.
Unicode says do not use East_Asian_Width except in CJK/East Asian conversion or rendering contexts; it says it is open to interpretation in context, so don't interpret without context.
How do PuTTY, xterm, libncursesw render Ambiguous, Wide, Fullwidth characters, and what did mintty originally? See Issue #88
That was why I suggested if glyph width > character cell, track and account for spacing and wrapping, otherwise ignore it; if followed immediately by white space, you can fudge it.
POSIX locale has nothing to do with and says little about encodings of which Unicode is one set: it mainly deals with character/byte mappings; here one character is one cell; anything else is an implementation detail of fonts.
Why should we who have used Cygwin for many years, and/or never used CJK/East Asian locales, have to change or do anything? We don't and should o' need to know or care about ambiguous, wide, or fullwidth characters if we don't use those languages: they're just more symbols to us, and each character should be handled as simply, verbatim, and vanilla as possible.
If different handling is required for other reasons, that should either be adapted automatically, if unambiguously required, or require explicit specification in an option.
We can not drift from providing mechanisms to setting policies: policies must be specifiable and/or able to be put into effect using the provided mechanisms.
Brian, let's not confuse things here.
The recent glyph narrowing issue, which may still receive some tweaking perhaps or not, has nothing to do with this issue here. The glyph narrowing does not affect effective cell width.
This issue is about single/double cell width of a set of ambiguous-width characters.
And yes, this is related to the locale mechanism which defines the set of double-width characters via the wcwidth/wcswidth functions.
Mintty once changed its policy when to assign double-width to ambiguous-width. It used to be based on the font, which was no good approach; a cell-based terminal cannot depend on font properties to decide how wide text should render. Mintty switched to be based on the locale as other terminals do long ago, before I adopted the project.
In addition, both xterm and mintty have proprietary modes to apply their own width information with ambiguous-width interpreted either narrow or wide, overriding the locale.
Applying East Asian width properties to character rendering is standard in all modern terminals. You wouldn't want CJK characters to appear single-width, in the first place. Unicode statements do not match well to the use case of cell-based rendering, so they cannot be taken literally in all respects. Context-based narrow/wide decisions are not manageable for text-mode applications as I said before.
Finally, I think you were mislead by this issue report to assume anything had changed.
It has not, so let's calm down. I requested the reporter for additional diagnostic information which is still not available. My assumption suggests a user configuration effect. Should any specific environment cause any real incompatibility, this will be handled as a bug and fixed, but that would yet have to be demonstrated.
Thanks; you have apparently configured locale and charset explicitly in the mintty configuration.
This is somewhat tricky because it deviates from the idea that the shell may have about the locale, and in fact I see a difference between this configuration and simply running LC_ALL=ja_JP.utf8 mintty. Please try the latter to compare.
However, in either case, I see no difference between 2.9.6 and 3.0.6. Maybe you set LC_ALL (or LC_CTYPE or LANG) in addition in one case and not in the other?
I have to add one detail to my description above:
If you specify explicit Locale and Charset options (rather than just setting a locale variable before starting mintty, which would be preferrable), mintty still checks font properties and may append a @cjknarrow modifier to the locale, depending on CJK properties of the font. This would explain the two different screenshots, provided that configuration of mintty is different in the two cases as I assume.
Again, this behaviour has not changed since mintty 0.6.1 at least.
Thank you for the explanation.
Comparison using LC_ALL = ja_JP.utf8 mintty. It was displayed well in 2.9.6, and the display of 3.0.6 was broken.
Certainly, I found that the two versions have different configurations.
Here is the version 2.9.6 locale:
I specified "Source Code Pro Medium" as the font.
LANG has not been explicitly changed in profiles, bashrc, etc. I finally understood that @cjknarrow is set by the specified font.
I am working on developing fonts, so I am interested in "CJK properties of the font". What CJK fonts property does mintty refer to?
The font is considered "ambiguous-wide" if either of its characters U+03B1 (α) or U+2500 (box drawing light horizontal) are wide, i.e. more than 1.5 times the width of the letter 'A'.
If the font is not wide but the current locale is wide, in the sense that α is indicated to have double cell width, the locale is "fixed" to become not-wide by appending the "@cjknarrow" modifier to it.
(This would be overridden by setting Charwidth=ambig-wide.)
This procedure is applied only if you have a Locale setting in your configuration (config file or command-line).
Activity
mintty commentedon Oct 31, 2019
What's your
localein both cases?Note that U+2500 is a Unicode "ambiguous width" character.
BrianInglis commentedon Oct 31, 2019
TL;DR: UAX #11 quoted below states that East Asian Ambiguous width characters should be treated as Narrow in non-East Asian contexts (LtR/RtL); and Wide in known East Asian contexts (vertical rendering), such as given languages, scripts, fonts, or legacy character encodings: so unless
minttyis rendering known Wide characters in contexts such as the characters or lines above or below, East Asian Ambiguous should be rendered as East Asian Narrow by default, as suggested in the second last paragraph quoted below:"4 Definitions
...
ED6. East Asian Ambiguous (A): All characters that can be sometimes wide and sometimes narrow. Ambiguous characters require additional information not contained in the character code to further resolve their width.
Ambiguous characters occur in East Asian legacy character sets as wide characters, but as narrow (i.e., normal-width) characters in non-East Asian usage. (Examples are the basic Greek and Cyrillic alphabet found in East Asian character sets, but also some of the mathematical symbols.) Private-use characters are considered ambiguous by default, because additional information is required to know whether they should be treated as wide or narrow.
When they are treated as wide characters, ambiguous characters would typically be rendered upright in vertical text runs.
Because East Asian legacy character sets do not always include complete case pairs of Latin characters, two members of a case pair may have different East_Asian_Width properties:
Canonical equivalents of ambiguous characters may not be ambiguous themselves. For example,
U+212B Å ANGSTROM SIGNis Ambiguous, while its decomposition,U+00C5 Å LATIN CAPITAL LETTER A WITH RING ABOVE, is Neutral....
4.2 Ambiguous Characters
Ambiguous width characters are all those characters that can occur as fullwidth characters in any of a number of East Asian legacy character encodings. They have a “resolved” width of either narrow or wide depending on the context of their use. If they are not used in the context of the specific legacy encoding to which they belong, their width resolves to narrow. Otherwise, it resolves to fullwidth or halfwidth. The term context as used here includes extra information such as explicit markup, knowledge of the source code page, font information, or language and script identification. For example:
The East_Asian_Width property does not preserve canonical equivalence, because the base characters of canonical decompositions almost always have a different East_Asian_Width than the precomposed characters. East Asian Width is designed for use with legacy character sets so the property value is not designed to respect canonical equivalence.
Modern Rendering Practice. Modern practice is evolving toward rendering ever more of the ambiguous characters with proportionally spaced, narrow forms that rotate with the direction of writing, making a distinction within the legacy character set. In other words, context information beyond the choice of font or source character set is employed to resolve the width of the character. This annex does not attempt to track such changes in practice; therefore, the set of characters with mappings to legacy character sets that have been assigned ambiguous width constitute a superset of the set of such characters that may be rendered as wide characters in a given context. In particular, an application might find it useful to treat characters from alphabetic scripts as narrow by default. Conversely, many of the symbols in the Unicode Standard have no mappings to legacy character sets, yet they may be rendered as “wide” characters if they appear in an East Asian context. An implementation might therefore elect to treat them as ambiguous even though they are classified as neutral here.
5 Recommendations
When mapping Unicode to East Asian legacy character encodings
When mapping Unicode to non-East Asian legacy character encodings
When processing or displaying data
mintty commentedon Oct 31, 2019
Thanks for the reference. However, in the case of a terminal, the notion of "context" can hardly be resolved by anything else than "locale" because that's what the wcwidth/wcswidth API is based on and, in turn, this is the only API for an application to determine text width in a reliable way (unless the application would actually probe the terminal for the effective width in a number of cases).
This rules out any finer-grained concept of a text context suggested above, including the last statement about emoji presentation sequences.
In cygwin, you can force ambiguous characters to be rendered narrow by a locale modifier, e.g.
LC_ALL=zh_TW.utf8@cjknarrow mintty.avih commentedon Oct 31, 2019
Is it? It's one of the box drawing characters, and at least as a user I think it should be pretty clear they're "default" width.
BrianInglis commentedon Oct 31, 2019
Please consider that you have an issue raised by someone who appears to probably be in a CJK/East Asian locale complaining about incorrect rendering of ambiguous characters in a recent version, which appears to have incompatibly changed behaviour.
Please remember
minttyis in Cygwin base and must maintain backward compatibility for how ever many hundreds of thousands of users run it.Please remember that Cygwin has a strict backward compatibility requirement to not break existing installations with new features or changed defaults; that should be modifiable through detection of platform changes, otherwise explicit option settings.
None of us who have never had to select any narrowing in locales, should not have to start now, because of recent changes: they should be hidden behind options that maintain strictly backward compatible behaviour.
Character width should not be such an issue in a terminal emulator which renders mainly ASCII/Latin/Symbol characters in fixed cells.
Everything else should be the exception, so most of us can ignore it.
All fonts are fixed width, and most may now be using ISO-10646-1 encodings to handle their locales, so as character rendering is mainly LtR, and they are not legacy encodings, should default ambiguous to narrow: as far as I know vertical rendering is not a
minttyoption.All characters should be rendered within a fixed cell, by default without any manipulation: if a character width requires using the next cell, track that for wrapping and skip to the next boundary for the next character, but ignore it otherwise.
If options are needed to request making wide or fullwidth character glyphs narrower to fit in a regular monospace fixed font character cell, or CJK/East Asian character cells bigger than the regular monospace fixed font to default space to that of Wide or Fullwidth characters, then please consider supporting allowing those who need those features to select the appropriate options, assuming that information is readily available in or derivable from the font metrics, or an appropriate option is provided to ebnable such behavious, or add or change the metrics for each font and point size selected, if that is what is required, and then provide clear documentation of when and how to use each option, what is affected and how is it affected.
Folks should select fonts that result in characters rendered how they want to see them, given the restrictions of TrueType/OpenType fonts, ClearType, Uniscribe, Windows, and the platform limits.
I use an ISO-10646-1 font which clearly distinguishes similarly shaped Latin glyphs and provides a wide selection of other symbols, languages, and scripts, with generic fallbacks which show me groups and codes, for unsupported groups.
I would hate to have to return to using Windows fonts and encodings just to ensure stable character set rendering in the terminal.
Folks who have a problem with one character rendering in one font they chose should try some others, or configure their fonts and fallbacks to suit their requirements.
Please keep mintty a great, consistent, robust, generic terminal.
It is great to be responsive to those with major issues.
Please try to resist the urge to help everyone who as the easiest way with no cost and little effort to themselves to magically fix their minor issue signs up on github to ask for a code change, which may not be strictly orthogonal to, and may interact (badly) with, existing features, at the cost of possible bloat and instability to all Cygwin users (some of whom still appear to be happy using just cmd!)
If there are interactions, you may want to check and consider whether those issues are handled by PuTTY, xterm, and libncursesw, and if so, how.
If you choose to provide a fix, please require them to explicitly enable their special behaviour using a new .minttyrc option, without affecting the base of users.
If an option value has to be changed from the default, please require them to explicitly change that default in .minttyrc, without affecting the base of users.
Remember: a design is complete, not when there is nothing left to add, but when there is nothing left to remove.
The standard considers use of context essential to any use of East_Asian_Width, and also allows context to override East Asian Width.
If you choose not to use context, then please do not choose to treat Ambiguous as Wide, regardless of locale, outside of CJK/East Asian Wide or Fullwidth groups/ranges, as many LATIN named characters and normal symbols across many classes/categories are defined as Ambiguous:
mintty commentedon Oct 31, 2019
I absolutely agree that mintty should put priority on stability, and that's what I'm trying to achieve, no worries.
About this issue, the point is it does not reproduce for me, and my suspicion is that the user uses different locales in the two examples; that's what I was asking for, response pending.
And yes, U+2500 has ambiguous width.
mintty commentedon Oct 31, 2019
I should have stated this before: behaviour has not changed, to the best of my knowledge. U+2500 has always been wide when running mintty in an unmodified CJK locale, at least since 1.2.0.
BrianInglis commentedon Oct 31, 2019
In non-CJK/East Asian contexts and locales, where East_Asian_Width is irrelevant, I would also expect the following regular symbols to be rendered in default/neutral/regular/narrow width:
as well as the anomalous "Wide" symbols in the ranges:
rendered:
Ambiguous
Wide
Anomalous Wide in Narrow group
mintty commentedon Oct 31, 2019
Brian, I'm wondering by what reasoning you would expect wide characters to be displayed narrow. This is absolutely inconsistent with the POSIX locale mechanism. You may well question the categories in the Unicode database, and I would agree in a number of cases, but that's how we have them as a matter of life.
What you can do is create your own locale (and maybe even make it popular for inclusion in cygwin) which handles certain character widths in a more "reasonable" way, deviating from Unicode. That would work well.
BrianInglis commentedon Oct 31, 2019
Unicode says do not use East_Asian_Width except in CJK/East Asian conversion or rendering contexts; it says it is open to interpretation in context, so don't interpret without context.
How do PuTTY, xterm, libncursesw render Ambiguous, Wide, Fullwidth characters, and what did mintty originally? See Issue #88
That was why I suggested if glyph width > character cell, track and account for spacing and wrapping, otherwise ignore it; if followed immediately by white space, you can fudge it.
POSIX locale has nothing to do with and says little about encodings of which Unicode is one set: it mainly deals with character/byte mappings; here one character is one cell; anything else is an implementation detail of fonts.
Why should we who have used Cygwin for many years, and/or never used CJK/East Asian locales, have to change or do anything? We don't and should o' need to know or care about ambiguous, wide, or fullwidth characters if we don't use those languages: they're just more symbols to us, and each character should be handled as simply, verbatim, and vanilla as possible.
If different handling is required for other reasons, that should either be adapted automatically, if unambiguously required, or require explicit specification in an option.
We can not drift from providing mechanisms to setting policies: policies must be specifiable and/or able to be put into effect using the provided mechanisms.
mintty commentedon Oct 31, 2019
Brian, let's not confuse things here.
The recent glyph narrowing issue, which may still receive some tweaking perhaps or not, has nothing to do with this issue here. The glyph narrowing does not affect effective cell width.
This issue is about single/double cell width of a set of ambiguous-width characters.
And yes, this is related to the locale mechanism which defines the set of double-width characters via the wcwidth/wcswidth functions.
Mintty once changed its policy when to assign double-width to ambiguous-width. It used to be based on the font, which was no good approach; a cell-based terminal cannot depend on font properties to decide how wide text should render. Mintty switched to be based on the locale as other terminals do long ago, before I adopted the project.
In addition, both xterm and mintty have proprietary modes to apply their own width information with ambiguous-width interpreted either narrow or wide, overriding the locale.
Applying East Asian width properties to character rendering is standard in all modern terminals. You wouldn't want CJK characters to appear single-width, in the first place. Unicode statements do not match well to the use case of cell-based rendering, so they cannot be taken literally in all respects. Context-based narrow/wide decisions are not manageable for text-mode applications as I said before.
Finally, I think you were mislead by this issue report to assume anything had changed.
It has not, so let's calm down. I requested the reporter for additional diagnostic information which is still not available. My assumption suggests a user configuration effect. Should any specific environment cause any real incompatibility, this will be handled as a bug and fixed, but that would yet have to be demonstrated.
KazunariTsuboi commentedon Oct 31, 2019
Thank you very much for considering this issue.
My Locale is as follows in both cases:
Locale = ja_JP
Charset = UTF-8
As you mentioned in the previous comment, the display was improved when using locale modifiers.
Locale = ja_JP @ cjknarrow
I would like to express my heartfelt thanks for working on CJK characters issues.
mintty commentedon Nov 1, 2019
Thanks; you have apparently configured locale and charset explicitly in the mintty configuration.
This is somewhat tricky because it deviates from the idea that the shell may have about the locale, and in fact I see a difference between this configuration and simply running
LC_ALL=ja_JP.utf8 mintty. Please try the latter to compare.However, in either case, I see no difference between 2.9.6 and 3.0.6. Maybe you set LC_ALL (or LC_CTYPE or LANG) in addition in one case and not in the other?
mintty commentedon Nov 2, 2019
I have to add one detail to my description above:
If you specify explicit
LocaleandCharsetoptions (rather than just setting a locale variable before starting mintty, which would be preferrable), mintty still checks font properties and may append a @cjknarrow modifier to the locale, depending on CJK properties of the font. This would explain the two different screenshots, provided that configuration of mintty is different in the two cases as I assume.Again, this behaviour has not changed since mintty 0.6.1 at least.
KazunariTsuboi commentedon Nov 4, 2019
Thank you for the explanation.
Comparison using
LC_ALL = ja_JP.utf8 mintty. It was displayed well in 2.9.6, and the display of 3.0.6 was broken.Certainly, I found that the two versions have different configurations.
Here is the version 2.9.6 locale:
I specified "Source Code Pro Medium" as the font.
The locale of version 3.0.6 is as follows.
Here, I specified “Source Han Code JP R”.
LANG has not been explicitly changed in profiles, bashrc, etc. I finally understood that @cjknarrow is set by the specified font.
I am working on developing fonts, so I am interested in "CJK properties of the font". What CJK fonts property does mintty refer to?
mintty commentedon Nov 4, 2019
The font is considered "ambiguous-wide" if either of its characters U+03B1 (α) or U+2500 (box drawing light horizontal) are wide, i.e. more than 1.5 times the width of the letter 'A'.
If the font is not wide but the current locale is wide, in the sense that α is indicated to have double cell width, the locale is "fixed" to become not-wide by appending the "@cjknarrow" modifier to it.
(This would be overridden by setting Charwidth=ambig-wide.)
This procedure is applied only if you have a
Localesetting in your configuration (config file or command-line).KazunariTsuboi commentedon Nov 5, 2019
I'm finally able to understand what is written in Document!
Thank you very much.
mintty commentedon Nov 5, 2019
I'd appreciate if you confirm this is not a 3.0.6 issue (and maybe change the issue title).
You can cross-test your font variation to that aim.
mintty commentedon Nov 6, 2019
The behaviour clarified above is already described both in the manual page (setting
Locale=) and the wiki Tips (https://github.com/mintty/mintty/wiki/Tips#ambiguous-width-setting), so I'm closing the issue.Improved the manual page description a bit.
improve description of special wide/narrow locale adaptation (#938)
character attribute to enforce single/double width (#615, #979, #938, #…
mintty commentedon May 20, 2020
Released 3.1.5 with explicit character width attribute support.
visual double-width of symbols and emojis with subsequent space (#1104,