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 void set(const ::Font font) {
48 baseSize = font.baseSize;
49 charsCount = font.charsCount;
50 texture = font.texture;
56 baseSize = font.baseSize;
57 charsCount = font.charsCount;
58 texture = font.texture;
63 GETTERSETTER(
int,BaseSize,baseSize)
64 GETTERSETTER(
int,CharsCount,charsCount)
67 GETTERSETTER(CharInfo*,Chars,chars)
80 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
84 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
87 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) {
88 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint, selectStart, selectLength, selectText, selectBack);
93 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
97 return ::GetGlyphIndex(*
this, character);