1 /***************************************************************************** 2 * Copyright (c) 2014-2020 OpenRCT2 developers 3 * 4 * For a complete list of all authors, please refer to contributors.md 5 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 6 * 7 * OpenRCT2 is licensed under the GNU General Public License version 3. 8 *****************************************************************************/ 9 10 #pragma once 11 12 #include "Font.h" 13 14 #include <string_view> 15 16 bool ttf_initialise(); 17 void ttf_dispose(); 18 19 #ifndef NO_TTF 20 21 struct TTFSurface 22 { 23 const void* pixels; 24 int32_t w; 25 int32_t h; 26 int32_t pitch; 27 }; 28 29 TTFFontDescriptor* ttf_get_font_from_sprite_base(FontSpriteBase spriteBase); 30 void ttf_toggle_hinting(); 31 TTFSurface* ttf_surface_cache_get_or_add(TTF_Font* font, std::string_view text); 32 uint32_t ttf_getwidth_cache_get_or_add(TTF_Font* font, std::string_view text); 33 bool ttf_provides_glyph(const TTF_Font* font, codepoint_t codepoint); 34 void ttf_free_surface(TTFSurface* surface); 35 36 // TTF_SDLPORT 37 int TTF_Init(void); 38 TTF_Font* TTF_OpenFont(const char* file, int ptsize); 39 int TTF_GlyphIsProvided(const TTF_Font* font, codepoint_t ch); 40 int TTF_SizeUTF8(TTF_Font* font, const char* text, int* w, int* h); 41 TTFSurface* TTF_RenderUTF8_Solid(TTF_Font* font, const char* text, uint32_t colour); 42 TTFSurface* TTF_RenderUTF8_Shaded(TTF_Font* font, const char* text, uint32_t fg, uint32_t bg); 43 void TTF_CloseFont(TTF_Font* font); 44 void TTF_SetFontHinting(TTF_Font* font, int hinting); 45 int TTF_GetFontHinting(const TTF_Font* font); 46 void TTF_Quit(void); 47 48 #endif // NO_TTF 49