| 214 | } |
| 215 | |
| 216 | void FallbackFont_DrawText(struct DrawTextArgs* args, struct Bitmap* bmp, int x, int y, cc_bool shadow) { |
| 217 | cc_string left = args->text, part; |
| 218 | int size = args->font->size; |
| 219 | int scale = FallbackFont_GetScale(size); |
| 220 | char colorCode = 'f'; |
| 221 | const cc_uint8* rows; |
| 222 | BitmapCol color; |
| 223 | int i; |
| 224 | |
| 225 | if (shadow) { |
| 226 | x += 1 * scale; |
| 227 | y += 1 * scale; |
| 228 | } |
| 229 | |
| 230 | /* adjust coords to make drawn text match GDI fonts */ |
| 231 | y += (args->font->height - size) / 2; |
| 232 | |
| 233 | while (Drawer2D_UNSAFE_NextPart(&left, &part, &colorCode)) |
| 234 | { |
| 235 | color = Drawer2D_GetColor(colorCode); |
| 236 | if (shadow) color = GetShadowColor(color); |
| 237 | |
| 238 | for (i = 0; i < part.length; i++) |
| 239 | { |
| 240 | cc_uint8 c = part.buffer[i]; |
| 241 | if (c == ' ') { x += SPACE_WIDTH * scale; continue; } |
| 242 | |
| 243 | rows = FallbackFont_GetRows(c); |
| 244 | |
| 245 | Fallback_DrawCell(bmp, x, y, scale, rows, color); |
| 246 | x += Fallback_CellWidth(rows) * scale; |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | static void Fallback_PlotCell(int scale, const cc_uint8* rows, FallbackFont_Plotter plotter, void* ctx) { |
| 252 | int xx, srcX, dstX; |
no test coverage detected