1 #ifndef RAYLIB_CPP_INCLUDE_FONT_HPP_
2 #define RAYLIB_CPP_INCLUDE_FONT_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
16 set(::GetFontDefault());
19 Font(const ::Font& font) {
23 Font(
const std::string& fileName) {
24 set(::LoadFont(fileName.c_str()));
27 Font(
const std::string& fileName,
int fontSize,
int* fontChars,
int charCount) {
28 set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount));
31 Font(const ::Image& image, ::
Color key,
int firstChar) {
32 set(::LoadFontFromImage(image, key, firstChar));
35 Font(
const std::string& fileType,
const unsigned char* fileData,
int dataSize,
int fontSize,
36 int *fontChars,
int charsCount) {
37 set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars,
48 other.glyphPadding = 0;
51 other.glyphs =
nullptr;
62 GETTERSETTER(
int, BaseSize, baseSize)
63 GETTERSETTER(
int, GlyphCount, glyphCount)
64 GETTERSETTER(
int, GlyphPadding, glyphPadding)
67 GETTERSETTER(::GlyphInfo*, Glyphs, glyphs)
69 Font& operator=(const ::
Font& font) {
74 Font& operator=(
const Font&) =
delete;
86 other.glyphPadding = 0;
89 other.glyphs =
nullptr;
98 float spacing, ::
Color tint = WHITE) {
99 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
104 const std::string& text,
110 ::
Color tint = WHITE) {
111 ::DrawTextPro(*
this, text.c_str(), position, origin, rotation, fontSize, spacing, tint);
121 ::
Color tint = { 255, 255, 255, 255 }) {
122 ::DrawTextCodepoint(*
this, codepoint, position, fontSize, tint);
130 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
137 return ::GetGlyphIndex(*
this, character);
143 inline ::Image
ImageText(
const std::string& text,
float fontSize,
144 float spacing, ::
Color tint)
const {
145 return ::ImageTextEx(*
this, text.c_str(), fontSize, spacing, tint);
149 void set(const ::Font& font) {
150 baseSize = font.baseSize;
151 glyphCount = font.glyphCount;
152 glyphPadding = font.glyphPadding;
153 texture = font.texture;
155 glyphs = font.glyphs;
160 #endif // RAYLIB_CPP_INCLUDE_FONT_HPP_