25 #ifndef RAYLIB_CPP_INCLUDE_FONT_HPP_
26 #define RAYLIB_CPP_INCLUDE_FONT_HPP_
30 #include "./raylib.hpp"
31 #include "./raylib-cpp-utils.hpp"
37 set(::GetFontDefault());
44 Font(
const std::string& fileName) {
45 set(::LoadFont(fileName.c_str()));
48 Font(
const std::string& fileName,
int fontSize,
int* fontChars,
int charCount) {
49 set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount));
52 Font(const ::Image& image, ::
Color key,
int firstChar) {
53 set(::LoadFontFromImage(image, key, firstChar));
56 Font(
const std::string& fileType,
const unsigned char *fileData,
int dataSize,
int fontSize,
57 int *fontChars,
int charsCount) {
58 set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars,
70 GETTERSETTER(
int, BaseSize, baseSize)
71 GETTERSETTER(
int, CharsCount, charsCount)
72 GETTERSETTER(
int, CharsPadding, charsPadding)
75 GETTERSETTER(::CharInfo*, Chars, chars)
83 float spacing, ::
Color tint = WHITE) {
84 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
89 bool wordWrap =
false, ::
Color tint = WHITE) {
90 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
95 bool wordWrap, ::
Color tint,
int selectStart,
int selectLength, ::
Color selectText,
97 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint,
98 selectStart, selectLength, selectText, selectBack);
108 ::
Color tint = { 255, 255, 255, 255 }) {
109 ::DrawTextCodepoint(*
this, codepoint, position, fontSize, tint);
117 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
124 return ::GetGlyphIndex(*
this, character);
130 inline ::Image
ImageText(
const std::string& text,
float fontSize,
131 float spacing, ::
Color tint)
const {
132 return ::ImageTextEx(*
this, text.c_str(), fontSize, spacing, tint);
136 void set(const ::Font& font) {
137 baseSize = font.baseSize;
138 charsCount = font.charsCount;
139 charsPadding = font.charsPadding;
140 texture = font.texture;
147 #endif // RAYLIB_CPP_INCLUDE_FONT_HPP_