Mercurial > molko
comparison libmlk-core/mlk/core/font.c @ 547:c7664b679a95
misc: remove error codes for now
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 06 Mar 2023 20:03:00 +0100 |
parents | 338a4436e255 |
children | 6271599928d4 |
comparison
equal
deleted
inserted
replaced
546:b7da58230a66 | 547:c7664b679a95 |
---|---|
32 { | 32 { |
33 assert(font); | 33 assert(font); |
34 assert(path); | 34 assert(path); |
35 | 35 |
36 if (!(font->handle = TTF_OpenFont(path, size))) | 36 if (!(font->handle = TTF_OpenFont(path, size))) |
37 return MLK_ERR_SDL; | 37 return mlk_errf("%s", SDL_GetError()); |
38 | 38 |
39 return 0; | 39 return 0; |
40 } | 40 } |
41 | 41 |
42 int | 42 int |
50 | 50 |
51 SDL_RWops *ops; | 51 SDL_RWops *ops; |
52 | 52 |
53 if (!(ops = SDL_RWFromConstMem(buffer, buflen)) || | 53 if (!(ops = SDL_RWFromConstMem(buffer, buflen)) || |
54 (!(font->handle = TTF_OpenFontRW(ops, 1, size)))) | 54 (!(font->handle = TTF_OpenFontRW(ops, 1, size)))) |
55 return MLK_ERR_SDL; | 55 return mlk_errf("%s", SDL_GetError()); |
56 | 56 |
57 return 0; | 57 return 0; |
58 } | 58 } |
59 | 59 |
60 int | 60 int |
86 func = TTF_RenderUTF8_Solid; | 86 func = TTF_RenderUTF8_Solid; |
87 break; | 87 break; |
88 } | 88 } |
89 | 89 |
90 if (!(surface = func(font->handle, text, fg))) | 90 if (!(surface = func(font->handle, text, fg))) |
91 return MLK_ERR_SDL; | 91 return mlk_errf("%s", SDL_GetError()); |
92 | 92 |
93 return mlk__texture_from_surface(tex, surface); | 93 return mlk__texture_from_surface(tex, surface); |
94 } | 94 } |
95 | 95 |
96 unsigned int | 96 unsigned int |
111 *w = 0; | 111 *w = 0; |
112 if (h) | 112 if (h) |
113 *h = 0; | 113 *h = 0; |
114 | 114 |
115 if (TTF_SizeUTF8(font->handle, text, (int *)w, (int *)h) != 0) | 115 if (TTF_SizeUTF8(font->handle, text, (int *)w, (int *)h) != 0) |
116 return MLK_ERR_SDL; | 116 return mlk_errf("%s", SDL_GetError()); |
117 | 117 |
118 return 0; | 118 return 0; |
119 } | 119 } |
120 | 120 |
121 void | 121 void |