/** * @file text_render.hpp * * Text rendering. */ #pragma once #include #include #include "DiabloUI/ui_item.h" #include "engine.h" namespace devilution { enum GameFontTables : uint8_t { GameFontSmall, GameFontMed, GameFontBig, }; enum text_color : uint8_t { COL_WHITE, COL_BLUE, COL_RED, COL_GOLD, COL_BLACK, }; extern const uint8_t gbFontTransTbl[256]; extern const uint8_t fontframe[3][128]; extern const uint8_t fontkern[3][68]; extern std::optional pPanelText; extern std::optional pMedTextCels; extern std::optional BigTGold_cel; extern std::optional pSPentSpn2Cels; void InitText(); void FreeText(); /** * @brief Print letter to the given buffer * @param out The buffer to print to * @param sx Backbuffer offset * @param sy Backbuffer offset * @param nCel Number of letter in Windows-1252 * @param col text_color color value */ void PrintChar(const CelOutputBuffer &out, int sx, int sy, int nCel, text_color col); int GetLineWidth(const char *text, GameFontTables size = GameFontSmall); void WordWrapGameString(char *text, size_t width, size_t size = GameFontSmall); void DrawString(const CelOutputBuffer &out, const char *text, const SDL_Rect &rect, uint16_t flags = 0, bool drawTextCursor = false); int PentSpn2Spin(); } // namespace devilution