| 517 | #endif // DISABLE_TTF |
| 518 | |
| 519 | static void processFormatCode(RenderTarget& rt, const FmtString::Token& token, TextDrawInfo& info) |
| 520 | { |
| 521 | switch (token.kind) |
| 522 | { |
| 523 | case FormatToken::move: |
| 524 | info.current.x = info.start.x + token.parameter; |
| 525 | break; |
| 526 | case FormatToken::newline: |
| 527 | info.current.x = info.start.x; |
| 528 | info.current.y += FontGetLineHeight(info.fontStyle); |
| 529 | break; |
| 530 | case FormatToken::newlineSmall: |
| 531 | info.current.x = info.start.x; |
| 532 | info.current.y += FontGetLineHeightSmall(info.fontStyle); |
| 533 | break; |
| 534 | case FormatToken::fontTiny: |
| 535 | info.fontStyle = FontStyle::tiny; |
| 536 | break; |
| 537 | case FormatToken::fontSmall: |
| 538 | info.fontStyle = FontStyle::small; |
| 539 | break; |
| 540 | case FormatToken::fontMedium: |
| 541 | info.fontStyle = FontStyle::medium; |
| 542 | break; |
| 543 | case FormatToken::outlineEnable: |
| 544 | info.colourFlags.set(ColourFlag::withOutline); |
| 545 | break; |
| 546 | case FormatToken::outlineDisable: |
| 547 | info.colourFlags.unset(ColourFlag::withOutline); |
| 548 | break; |
| 549 | case FormatToken::colourWindow1: |
| 550 | { |
| 551 | info.palette = colourCharacterWindow(gCurrentWindowColours[0], info.colourFlags.has(ColourFlag::withOutline)); |
| 552 | break; |
| 553 | } |
| 554 | case FormatToken::colourWindow2: |
| 555 | { |
| 556 | info.palette = colourCharacterWindow(gCurrentWindowColours[1], info.colourFlags.has(ColourFlag::withOutline)); |
| 557 | break; |
| 558 | } |
| 559 | case FormatToken::colourWindow3: |
| 560 | { |
| 561 | info.palette = colourCharacterWindow(gCurrentWindowColours[2], info.colourFlags.has(ColourFlag::withOutline)); |
| 562 | break; |
| 563 | } |
| 564 | case FormatToken::inlineSprite: |
| 565 | { |
| 566 | auto imageId = ImageId(token.parameter); |
| 567 | auto g1 = GfxGetG1Element(imageId); |
| 568 | if (g1 != nullptr && g1->width <= 32 && g1->height <= 32) |
| 569 | { |
| 570 | if (!info.textDrawFlags.has(TextDrawFlag::noDraw)) |
| 571 | { |
| 572 | GfxDrawSprite(rt, imageId, info.current); |
| 573 | } |
| 574 | info.current.x += g1->width; |
| 575 | } |
| 576 | break; |
no test coverage detected