OhmNomNom / thyme

A fork of mintty, for the modern world
GNU General Public License v3.0
0 stars 0 forks source link

Improve rendering of linedraw characters #130

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Support for linedraw characters in Windows fonts is rather patchy, and the
glyphs often don't fit together properly. Hence it would be worth bringing
back PuTTY's code for rendering the linedraw characters manually using GDI
drawing primitives.

Original issue reported on code.google.com by andy.koppe on 5 Sep 2009 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by andy.koppe on 28 Oct 2009 at 8:15

GoogleCodeExporter commented 9 years ago
PuTTY doesn't actually have anything like this; must've confused it with "poor 
man's 
line drawing" where '+', '-', and '|' are used instead of line drawing 
characters.

Original comment by andy.koppe on 31 Jan 2010 at 7:21

GoogleCodeExporter commented 9 years ago
FWIW, I've found the line-draw characters to work perfectly well, witness the 
attachment.
—Ken Nellis

Original comment by nelli...@gmail.com on 14 Sep 2010 at 4:33

Attachments:

GoogleCodeExporter commented 9 years ago
Indeed it seems like it works almost perfect in mintty, unlike in putty, though 
there are still some annoyances depending on selected font:

1) everything ideal with: Courier New, DejaVu Sans Mono, Lucida Console
2) vertical lines have gaps, like they are composed out out '|' with: Consolas, 
Courier, Fixedsys
3) every linedrawing character diplays as triangle pointed down: Terminal

This with Win7 using mc-4.7.2 on FreeBSD with term=xterm lang=pl_PL.UTF-8 
through msys' ssh.
I'd like to have it working better with fixedsys (no gaps) but it's already 
great.

On the other hand I can't get putty to work with such configuration - it always 
displays characters like lqqqkxxxt in place of lines.
Can someone point me to which revision fixed this so I can try backporting to 
putty ?

Original comment by mwisnicki@gmail.com on 14 Sep 2010 at 8:04

GoogleCodeExporter commented 9 years ago
Yep, those are the problems I referred to when talking about patchy support for 
linedrawing characters in Windows font.

Number 2) can partially be addressed actually, using the config-file only 
RowSpacing option (which I see I only ever mentioned in the 0.6.1 release 
announcement ...).

Putting 'RowSpacing=-1' into ~/.minttyrc works nicely for Consolas anyway, but 
unfortunately with Courier and Fixedsys the gaps are too big for this approach. 
There's no hope for Terminal, which simply doesn't have the necessary glyphs.

Mintty just uses the code for PuTTY's "Use Unicode line drawing code points" 
option. The other line drawing options are gone. (Regarding taking mintty code 
to PuTTY, do keep in mind that mintty is under GPL rather than the MIT license.)

Original comment by andy.koppe on 14 Sep 2010 at 9:32

GoogleCodeExporter commented 9 years ago
Is it possible to detect if font is missing glyphs (other than looking at 
pixels of rasterization output for familiar shapes) and enable poor man's line 
drawing.
Also, is it possible to generate custom glyphs use them as a replacement for 
font's broken glyphs ?

Re. putty:
Wierd, any idea why it works in mintty+ssh.exe but not in putty ?
I had set exact same settings and there are no differences in environment 
variables, yet putty does not work.
It works when I set NCURSES_NO_UTF8_ACS=1 which supposedly enables use of 
Unicode line drawing characters instead of using VT100. Putty does not support 
VT100 line drawing in UTF-8 mode [1], yet mintty somehow manages to draw them.

[1] 
http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/utf8-plus-vt100.html

Original comment by mwisnicki@gmail.com on 15 Sep 2010 at 1:26

GoogleCodeExporter commented 9 years ago
Thanks for the suggestions. I had a little look, GetGlyphIndices() is one way 
to find out which characters don't have glyphs associated with them, so perhaps 
that could be used to implement a fallback scheme. One thing to check would be 
whether that function takes font linking into account (which is GDI's scheme 
for replacing missing characters with glyphs from other fonts). I didn't see 
anything for inserting glyphs into existing fonts, but that wouldn't be 
qualitatively different from drawing the lines in place anyway.

Regarding VT100 line drawing in UTF-8 mode, turns out I did actually fix that, 
for the sake of xterm compatibility. That was at r331.

Original comment by andy.koppe on 16 Sep 2010 at 4:49

GoogleCodeExporter commented 9 years ago
I implemented a fallback scheme based on checking what glyphs are available in 
a font using GetGlyphIndices(). That's in r1022. (Apparently font linking is 
not taken into account, but in the case of the linedraw characters that had 
unsatisfactory results anyway.)

Leaving this issue open for the manual line drawing.

Original comment by andy.koppe on 19 Sep 2010 at 4:39