ghaerr / microwindows

The Nano-X Window System
Other
648 stars 91 forks source link

font has background #87

Closed ChauncyZhang closed 1 month ago

ChauncyZhang commented 1 month ago

Hi, I found a question when I use nano-x to develop an desktop app. My device is a edge device, so it only has linux-fb. When I draw a text, I found font has black background, so how can I make it transparent? thx. like that. 2d25704b8102b6ae87eca17a4787704

ChauncyZhang commented 1 month ago

@ghaerr Hello, can you help me?

ChauncyZhang commented 1 month ago

here is the code GR_FONT_ID font = GrCreateFontEx(GR_FONT_SYSTEM_VAR, 100,100, NULL); GrSetGCFont(gc, font); GrText(wid, gc, x, y, buffer, strlen(buffer), GR_TFUTF8);

ghaerr commented 1 month ago

When a font glyph is drawn the foreground bits are drawn with the fg color, and the background bits with the bg color. Try turning off the background color being drawn using:

GrSetGCUseBackground(gc, 0);

This should cause only the foreground bits of the font to be drawn.

ChauncyZhang commented 1 month ago

OK,Thank you!That's cool!