57 if (asc_texture_uninitialized(&node->tex)) { |
57 if (asc_texture_uninitialized(&node->tex)) { |
58 asc_texture_init_rectangle(&node->tex); |
58 asc_texture_init_rectangle(&node->tex); |
59 } |
59 } |
60 |
60 |
61 // Render text onto a surface |
61 // Render text onto a surface |
62 // TODO: obtain TTF_Font from font cache once it is repaired |
62 TTF_Font *font = asc_font_load(node->font); |
63 TTF_Font *font = node->font.ptr; |
|
64 static int alignments[] = { |
63 static int alignments[] = { |
65 TTF_WRAPPED_ALIGN_LEFT, |
64 TTF_WRAPPED_ALIGN_LEFT, |
66 TTF_WRAPPED_ALIGN_CENTER, |
65 TTF_WRAPPED_ALIGN_CENTER, |
67 TTF_WRAPPED_ALIGN_RIGHT |
66 TTF_WRAPPED_ALIGN_RIGHT |
68 }; |
67 }; |
100 |
99 |
101 node->base.flags = args.alignment; |
100 node->base.flags = args.alignment; |
102 node->base.position.x = (float) args.x; |
101 node->base.position.x = (float) args.x; |
103 node->base.position.y = (float) args.y; |
102 node->base.position.y = (float) args.y; |
104 node->max_width = args.max_width; |
103 node->max_width = args.max_width; |
105 node->font = *asc_active_font; |
104 node->font = asc_active_font; |
106 node->color = asc_context.ink; |
105 node->color = asc_context.ink; |
107 if (args.text == NULL) { |
106 if (args.text == NULL) { |
108 node->text = cx_mutstr(strdup(" ")); |
107 node->text = cx_mutstr(strdup(" ")); |
109 } else { |
108 } else { |
110 node->text = cx_mutstr(strdup(args.text)); |
109 node->text = cx_mutstr(strdup(args.text)); |