snowie2000 / mactype

Better font rendering for Windows.
https://mactype.net
GNU General Public License v3.0
10.14k stars 444 forks source link

[FEATURE] Add GDI text alpha blending fix #1000

Open Undisputed00x opened 4 months ago

Undisputed00x commented 4 months ago

Hi there, could you add a feature that fixes text alpha on GDI text, this issue is visible when having Acrylic blur windows by using MicaForEveryone with DwmExtendFrameIntoClientArea function . Enabling DirectWrite doesn't fix the problem. Here some articles that discuss this problem 1 2. This project ExplorerBlurMica that enables custom windows effects including acrylic blur has fixed this problem here

### Examples of problem

https://github.com/user-attachments/assets/932bf04a-9761-4b95-936d-8948c514f8b5 ![SPOILER_PROBLEM1](https://github.com/user-attachments/assets/f030dce2-d92a-4759-a5fd-f5a599b715a8) ![SPOILER_PROBLEM_2](https://github.com/user-attachments/assets/6efe3468-2006-4002-b0c6-70f734dc653d)

### Fix of problem

![SPOILER_EBM](https://github.com/user-attachments/assets/0624be8d-c240-45cf-83ae-05306a4f2bb6)

snowie2000 commented 4 months ago

The standard Windows GDI drawtext call sets the alpha bit to 0 if the text color (a.k.a the painter color) is black or leaves whatever alpha bit is for all other colors. MacType follows the same rule to mantain max compatibility.

If you got the same result without mactype and needs a third-party app to "fix" the problem, that's a problem of the Windows by design and shouldn't be handled by mactype.

snowie2000 commented 4 months ago

As of the Alpha bit problem in GlassFrame windows, I know it long ago. MacType has the ability to change alpha bit and was deliberately not touching it: https://github.com/snowie2000/mactype/blob/c3a52fc5343641d5e91841674380c805edbbdcdd/ft.cpp#L387-L403

Undisputed00x commented 4 months ago

If you got the same result without mactype and needs a third-party app to "fix" the problem, that's a problem of the Windows by design and shouldn't be handled by mactype.

Yeah, i know that's Windows own problem but i can't find any third party project that is closer to make a change on this issue systemwide other than mactype.

As of the Alpha bit problem in GlassFrame windows, I know it long ago. MacType has the ability to change alpha bit and was deliberately not touching it:

https://github.com/snowie2000/mactype/blob/c3a52fc5343641d5e91841674380c805edbbdcdd/ft.cpp#L387-L403

If i set 255 on alpha variables of that fuction is it going to make text opaque on glass background ?

EDIT: uhm if it's not a problem for you can you share a compiled version with the alpha changes here to test ?😅