1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Reorganized includes for new layout. New class - IImageLoader

This commit is contained in:
Ivan Savenko
2023-02-01 20:42:06 +02:00
parent 84dfcacafd
commit 108a42e4ba
109 changed files with 487 additions and 1109 deletions

View File

@ -9,20 +9,13 @@
*/
#pragma once
#include "../render/IFont.h"
VCMI_LIB_NAMESPACE_BEGIN
class JsonNode;
class Point;
VCMI_LIB_NAMESPACE_END
struct SDL_Surface;
struct SDL_Color;
typedef struct _TTF_Font TTF_Font;
class CBitmapFont;
class CBitmapHanFont;
/// supports multi-byte characters for such languages like Chinese
class CBitmapHanFont : public IFont
@ -45,23 +38,3 @@ public:
size_t getLineHeight() const override;
size_t getGlyphWidth(const char * data) const override;
};
class CTrueTypeFont : public IFont
{
const std::pair<std::unique_ptr<ui8[]>, ui64> data;
const std::unique_ptr<TTF_Font, void (*)(TTF_Font*)> font;
const bool blended;
std::pair<std::unique_ptr<ui8[]>, ui64> loadData(const JsonNode & config);
TTF_Font * loadFont(const JsonNode & config);
int getFontStyle(const JsonNode & config);
void renderText(SDL_Surface * surface, const std::string & data, const SDL_Color & color, const Point & pos) const override;
public:
CTrueTypeFont(const JsonNode & fontConfig);
size_t getLineHeight() const override;
size_t getGlyphWidth(const char * data) const override;
size_t getStringWidth(const std::string & data) const override;
};