fix font rendering
Some checks are pending
pyrite-dev/milsko/pipeline/head Build started...

This commit is contained in:
Nishi 2026-07-26 01:44:01 +09:00
commit 85b66d0d9a
9 changed files with 25 additions and 24 deletions

View file

@ -34,7 +34,6 @@ struct _MwLLGDI {
struct _MwLLGDIColor { struct _MwLLGDIColor {
struct _MwLLCommonColor common; struct _MwLLCommonColor common;
COLORREF color;
HBRUSH brush; HBRUSH brush;
}; };

View file

@ -64,7 +64,6 @@
#define MwNsubForeground "SsubForeground" #define MwNsubForeground "SsubForeground"
#define MwNtitleForeground "StitleForeground" #define MwNtitleForeground "StitleForeground"
#define MwNvulkanExtension "SEvulkanExtension" #define MwNvulkanExtension "SEvulkanExtension"
#define MwNvulkanLayer "SEvulkanLayer" #define MwNvulkanLayer "SEvulkanLayer"
#define MwNvulkanConfig "VEvulkanConfig" #define MwNvulkanConfig "VEvulkanConfig"

View file

@ -525,6 +525,7 @@ static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) { static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
HDC dc = GetDC(handle->gdi.hWnd); HDC dc = GetDC(handle->gdi.hWnd);
COLORREF color;
if(r > 255) r = 255; if(r > 255) r = 255;
if(g > 255) g = 255; if(g > 255) g = 255;
@ -533,9 +534,10 @@ static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
if(g < 0) g = 0; if(g < 0) g = 0;
if(b < 0) b = 0; if(b < 0) b = 0;
color = GetNearestColor(dc, RGB(r, g, b));
if(c->gdi.brush != NULL) DeleteObject(c->gdi.brush); if(c->gdi.brush != NULL) DeleteObject(c->gdi.brush);
c->gdi.color = GetNearestColor(dc, RGB(r, g, b)); c->gdi.brush = CreateSolidBrush(color);
c->gdi.brush = CreateSolidBrush(c->gdi.color);
c->common.red = r; c->common.red = r;
c->common.green = g; c->common.green = g;
c->common.blue = b; c->common.blue = b;

View file

@ -28,10 +28,10 @@ static int GDI_MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const c
tw = MwTextWidth(handle, ttf, text); tw = MwTextWidth(handle, ttf, text);
th = MwTextHeight(handle, ttf, text); th = MwTextHeight(handle, ttf, text);
if(handle->lowlevel->common.type == MwLLBackendGDI && MwGetInteger(handle, MwNmodernLook) == MwFALSE) { if(handle->lowlevel->common.type == MwLLBackendGDI) {
HFONT old_font = SelectObject(handle->lowlevel->gdi.hDC, ttf->font); HFONT old_font = SelectObject(handle->lowlevel->gdi.hDC, ttf->font);
int old_bkmode = SetBkMode(handle->lowlevel->gdi.hDC, TRANSPARENT); int old_bkmode = SetBkMode(handle->lowlevel->gdi.hDC, TRANSPARENT);
COLORREF old_color = SetTextColor(handle->lowlevel->gdi.hDC, color->gdi.color); COLORREF old_color = SetTextColor(handle->lowlevel->gdi.hDC, RGB(color->common.red, color->common.green, color->common.blue));
TextOut(handle->lowlevel->gdi.hDC, point->x, point->y - th / 2, t, strlen(t)); TextOut(handle->lowlevel->gdi.hDC, point->x, point->y - th / 2, t, strlen(t));

View file

@ -91,6 +91,7 @@ void MwDrawText(MwWidget handle, MwFLFont ttf, MwPoint* point, const char* text,
fadedColor->common.red = fadedColor->common.red + (c->common.red - fadedColor->common.red) * 0.5; fadedColor->common.red = fadedColor->common.red + (c->common.red - fadedColor->common.red) * 0.5;
fadedColor->common.green = fadedColor->common.green + (c->common.green - fadedColor->common.green) * 0.5; fadedColor->common.green = fadedColor->common.green + (c->common.green - fadedColor->common.green) * 0.5;
fadedColor->common.blue = fadedColor->common.blue + (c->common.blue - fadedColor->common.blue) * 0.5; fadedColor->common.blue = fadedColor->common.blue + (c->common.blue - fadedColor->common.blue) * 0.5;
MwLLColorUpdate(handle->lowlevel, fadedColor, fadedColor->common.red, fadedColor->common.green, fadedColor->common.blue);
MwLLFreeColor(c); MwLLFreeColor(c);
} }