diff options
| author | Ray <raysan5@gmail.com> | 2018-06-30 19:58:44 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2018-06-30 19:58:44 +0200 |
| commit | afe81d94cebd0f803327743c867a38b1dceffe76 (patch) | |
| tree | cdab986afa43a7530f75357482580987279005fb /src/text.c | |
| parent | 64207b11c07649f034631a3d6fa1916619dcb425 (diff) | |
| download | raylib-afe81d94cebd0f803327743c867a38b1dceffe76.tar.gz raylib-afe81d94cebd0f803327743c867a38b1dceffe76.zip | |
Re-added: LoadFontEx()
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -310,6 +310,23 @@ Font LoadFont(const char *fileName) return font; } +// Load Font from TTF font file with generation parameters +// NOTE: You can pass an array with desired characters, those characters should be available in the font +// if array is NULL, default char set is selected 32..126 +Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars) +{ + Font font = { 0 }; + + font.baseSize = fontSize; + font.charsCount = (charsCount > 0) ? charsCount : 95; + font.chars = LoadFontData(fileName, font.baseSize, fontChars, font.charsCount, false); + Image atlas = GenImageFontAtlas(font.chars, font.charsCount, font.baseSize, 0, 0); + font.texture = LoadTextureFromImage(atlas); + UnloadImage(atlas); + + return font; +} + // Load font data for further use // NOTE: Requires TTF font and can generate SDF data CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, bool sdf) |
