src/text.c

changeset 214
9d460888a83e
parent 212
90bbacb97cb6
--- a/src/text.c	Thu Jul 17 20:26:39 2025 +0200
+++ b/src/text.c	Fri Jul 18 18:01:41 2025 +0200
@@ -28,7 +28,6 @@
 #include "ascension/text.h"
 
 #include "ascension/error.h"
-#include "ascension/context.h"
 #include "ascension/shader.h"
 #include "ascension/constants.h"
 
@@ -153,8 +152,15 @@
     // text properties
     node->flags = args.alignment; // use flags variable to save some space
     text->max_width = args.max_width;
-    text->font = asc_active_font;
-    text->color = asc_context.ink;
+    text->font = args.font;
+    if (text->font.size == 0) {
+        text->font.size = 12;
+    }
+    if (asc_memcmpz(&args.color, sizeof(asc_col4i))) {
+        text->color = ASC_RGB(255, 255, 255);
+    } else {
+        text->color = args.color;
+    }
     if (args.text == NULL) {
         text->text = cx_mutstr(strdup(" "));
     } else {

mercurial