![]() |
Wise&mystical
1.0
Project about Europe
|
#include "raylib.h"
#include "config.h"
#include "utils.h"
#include "rlgl.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
#include "external/stb_rect_pack.h"
#include "external/stb_truetype.h"
Go to the source code of this file.
Macros | |
#define | STB_RECT_PACK_IMPLEMENTATION |
rtext - Basic functions to load fonts and draw text More... | |
#define | STBTT_STATIC |
#define | STB_TRUETYPE_IMPLEMENTATION |
#define | MAX_TEXT_UNICODE_CHARS 512 |
#define | BIT_CHECK(a, b) ((a) & (1u << (b))) |
#define | FONT_TTF_DEFAULT_SIZE 32 |
#define | FONT_TTF_DEFAULT_NUMCHARS 95 |
#define | FONT_TTF_DEFAULT_FIRST_CHAR 32 |
#define | FONT_TTF_DEFAULT_CHARS_PADDING 4 |
#define | MAX_GLYPHS_FROM_IMAGE 256 |
#define | COLOR_EQUAL(col1, col2) ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)) |
#define | FONT_SDF_CHAR_PADDING 4 |
#define | FONT_SDF_ON_EDGE_VALUE 128 |
#define | FONT_SDF_PIXEL_DIST_SCALE 64.0f |
#define | FONT_BITMAP_ALPHA_THRESHOLD 80 |
#define | TEXT_BYTES_PER_LINE 20 |
#define | MAX_FONT_DATA_SIZE 1024*1024 |
#define | SUPPORT_COMPRESSED_FONT_ATLAS |
#define | GLYPH_NOTFOUND_CHAR_FALLBACK 63 |
#define | SUPPORT_UNORDERED_CHARSET |
#define | MAX_TEXTFORMAT_BUFFERS 4 |
#define | MAX_BUFFER_SIZE 256 |
Functions | |
void | LoadFontDefault (void) |
void | UnloadFontDefault (void) |
Font | GetFontDefault () |
Font | LoadFont (const char *fileName) |
Font | LoadFontEx (const char *fileName, int fontSize, int *fontChars, int glyphCount) |
Font | LoadFontFromImage (Image image, Color key, int firstChar) |
Font | LoadFontFromMemory (const char *fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount) |
GlyphInfo * | LoadFontData (const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int glyphCount, int type) |
Image | GenImageFontAtlas (const GlyphInfo *chars, Rectangle **charRecs, int glyphCount, int fontSize, int padding, int packMethod) |
void | UnloadFontData (GlyphInfo *glyphs, int glyphCount) |
void | UnloadFont (Font font) |
bool | ExportFontAsCode (Font font, const char *fileName) |
void | DrawFPS (int posX, int posY) |
void | DrawText (const char *text, int posX, int posY, int fontSize, Color color) |
void | DrawTextEx (Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) |
void | DrawTextPro (Font font, const char *text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint) |
void | DrawTextCodepoint (Font font, int codepoint, Vector2 position, float fontSize, Color tint) |
void | DrawTextCodepoints (Font font, const int *codepoints, int count, Vector2 position, float fontSize, float spacing, Color tint) |
int | MeasureText (const char *text, int fontSize) |
Vector2 | MeasureTextEx (Font font, const char *text, float fontSize, float spacing) |
int | GetGlyphIndex (Font font, int codepoint) |
GlyphInfo | GetGlyphInfo (Font font, int codepoint) |
Rectangle | GetGlyphAtlasRec (Font font, int codepoint) |
unsigned int | TextLength (const char *text) |
const char * | TextFormat (const char *text,...) |
int | TextToInteger (const char *text) |
int | TextCopy (char *dst, const char *src) |
bool | TextIsEqual (const char *text1, const char *text2) |
const char * | TextSubtext (const char *text, int position, int length) |
char * | TextReplace (char *text, const char *replace, const char *by) |
char * | TextInsert (const char *text, const char *insert, int position) |
const char * | TextJoin (const char **textList, int count, const char *delimiter) |
const char ** | TextSplit (const char *text, char delimiter, int *count) |
void | TextAppend (char *text, const char *append, int *position) |
int | TextFindIndex (const char *text, const char *find) |
const char * | TextToUpper (const char *text) |
const char * | TextToLower (const char *text) |
const char * | TextToPascal (const char *text) |
char * | TextCodepointsToUTF8 (const int *codepoints, int length) |
RLAPI const char * | CodepointToUTF8 (int codepoint, int *byteSize) |
int * | LoadCodepoints (const char *text, int *count) |
void | UnloadCodepoints (int *codepoints) |
int | GetCodepointCount (const char *text) |
int | GetCodepoint (const char *text, int *bytesProcessed) |
#define BIT_CHECK | ( | a, | |
b | |||
) | ((a) & (1u << (b))) |
#define COLOR_EQUAL | ( | col1, | |
col2 | |||
) | ((col1.r == col2.r) && (col1.g == col2.g) && (col1.b == col2.b) && (col1.a == col2.a)) |
#define FONT_BITMAP_ALPHA_THRESHOLD 80 |
#define FONT_SDF_CHAR_PADDING 4 |
#define FONT_SDF_ON_EDGE_VALUE 128 |
#define FONT_SDF_PIXEL_DIST_SCALE 64.0f |
#define FONT_TTF_DEFAULT_CHARS_PADDING 4 |
#define FONT_TTF_DEFAULT_FIRST_CHAR 32 |
#define FONT_TTF_DEFAULT_NUMCHARS 95 |
#define FONT_TTF_DEFAULT_SIZE 32 |
#define GLYPH_NOTFOUND_CHAR_FALLBACK 63 |
#define MAX_BUFFER_SIZE 256 |
#define MAX_FONT_DATA_SIZE 1024*1024 |
#define MAX_GLYPHS_FROM_IMAGE 256 |
#define MAX_TEXTFORMAT_BUFFERS 4 |
#define STB_RECT_PACK_IMPLEMENTATION |
rtext - Basic functions to load fonts and draw text
CONFIGURATION:
#define SUPPORT_MODULE_RTEXT rtext module is included in the build
#define SUPPORT_FILEFORMAT_FNT #define SUPPORT_FILEFORMAT_TTF Selected desired fileformats to be supported for loading. Some of those formats are supported by default, to remove support, just comment unrequired #define in this module
#define SUPPORT_DEFAULT_FONT Load default raylib font on initialization to be used by DrawText() and MeasureText(). If no default font loaded, DrawTextEx() and MeasureTextEx() are required.
#define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH TextSplit() function static buffer max size
#define MAX_TEXTSPLIT_COUNT TextSplit() function static substrings pointers array (pointing to static buffer)
DEPENDENCIES: stb_truetype - Load TTF file and rasterize characters data stb_rect_pack - Rectangles packing algorythms, required for font atlas generation
LICENSE: zlib/libpng
Copyright (c) 2013-2022 Ramon Santamaria (@raysan5)
This software is provided "as-is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
#define SUPPORT_COMPRESSED_FONT_ATLAS |
#define SUPPORT_UNORDERED_CHARSET |
#define TEXT_BYTES_PER_LINE 20 |
RLAPI const char * CodepointToUTF8 | ( | int | codepoint, |
int * | byteSize | ||
) |
void DrawFPS | ( | int | posX, |
int | posY | ||
) |
void DrawText | ( | const char * | text, |
int | posX, | ||
int | posY, | ||
int | fontSize, | ||
Color | color | ||
) |
int GetCodepoint | ( | const char * | text, |
int * | bytesProcessed | ||
) |
int GetCodepointCount | ( | const char * | text | ) |
Font GetFontDefault | ( | void | ) |
int GetGlyphIndex | ( | Font | font, |
int | codepoint | ||
) |
int * LoadCodepoints | ( | const char * | text, |
int * | count | ||
) |
Font LoadFont | ( | const char * | fileName | ) |
GlyphInfo * LoadFontData | ( | const unsigned char * | fileData, |
int | dataSize, | ||
int | fontSize, | ||
int * | fontChars, | ||
int | glyphCount, | ||
int | type | ||
) |
void LoadFontDefault | ( | void | ) |
Font LoadFontEx | ( | const char * | fileName, |
int | fontSize, | ||
int * | fontChars, | ||
int | glyphCount | ||
) |
Font LoadFontFromMemory | ( | const char * | fileType, |
const unsigned char * | fileData, | ||
int | dataSize, | ||
int | fontSize, | ||
int * | fontChars, | ||
int | glyphCount | ||
) |
int MeasureText | ( | const char * | text, |
int | fontSize | ||
) |
void TextAppend | ( | char * | text, |
const char * | append, | ||
int * | position | ||
) |
char * TextCodepointsToUTF8 | ( | const int * | codepoints, |
int | length | ||
) |
const char * TextFormat | ( | const char * | text, |
... | |||
) |
char * TextInsert | ( | const char * | text, |
const char * | insert, | ||
int | position | ||
) |
bool TextIsEqual | ( | const char * | text1, |
const char * | text2 | ||
) |
const char * TextJoin | ( | const char ** | textList, |
int | count, | ||
const char * | delimiter | ||
) |
unsigned int TextLength | ( | const char * | text | ) |
char * TextReplace | ( | char * | text, |
const char * | replace, | ||
const char * | by | ||
) |
const char ** TextSplit | ( | const char * | text, |
char | delimiter, | ||
int * | count | ||
) |
const char * TextSubtext | ( | const char * | text, |
int | position, | ||
int | length | ||
) |
const char * TextToLower | ( | const char * | text | ) |
const char * TextToPascal | ( | const char * | text | ) |
const char * TextToUpper | ( | const char * | text | ) |
void UnloadFont | ( | Font | font | ) |
void UnloadFontData | ( | GlyphInfo * | glyphs, |
int | glyphCount | ||
) |