1 #ifndef RAYLIB_CPP_INCLUDE_FONT_HPP_
2 #define RAYLIB_CPP_INCLUDE_FONT_HPP_
6 #include "./raylib.hpp"
7 #include "./raylib-cpp-utils.hpp"
16 set(::GetFontDefault());
19 Font(const ::Font& font) {
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));
31 Font(const ::Image& image, ::
Color key,
int firstChar) {
32 set(::LoadFontFromImage(image, key, firstChar));
35 Font(
const std::string& fileType,
const unsigned char* fileData,
int dataSize,
int fontSize,
36 int *fontChars,
int charsCount) {
37 set(::LoadFontFromMemory(fileType.c_str(), fileData, dataSize, fontSize, fontChars,
49 GETTERSETTER(
int, BaseSize, baseSize)
50 GETTERSETTER(
int, CharsCount, charsCount)
51 GETTERSETTER(
int, CharsPadding, charsPadding)
54 GETTERSETTER(::CharInfo*, Chars, chars)
56 Font& operator=(const ::
Font& font) {
65 float spacing, ::
Color tint = WHITE) {
66 ::DrawTextEx(*
this, text.c_str(), position, fontSize, spacing, tint);
71 bool wordWrap =
false, ::
Color tint = WHITE) {
72 ::DrawTextRec(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint);
80 bool wordWrap, ::
Color tint,
int selectStart,
int selectLength, ::
Color selectText,
82 ::DrawTextRecEx(*
this, text.c_str(), rec, fontSize, spacing, wordWrap, tint,
83 selectStart, selectLength, selectText, selectBack);
93 ::
Color tint = { 255, 255, 255, 255 }) {
94 ::DrawTextCodepoint(*
this, codepoint, position, fontSize, tint);
102 return ::MeasureTextEx(*
this, text.c_str(), fontSize, spacing);
109 return ::GetGlyphIndex(*
this, character);
115 inline ::Image
ImageText(
const std::string& text,
float fontSize,
116 float spacing, ::
Color tint)
const {
117 return ::ImageTextEx(*
this, text.c_str(), fontSize, spacing, tint);
121 void set(const ::Font& font) {
122 baseSize = font.baseSize;
123 charsCount = font.charsCount;
124 charsPadding = font.charsPadding;
125 texture = font.texture;
132 #endif // RAYLIB_CPP_INCLUDE_FONT_HPP_