After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778122 - I don't like the rendering of Unicode "shade" chars
I don't like the rendering of Unicode "shade" chars
Status: RESOLVED OBSOLETE
Product: vte
Classification: Core
Component: general
0.46.x
Other Linux
: Normal normal
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-03 08:05 UTC by Igor
Modified: 2021-06-10 15:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Manually render the dots (2.25 KB, patch)
2017-02-05 22:07 UTC, Egmont Koblinger
none Details | Review
Screenshot (4.52 KB, image/png)
2017-02-05 22:26 UTC, Egmont Koblinger
  Details
Manually render - equal sized, antialiased (2.17 KB, patch)
2017-02-16 20:53 UTC, Egmont Koblinger
none Details | Review
Screenshot - equal sized, antialiased (5.47 KB, image/png)
2017-02-16 20:56 UTC, Egmont Koblinger
  Details

Description Igor 2017-02-03 08:05:37 UTC
vte fails to render Unicode "shade" chars (U+2591 - U+2593): ░, ▒, ▓. It renders them as solid rectangles while they should be dotted.
xterm, using the same font (Hack Regular in my case), renders the chars properly.
Thanks.
Comment 1 Egmont Koblinger 2017-02-03 09:16:04 UTC
As all the glhphs in the 2500–259F range, they are drawn manually in vtedraw.cc _vte_draw_terminal_draw_graphic(), rather than taken from the font. This is because in most fonts these line drawing etc. characters do not align properly, do not properly fill up the entire width and height of the cell, antialiasing kicking in looks ugly etc.

The official name of these particular three are LIGHT, MEDIUM and DARK SHADE.

Imagine that we just draw the desired pattern with much smaller dots, and apply antialiasing on top of that. That's what we do :)

With the dotted look, you either go for a fixed amount/layout of dots, in which case antialiasing might look ugly, or for a fixed dot size, in which case the patters do not align on cell boundaries, and also increasing the font size doesn't do what you'd expect. So maybe the first is still the better.

I'm not against this change at all (in fact, these three glyphs do look weird to me too), I'm just wondering about possible downsides, and I'm also arguing that the current implementation is not necessarily broken per se.
Comment 2 Igor 2017-02-03 14:21:26 UTC
Egmont,
I think fixed amount of dots approach would be fine - for example, Firefox is using it, and the dots are still looking good even with the max zoom which is 300%.
In my opinion, it's better to show the dots, even having a risk of blurring them when a high font size is set, than showing solid rectangles which do not look right at all.
Comment 3 Egmont Koblinger 2017-02-03 15:09:42 UTC
I think you see a fixed amount of dots in Firefox simply because it doesn't treat this symbol specially. It just takes it from the font. This presumably means a fixed amount of dots within a font, but probably a different look, varying number of dots across fonts.

In VTE you can easily disable the special handling of these codepoints by excluding them from the interval in vtedraw.cc _vte_draw_unichar_is_local_graphic().

I guess we should check with quite a few monospace fonts whether it looks "good enough", which is obviously not something well-defined concept.

Manually replicating the pattern of any of these fonts should also be a piece of cake.

With my preferred font ("Monospace Regular 10", whatever that means), even when zooming in/out a bit, my eyes perceive weird things happening when I place more of these glyps next to / underneath each other. It doesn't feel gray, I can see lots of red-ish and green-ish tiny dots. The overall shade (whether it feels blue-ish or red-ish or green-ish gray) changes as I zoom in/out.  Also it feels like the typical interference thingy is going on (well, sure it is behind the story).

E.g. at the default zoom, black on white, a block of MEDIUM shades looks red-ish, whereas a block of DARK shades is yellow-green-ish gray.

As the LCD panel with its subpixel ordering also takes an important role in this game, I cannot demonstrate it with regular screenshots. Maybe I'll take photos with a camera if really required.
Comment 4 Egmont Koblinger 2017-02-03 15:26:10 UTC
I've created a test pattern, we {c,sh}ould add it to doc/boxes.txt:

                                ████████████████████████████████
     ░░░░░     ▒▒▒▒▒     ▓▓▓▓▓  ██▓▓▓▓▓█████▒▒▒▒▒█████░░░░░█████
  ░  ░░░░░  ▒  ▒▒▒▒▒  ▓  ▓▓▓▓▓  ██▓▓▓▓▓██▓██▒▒▒▒▒██▒██░░░░░██░██
     ░░░░░     ▒▒▒▒▒     ▓▓▓▓▓  ██▓▓▓▓▓█████▒▒▒▒▒█████░░░░░█████
                                ████████████████████████████████
Comment 5 Christian Persch 2017-02-03 19:52:44 UTC
Sure, add that to boxes.txt.

As to the rendering of these characters, I don't see a problem. In fonts, and historic terminals, they look like that because that's what you have to do when you only have monochrome and need to dither to represent greyshades in ultra-low resolution. Now that we don't have monochrome displays with low resolution anymore, we can draw them better, and that's what we do.

-> WONTFIX
Comment 6 Igor 2017-02-05 16:05:18 UTC
Hi Christian,

Will all due respect, I cannot agree with you. It seems that all other apps, including browsers and text editors, are showing these chars in a dotted way; why should vte be trying to be holier than the pope?
Thanks.
Comment 7 Christian Persch 2017-02-05 19:59:42 UTC
It's fine to disagree; after all I disagree with you, too :-)
Comment 8 Christian Persch 2017-02-05 20:03:10 UTC
I've added the test from comment 4 to boxes.txt now. Comparing the rendering of older vte, current vte, xterm, urxvt and konsole, the one from current console looks much nicer than all the others to me.
Comment 9 Christian Persch 2017-02-05 20:03:38 UTC
...the one from current *vte*...
Comment 10 Egmont Koblinger 2017-02-05 22:06:27 UTC
I cast a weak vote for Igor's preference. It's rendered as dots everywhere, hence it's probably the expected behavior, VTE is the odd one out there.

