1 #ifndef RAYLIB_CPP_FONT_HPP_
2 #define RAYLIB_CPP_FONT_HPP_
14 #include "./raylib-cpp-utils.hpp"
20 set(::GetFontDefault());
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));
32 set(::LoadFontFromImage(image, key, firstChar));
35 Font(
const std::string& fileType,
const unsigned char *fileData,
int dataSize,
int fontSize,
int *fontChars,
int charsCount) {
36 set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars, charsCount));
47 GETTERSETTER(
int,BaseSize,baseSize)
48 GETTERSETTER(
int,CharsCount,charsCount)
51 GETTERSETTER(CharInfo*,Chars,chars)
64 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
68 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
71 inline Font&
DrawText(
const std::string& text, ::
Rectangle rec,
float fontSize,
float spacing,
bool wordWrap,
Color tint,
int selectStart,
int selectLength, ::
Color selectText,
Color selectBack) {
72 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint, selectStart, selectLength, selectText, selectBack);
77 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
81 return ::GetGlyphIndex(*
this, character);
85 void set(const ::Font font) {
86 baseSize = font.baseSize;
87 charsCount = font.charsCount;
88 texture = font.texture;
94 baseSize = font.baseSize;
95 charsCount = font.charsCount;
96 texture = font.texture;