AustinJ235 / basalt

A rust library that provides window creation, input handling, and most importantly a UI.
MIT License
149 stars 5 forks source link

Blurry text rendering #10

Closed strowbeary closed 2 years ago

strowbeary commented 4 years ago

Hello, I have a blurry text on linux (Arch, gnome x11, nvidia driver) Capture d’écran du 2020-07-06 16-39-28

AustinJ235 commented 4 years ago

Is this the latest version? 0.8.1. Ilmenite (the font parser/shaper/rasterer behind Basalt) is very much an in progress project for me. Right now it is best to stick to inverse color of the background, so white on black or black on white for example and sticking above or at 12px text height.

Also, this may effect some users, if your monitor's sub pixels aren't R-G-B aligned, rastered glyphs may not be optimal.

It'll probably be towards this weekend when I can look at working on my projects some more. At work we are currently working 10hr days and it is 100+°F in the factory so I am pretty low on energy by the end of the day.

strowbeary commented 4 years ago

It is the latest version. Maybe you will be able to use the font renderer of servo when it will be stable enough ? No problem, I was just wondering if this bug was known or if it's happening only on my machine with my configuration. Good work by the way. I'm just beginning in computer graphics programming but if you need help tell me ;)

AustinJ235 commented 4 years ago

I did look into using pathfinder at one point. It still wouldn't handle parsing or shaping yet. It also lacks support for vulkan, so it would be weird to bring into basalt that uses vulkano. I used to use freetype and harfbuzz, but I really didn't enjoy working with ffi projects and dealing with the bindings.

I am always open to some help on the project, especially if you find some things weird coming from the outside. I mainly come from a background with html/css so that is where most of the inspiration comes from, although I am told my project is similar to GTK.

Ilmenite is fairly recent addition created around the same time that allsorts was released publicly which is what makes the parsing and shaping possible. The rasterization is gpu based using ray tracing. The results seem promising as my glyphs appear to be more accurate, just struggling with different colors, and alpha mixing. I did land on some sort of sub pixeling hinting that seems to work fairly well with black on white and white on black, so I went along with a release since it had been a while.

nxfs commented 3 years ago

I am also seeing this issue, for standard black font over white. Using ubuntu 20.04, gnome x11 with integrated GPU (Intel Corporation HD Graphics 620). Will see if I can dig a bit deeper.

AustinJ235 commented 3 years ago

@nxfs I have made some progress on improving text clarity. My rasterization technique doesn't seem to be at fault. There were some things going on that could cause some issues.

I will make some more changes to ilmenite likely within the next week or so. Including more than likely scaling support in ilmenite to remove the wonkyness that emulates it in Basalt right now. The pull request for the incoming version of ilmenite is https://github.com/AustinJ235/basalt/pull/21.

This is what it looks like on my system currently: current_state

AustinJ235 commented 3 years ago

There is definitely an improvement in light on dark, but dark on light seems a bit weird yet possibly.

AustinJ235 commented 3 years ago

Text rendering for anything other than white on black is incorrect.

I have done some further research into what is the proper way of doing text blending. Blending for text is a bit more complicated that originally thought. The main problem that arises is that currently the interface is rendered in a single pass. In order for text (especially with hinting) it is required to know the color that it is being rendered upon.

There are multipass solutions that can solve the blending issue, but keeping the future in mind, I am thinking of all potential solutions. Things such as having shadows around Bin's or text, having a blurred transparent background (for them fancy ui's), and other more advance features require more context. A single render pass isn't enough for this.

AustinJ235 commented 2 years ago

As of version 0.12 released on October 3rd, 2021, the interface now implements layered rendering with component aware alpha blending. Colored text should be more desirable as of that release. Ilmenite is still a work in progress with some room to improve, but I think that is beyond the scope of this issue.