wineconsole: Correctly handle TrueType font widths

Hugh McMaster hugh.mcmaster at outlook.com
Wed Nov 9 05:26:05 CST 2016


On Tuesday, 8 November 2016 2:25 AM, Akihiro Sagawa wrote:
> On Sun, 6 Nov 2016 22:56:17 +0000, Hugh McMaster wrote:
> > I agree that wineconsole should have two modes, but I'm not sure we need special handling for full width
> > characters in Western locales. Actually, I'm interested to find out how many full-width characters are in
> > SBCS locales.
> > 
> > How can we know whether a DBCS character needs one or two cells for rendering?
> SBCS mode:
> My test shows even Kanji characters use a one cell in SBCS console
> buffer. Thus, I guess no character occupies two cells. However, Kanji
> glyph has twice width of ASCII character. So, we need to consider them.

I did some testing on my Windows system with the locale set to Japanese.
The keyboard IME gave me Hiragana, full-width Katakana and alphanumeric,
and half-width Katakana and alphanumeric.

I couldn't type much in Japanese. Most of the keys gave me alphanumeric characters.
When using the full-width character set, each character (including alphanumeric) had
a lot of space surrounding it. Half-width characters appeared normally.

> DBCS mode:
> ASCII characters and half-width Katakana characters need one cell
 > buffer. Others, such as Kanji, need two cell buffers. Please note some
> symbols in ISO-8859-1 (e.g. multiplication sign) use two cell buffers in
> DBCS mode.

Language question: can half-width and full-width characters appear together
in the same sentence? I'm wondering how the console determines the width
required? Does it use some kind of WINAPI call for the character set?

> There is a font glyph issue, too. For instance, fixed-pitch Western font
> is designed multiplication sign as the same width as ASCII character (as
> seen in ISO-8859-1). But, it should have as the same width as Kanji for
> DBCS mode. It could be possible to reject Western-style font for DBCS
> console.

That seems fair. IIRC, @-prefixed Asian fonts are not allowed in the
SBCS Windows console.


More information about the wine-devel mailing list