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());
40 Font(
const std::string& fileName) {
41 set(::LoadFont(fileName.c_str()));
44 Font(
const std::string& fileName,
int fontSize,
int* fontChars,
int charCount) {
45 set(::LoadFontEx(fileName.c_str(), fontSize, fontChars, charCount));
48 Font(const ::Image& image, ::
Color key,
int firstChar) {
49 set(::LoadFontFromImage(image, key, firstChar));
52 Font(
const std::string& fileType,
const unsigned char *fileData,
int dataSize,
int fontSize,
53 int *fontChars,
int charsCount) {
54 set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars,
66 GETTERSETTER(
int, BaseSize, baseSize)
67 GETTERSETTER(
int, CharsCount, charsCount)
68 GETTERSETTER(
int, CharsPadding, charsPadding)
71 GETTERSETTER(::CharInfo*, Chars, chars)
84 float spacing, ::
Color tint = WHITE) {
85 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
90 bool wordWrap, ::
Color tint = WHITE) {
91 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
96 bool wordWrap,
Color tint,
int selectStart,
int selectLength, ::
Color selectText,
98 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint,
99 selectStart, selectLength, selectText, selectBack);
107 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
114 return ::GetGlyphIndex(*
this, character);
121 return ::ImageTextEx(*
this, text.c_str(), fontSize, spacing, tint);
125 void set(const ::Font font) {
126 baseSize = font.baseSize;
127 charsCount = font.charsCount;
128 texture = font.texture;
134 baseSize = font.baseSize;
135 charsCount = font.charsCount;
136 texture = font.texture;
143 #endif // RAYLIB_CPP_INCLUDE_FONT_HPP_