23 #ifndef _SWE_FONTRENDER_ 24 #define _SWE_FONTRENDER_ 26 #include "swe_types.h" 27 #include "swe_surface.h" 28 #include "swe_binarybuf.h" 29 #include "swe_cunicode_color.h" 48 #if (SDL_VERSIONNUM(SDL_TTF_MAJOR_VERSION, SDL_TTF_MINOR_VERSION, SDL_TTF_PATCHLEVEL) <= SDL_VERSIONNUM(2, 0, 10)) 49 #define TTF_STYLE_STRIKETHROUGH 0x08 50 #define TTF_HINTING_NORMAL 0 51 #define TTF_HINTING_LIGHT 1 52 #define TTF_HINTING_MONO 2 53 #define TTF_HINTING_NONE 3 56 #ifdef SWE_DISABLE_TTF 57 #define TTF_STYLE_NORMAL 0 58 #define TTF_STYLE_BOLD 0x01 59 #define TTF_STYLE_ITALIC 0x02 60 #define TTF_STYLE_UNDERLINE 0x04 61 #define TTF_STYLE_STRIKETHROUGH 0x08 62 #define TTF_HINTING_NORMAL 0 63 #define TTF_HINTING_LIGHT 1 64 #define TTF_HINTING_MONO 2 65 #define TTF_HINTING_NONE 3 109 int operator()(
void)
const;
111 int style(
void)
const;
130 FontID() : val1(0), val2(0) {}
133 int operator()(
void)
const;
134 int value(
void)
const;
135 bool operator<(
const FontID &)
const;
136 bool operator>(
const FontID &)
const;
137 bool operator==(
const FontID &)
const;
140 int size(
void)
const;
161 virtual const FontID & id(
void)
const = 0;
162 virtual bool isValid(
void)
const = 0;
163 virtual bool isTTF(
void)
const = 0;
165 virtual Size stringSize(
const std::string &,
bool horizontal =
true)
const = 0;
166 virtual Size unicodeSize(
const UnicodeString &,
bool horizontal =
true)
const = 0;
168 virtual int symbolAdvance(
int = 0x20)
const = 0;
169 virtual int lineSkipHeight(
void)
const = 0;
176 StringList splitStringWidth(
const std::string &,
int)
const;
178 const Size & size(
void)
const 183 static void clearCache(
void);
184 static void dumpCache(
void);
186 void renderString(
const std::string &,
const Color &,
const Point &,
Surface &)
const;
197 static void clear(
void);
198 static void dump(
void);
209 #ifndef SWE_DISABLE_TTF 213 std::shared_ptr<TTF_Font> ptr;
217 Size char1Size(
int ch)
const;
218 Size char2Size(
int ch)
const;
226 void setShadedBackground(
const Color &);
232 const FontID & id(
void)
const override;
233 bool isValid(
void)
const override;
234 bool isTTF(
void)
const override;
236 TTF_Font* toSDLFont(
void)
const;
238 Size stringSize(
const std::string &,
bool horizontal =
true)
const override;
239 Size unicodeSize(
const UnicodeString &,
bool horizontal =
true)
const override;
241 int symbolAdvance(
int sym)
const override;
242 int lineSkipHeight(
void)
const override;
257 Size fixedSize(
size_t,
bool)
const;
263 const FontID & id(
void)
const override 268 bool isValid(
void)
const override 273 bool isTTF(
void)
const override 278 Size stringSize(
const std::string &,
bool horizontal =
true)
const override;
281 int symbolAdvance(
int sym)
const override;
282 int lineSkipHeight(
void)
const override;
294 #define FontRenderSystem FontAltC8x16 Definition: swe_surface.h:154
по нижнему краю
Definition: swe_fontset.h:42
FontAltC8x16()
встроенный шрифт altc_8x16.
Definition: swe_fontset.cpp:807
пространство SWE.
Definition: swe_binarybuf.cpp:30
тип normal.
Definition: swe_fontset.h:95
базовый класс рендера PSF шрифта
Definition: swe_fontset.h:252
по умолчанию (используется значение заданное при инициализации)
Definition: swe_fontset.h:82
встроенный системный рендер PSF шрифта
Definition: swe_fontset.h:288
класс идентификации шрифта
Definition: swe_fontset.h:123
класс точки с двумя координатами
Definition: swe_rect.h:72
класс цветной unicode строки
Definition: swe_cunicode_color.h:67
стиль normal.
Definition: swe_fontset.h:83
const FontRenderSystem & systemFont(void)
альяс на встроенный рендер PSF шрифта
Definition: swe_fontset.cpp:811
стиль bold.
Definition: swe_fontset.h:84
класс списка unicode строк
Definition: swe_cunicode.h:109
класс цвета
Definition: swe_colors.h:65
базовый класс шрифта
Definition: swe_fontset.h:151
стиль italic.
Definition: swe_fontset.h:85
тип none.
Definition: swe_fontset.h:98
по левому краю
Definition: swe_fontset.h:39
тип blended.
Definition: swe_fontset.h:74
тип light.
Definition: swe_fontset.h:96
по центру
Definition: swe_fontset.h:43
класс списка строк
Definition: swe_cstring.h:36
свойства отрисовка символа
Definition: swe_fontset.h:102
класс бинарного массива
Definition: swe_binarybuf.h:35
по верхнему краю
Definition: swe_fontset.h:41
AlignType
перечисление типа выравнивания
Definition: swe_fontset.h:37
класс кеширования спрайтов символов
Definition: swe_fontset.h:190
стиль under line.
Definition: swe_fontset.h:86
тип solid.
Definition: swe_fontset.h:73
по правому краю
Definition: swe_fontset.h:40
класс двухмерной размерности
Definition: swe_rect.h:36
по умолчанию (используется значение заданное при инициализации)
Definition: swe_fontset.h:94
CharRender
перечисление типа рендера
Definition: swe_fontset.h:70
CharStyle
перечисление типа стиля шрифта
Definition: swe_fontset.h:80
тип shaded.
Definition: swe_fontset.h:75
стиль strike through.
Definition: swe_fontset.h:87
Definition: swe_surface.h:58
по умолчанию (используется значение заданное при инициализации)
Definition: swe_fontset.h:72
базовый класс рендера TTF шрифта
Definition: swe_fontset.h:211
класс список цветных unicode строк
Definition: swe_cunicode_color.h:110
CharHinting
перечисление типа сглаживания контура
Definition: swe_fontset.h:92
тип mono.
Definition: swe_fontset.h:97
класс unicode строки
Definition: swe_cunicode.h:41