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)
86 float spacing, ::
Color tint = WHITE) {
87 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
92 bool wordWrap =
false, ::
Color tint = WHITE) {
93 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
101 bool wordWrap, ::
Color tint,
int selectStart,
int selectLength, ::
Color selectText,
102 ::
Color selectBack) {
103 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint,
104 selectStart, selectLength, selectText, selectBack);
114 ::
Color tint = { 255, 255, 255, 255 }) {
115 ::DrawTextCodepoint(*
this, codepoint, position, fontSize, tint);
123 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
130 return ::GetGlyphIndex(*
this, character);
136 inline ::Image
ImageText(
const std::string& text,
float fontSize,
137 float spacing, ::
Color tint)
const {
138 return ::ImageTextEx(*
this, text.c_str(), fontSize, spacing, tint);
142 void set(const ::Font& font) {
143 baseSize = font.baseSize;
144 charsCount = font.charsCount;
145 charsPadding = font.charsPadding;
146 texture = font.texture;
153 #endif // RAYLIB_CPP_INCLUDE_FONT_HPP_