26 */ |
26 */ |
27 |
27 |
28 #include "ascension/text.h" |
28 #include "ascension/text.h" |
29 |
29 |
30 #include "ascension/error.h" |
30 #include "ascension/error.h" |
31 #include "ascension/context.h" |
|
32 #include "ascension/shader.h" |
31 #include "ascension/shader.h" |
33 #include "ascension/constants.h" |
32 #include "ascension/constants.h" |
34 |
33 |
35 #include <assert.h> |
34 #include <assert.h> |
36 #include <cx/printf.h> |
35 #include <cx/printf.h> |
151 asc_ptr_cast(AscSceneNode, node, text); |
150 asc_ptr_cast(AscSceneNode, node, text); |
152 |
151 |
153 // text properties |
152 // text properties |
154 node->flags = args.alignment; // use flags variable to save some space |
153 node->flags = args.alignment; // use flags variable to save some space |
155 text->max_width = args.max_width; |
154 text->max_width = args.max_width; |
156 text->font = asc_active_font; |
155 text->font = args.font; |
157 text->color = asc_context.ink; |
156 if (text->font.size == 0) { |
|
157 text->font.size = 12; |
|
158 } |
|
159 if (asc_memcmpz(&args.color, sizeof(asc_col4i))) { |
|
160 text->color = ASC_RGB(255, 255, 255); |
|
161 } else { |
|
162 text->color = args.color; |
|
163 } |
158 if (args.text == NULL) { |
164 if (args.text == NULL) { |
159 text->text = cx_mutstr(strdup(" ")); |
165 text->text = cx_mutstr(strdup(" ")); |
160 } else { |
166 } else { |
161 text->text = cx_mutstr(strdup(args.text)); |
167 text->text = cx_mutstr(strdup(args.text)); |
162 } |
168 } |