src/text.c

changeset 256
60014484121c
parent 255
0e0a0bf4f7e4
equal deleted inserted replaced
255:0e0a0bf4f7e4 256:60014484121c
72 TTF_HORIZONTAL_ALIGN_RIGHT 72 TTF_HORIZONTAL_ALIGN_RIGHT
73 }; 73 };
74 TTF_SetFontWrapAlignment( 74 TTF_SetFontWrapAlignment(
75 font, alignments[text->base.flags & ASC_TEXT_ALIGNMENT_MASK]); 75 font, alignments[text->base.flags & ASC_TEXT_ALIGNMENT_MASK]);
76 SDL_Surface *surface = TTF_RenderText_Blended_Wrapped( 76 SDL_Surface *surface = TTF_RenderText_Blended_Wrapped(
77 font, text->text.ptr, text->text.length, asc_col_sdl(text->color), text->max_width 77 font, text->text.ptr, text->text.length, asc_color_sdl(text->color), text->max_width
78 ); 78 );
79 if (surface == NULL) { 79 if (surface == NULL) {
80 asc_error("Rendering TTF surface failed: %s", SDL_GetError()); 80 asc_error("Rendering TTF surface failed: %s", SDL_GetError());
81 return; 81 return;
82 } 82 }
148 text->max_width = args.max_width; 148 text->max_width = args.max_width;
149 text->font = args.font; 149 text->font = args.font;
150 if (text->font.size == 0) { 150 if (text->font.size == 0) {
151 text->font.size = 12; 151 text->font.size = 12;
152 } 152 }
153 if (asc_memcmpz(&args.color, sizeof(asc_col4i))) { 153 if (asc_memcmpz(&args.color, sizeof(asc_color))) {
154 text->color = ASC_RGB(255, 255, 255); 154 text->color = ASC_RGB(1, 1, 1);
155 } else { 155 } else {
156 text->color = args.color; 156 text->color = args.color;
157 } 157 }
158 if (args.text == NULL) { 158 if (args.text == NULL) {
159 text->text = cx_mutstr(strdup(" ")); 159 text->text = cx_mutstr(strdup(" "));

mercurial