Also, with true color support available, there's not much point in having three separate glyphs just to get a sold color. (Okay, I know, it's terribly cumbersome to get the exact RGB of the palette colors, and many libs don't support true color, and what if the user wants to use these glyps in a context where he cannot add colors...)

I've created a proof of concept for a manual, antialias-free rendering of a fixed look (fixed amounts of dots) with rounding as per the EIGHTH macro and the corresponding glyphs. I'm not even attaching the code or a screenshot. It looks terribly awful, trust me.

Then I created a PoC for repeating a fixed pattern, increasing the dot size as the font size increases (but keeping it always an integer, so still no antialiasing happens), and let the pattern finish at the right and bottom edges in whichever phase it finishes. It looks surprisingly good. Definitely better than the antialiased glyphs. IMO better than the current grayshades too.
Comment 11 Egmont Koblinger 2017-02-05 22:07:21 UTC
Created attachment 344998 [details] [review]
Manually render the dots
Comment 12 Egmont Koblinger 2017-02-05 22:26:06 UTC
Created attachment 344999 [details]
Screenshot

Screenshot comparing the two, with 33;44;1 colors (Linux console color scheme).
Comment 13 Christian Persch 2017-02-05 22:42:19 UTC
IMHO the apparent dividing line that the dots create when two of these characters meet vertically is rather ugly...
Comment 14 Egmont Koblinger 2017-02-05 23:03:15 UTC
Well, sure not ideal, but there's not much to do about it... I mean, choose a font size of even pixels in both dimensions :)

(I was also thinking about aligning the pattern of each cell to the global canvas. In that case, though, a single cell is painted differently depending on where it is on the screen. That'd probably be even worse.)

On the other hand, it might actually be desirable to see the boundary between such cells.

In the mean time, I'm wondering why the overall perceived colors are so different in the two cases (especially with the light shade, the leftmost squares on the screenshots). Do you happen to know? I think it boils down to color computation being a way more complex math story than just applying the other color with a 25/50/75% alpha. In which case it's another reason to use the dotted pattern rather than the solid color. Or does it rather depend on the monitor?

(It sucks that i's quite hard to talk about it since you might be seeing totally different colors than me, and attaching a photo taken by a camera [which we'd all again view on our own computers] might not help either.)
Comment 15 Christian Persch 2017-02-06 19:15:53 UTC
I did notice that the colours seem off, too, but the rendering was a bigger concern for me :-)
Comment 16 Egmont Koblinger 2017-02-06 19:43:34 UTC
Seeing the significant difference in colors (and having verified that the colors are indeed "correct" according to the trivial way of computing them), I'm changing my "weak vote" to a "strong vote" for the dotted version :D
Comment 17 Christian Persch 2017-02-16 18:43:01 UTC
I'm open to being convinced that the colours in the current rendering are wrong, but I'm not prepared to accept a rendering of the characters where there's a discontinuity when the characters are placed either horizontally or vertically adjacent.
Comment 18 Egmont Koblinger 2017-02-16 20:07:53 UTC
In that case we have to sacrifice the "no antialias" goal (which is there in pretty much all other manually drawn glyps, perhaps the diagonal lines being the only exceptions).

I'll give it a try.
Comment 19 Egmont Koblinger 2017-02-16 20:53:28 UTC
Created attachment 345997 [details] [review]
Manually render - equal sized, antialiased

Here's a PoC patch. For the time being, manually try "xn = 4, yn = 8" and other values.

IMO the way the dots interfere with the LCD pixels look significantly worse than the discontinuity in the previous version.
Comment 20 Egmont Koblinger 2017-02-16 20:56:02 UTC
Created attachment 345998 [details]
Screenshot - equal sized, antialiased
Comment 21 Egmont Koblinger 2017-02-16 21:38:32 UTC
Also note that this latest patch is quite slow -- do a "cat doc/boxes.txt" and zoom in/out, you'll see a significant slowdown compared to previous versions.
Comment 22 Christian Persch 2017-03-20 21:25:55 UTC
I'm still not convinced, but let's reopen this while we're still discussing it, so it won't get lost.

(In reply to Egmont Koblinger from comment #18)
> In that case we have to sacrifice the "no antialias" goal

I'd rather go with global coordinates (comment 14).

(In reply to Egmont Koblinger from comment #21)
> Also note that this latest patch is quite slow -- do a "cat doc/boxes.txt"
> and zoom in/out, you'll see a significant slowdown compared to previous
> versions.

I think that's due to drawing each pixel separately and there being so many of them. That should be easy to fix: create static datas representing a 8x8 (or 16x16, 32x32) of each of the dithering patterns for use in a CAIRO_FORMAT_A1 surface; create a cairo_pattern_t for that surface and use that as the source for the cairo_fill() in the U+2591..U+2593 case. (Benchmark which surface size is fastest at different zoom levels/screen DPIs.)
Comment 23 Egmont Koblinger 2018-05-11 19:40:32 UTC
A counter opinion from https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1770494:

"in Ubuntu Gnome terminal it is rendered as a cursor that is the color of a 50% blend between the background and foreground color, making it the best appearing terminal I've used"
Comment 24 GNOME Infrastructure Team 2021-06-10 15:18:51 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vte/-/issues/2372.