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)
88 float spacing, ::
Color tint = WHITE) {
89 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
94 bool wordWrap, ::
Color tint = WHITE) {
95 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
100 bool wordWrap,
Color tint,
int selectStart,
int selectLength, ::
Color selectText,
101 ::
Color selectBack) {
102 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint,
103 selectStart, selectLength, selectText, selectBack);
111 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
118 return ::GetGlyphIndex(*
this, character);
125 float spacing, ::
Color tint)
const {
126 return ::ImageTextEx(*
this, text.c_str(), fontSize, spacing, tint);
130 void set(const ::Font& font) {
131 baseSize = font.baseSize;
132 charsCount = font.charsCount;
133 texture = font.texture;
139 baseSize = font.baseSize;
140 charsCount = font.charsCount;
141 texture = font.texture;
148 #endif // RAYLIB_CPP_INCLUDE_FONT_HPP_