wineconsole: Correctly handle TrueType font widths

Hugh McMaster hugh.mcmaster at outlook.com
Thu Nov 3 03:37:45 CDT 2016


On Thursday, 3 November 2016 12:20 AM, Akihiro Sagawa wrote:
> On Tue, 1 Nov 2016 11:59:30 +0000, Hugh McMaster wrote:
> > -    config->cell_width  = tm.tmMaxCharWidth;
> > +    if (tm.tmPitchAndFamily & (TMPF_VECTOR | TMPF_TRUETYPE))
> > +        config->cell_width = tm.tmAveCharWidth;
> > +    else
> > +        config->cell_width = tm.tmMaxCharWidth;
> > +

> Why don't you use tmAveCharWidth value for raster (bitmap) fonts?
> Japanese fixed-pitch bitmap font, such as FixedSys (jvgafix.fon) or Terminal
> (not avaialble in wine), has a half value of tmMaxCharWidth for
> tmAveCharWidth. In other words, FixedSys shows tmAveCharWidth = 8,
> tmMaxCharWidth = 16.
> This works good in DBCS console window because full-width character (e.g.
> Kanji) occupies two cells.

Hi Akihiro,

On English-language and (most likely) Western European versions of Windows, the fixed-pitch raster font (Terminal) is rendered with tmMaxCharWidth. Fixed-pitch TrueType fonts are rendered with tmAveCharWidth.

I have verified this by writing tests using Terminal, Consolas, Lucida Console and Ubuntu Mono to output font width and height for multiple font sizes. I then compared the output to the information displayed in cmd.exe's font dialog. In each case, they are the same.

The patch I sent is correct, but as you pointed out, it causes problems with Kanji and similar DBCS fonts. Unfortunately, Alexandre's changes before code freeze have caused major problems.

Do you know if there is a way to detect Kanji and similar fonts, so we can set the cell width appropriately? Obviously, it would be best to fix wineconsole's DBCS support, but until then, we might be able to find a workaround that handles character width for all languages.

Hugh


More information about the wine-devel mailing list