JohnnyCena123
4e8d08523f
add const qualifier to the first arg of TextJoin ( #5166 )
...
* add const qualifier to the first arg of TextJoin
* Update raylib_api.* by CI
* Update raylib.h
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ray <raysan5@gmail.com>
2025-09-02 18:58:39 +02:00
Ray
29ce5d8aa9
WARNING: BREAKING: LoadFontData() redesigned, added parameter
...
This redesign is a big improvement on font loading time and memory requirements. It only loads glyphs available on font from requested codepoints and only processes those glyphs for packaging. When processing +10K codepoints (CJK), the loading time improves considerably.
2025-09-02 17:45:39 +02:00
Ray
8f32c502a7
REVIEWED: Code sections definition
2025-09-02 12:10:40 +02:00
Ray
1777da9056
REVIEWED: Avoid realloc() calls, small security improvement
2025-09-01 20:37:23 +02:00
Ray
0a92c863c4
Reverted const codepoints to avoid warnings
2025-09-01 11:27:11 +02:00
Ray
edce3d41b2
REVERT: Making codepoints const, variable is used to generate list in case it was NULL
2025-08-31 12:11:03 +02:00
Ray
ecedf40da6
REVIEW: const for codepoints arrays passed to function #5159
2025-08-31 11:39:14 +02:00
Ray
d2f6c4924c
ADDED: [rtext] LoadTextLines()/UnloadTextLines()
2025-08-26 10:17:33 +02:00
Ray
52980c947d
REVIEWED: [rtext] Provide more detailed info on glyphs failing to pack #5141
2025-08-24 11:07:55 +02:00
Siltnamis
3c9c66e72b
use RL_MALLOC in stb_truetype
2025-08-23 13:10:27 +03:00
Ray
570082deba
WARNING: **NEW** raylib code CONVENTION: Comments do not end with '.'
2025-08-07 18:23:20 +02:00
Ray
7b017b60d9
Move global variable to right code section
2025-07-21 10:57:21 +02:00
Catania
3d93b30262
Update font load message
2025-07-18 15:20:38 +02:00
Ray
59bcf680aa
Code gardening...
2025-06-07 20:14:24 +02:00
Ray
5ddd13b775
REVIEWED: Hexadecimal formatting to be consistent
2025-05-28 17:18:02 +02:00
Ray
9d4c31533d
Update rtext.c
2025-05-14 23:47:03 +02:00
Jeffery Myers
ebaa922f6b
Properly clean up the default font on unload, it may be reused if the window is created again
2025-05-08 09:57:31 -07:00
Jeffery Myers
94c5de33a0
Make the default font loadable before InitWindow, for use with the image API.
...
Make the default font loader early out if we have already loaded parts of it, so we don't leak memory
2025-04-30 17:56:30 -07:00
Ray
5b940692ea
REVIEWED: ExportFontAsCode() not checking isGpuReady #4894
2025-04-15 13:09:44 +02:00
veins1
1d87932d93
TextSubtext fixes ( #4759 )
...
Fix buffer write overflow
Fix reading past the end of text
2025-02-12 23:12:10 +01:00
sleeptightAnsiC
99dfec070a
[rtext] fix: misuse of cast in GetCodepointCount ( #4741 )
...
I was really wondering what is going on here :D I believe this code
tried initially to out-cast 'const' specifier but this is not needed here
at all. Currently, it just confuses whoever reads this so I changed it.
The old code would also trigger -Wcast-qual warning on some compilers.
2025-01-31 14:44:23 +01:00
Ray
e227371265
REVIEWED: TextJoin(), convert const char ** to char**
...
It generates multiple issues: https://c-faq.com/ansi/constmismatch.html
2025-01-11 23:38:21 +01:00
Ray
49b905077d
remove trailing spaces
2025-01-11 19:36:26 +01:00
Ray
bf8962dbc7
REVIEWED: Remove some const from text buffer return values
...
Lately got some compilation `errors` related, it seems GCC 14 interprets some `const`-missmatch as errors instead of warnings (as previous versions).
But in any case, I don't see why an user won't be able to operate directly over of those returned buffers; `const` adds a restriction (for security reasons?) that in my opinion is useless.
From an expert on compilers (w64devkit creator), here there are some notes I agree with:
```
No const. It serves no practical role in optimization, and I cannot recall an instance where it caught, or would have caught, a mistake. I held out for awhile as prototype documentation, but on reflection I found that good parameter names were sufficient. Dropping const has made me noticeably more productive by reducing cognitive load and eliminating visual clutter. I now believe its inclusion in C was a costly mistake.
(One small exception: I still like it as a hint to place static tables in read-only memory closer to the code. I’ll cast away the const if needed. This is only of minor importance.)
```
Ref: https://nullprogram.com/blog/2023/10/08/
2025-01-10 13:06:28 +01:00
Ray
fa0eada61a
Update year to 2025
2025-01-01 00:02:52 +01:00
Fancy2209
7868d600f4
[rtext] Fix default font alpha on Big Endian systems ( #4624 )
...
* Fix rtext default font alpha on Big Endian
* Endian Indepence
2024-12-23 22:25:22 +01:00
Ray
1f45e7af76
REVIEWED: Coding conventions
2024-12-03 19:14:14 +01:00
Ray
962f1c26ff
Review formatting to follow raylib conventions
2024-12-01 23:10:59 +01:00
Ray
da6fa1d756
Fix #4529
2024-11-22 11:06:34 +01:00
Ray
d15e583460
Update rtext.c
2024-10-29 09:37:38 +01:00
mpv-enjoyer
de7ab83f5a
Fix empty input string for MeasureTextEx ( #4448 )
2024-10-29 09:33:03 +01:00
Ray
f141c75cde
Removed trailing spaces
2024-10-21 17:00:52 +02:00
Ray
8cbf34ddc4
WARNING: BREAKING: Renamed several functions for data validation #3930
2024-10-16 19:26:12 +02:00
Ray
735308f8eb
REVIEWED: CodepointToUTF8(), clean static buffer #4379
2024-10-13 20:02:40 +02:00
Ray
1eb8ff5e54
LoadFontDefault(): Initialize glyphs and recs to zero #4319
2024-09-22 18:05:58 +02:00
Ray
f5ef357810
Update rtext.c
2024-08-25 13:55:53 +02:00
Ray
4c9282b090
ADDED: isGpuReady flag, allow font loading with no GPU acceleration
2024-08-24 18:59:24 +02:00
listeria
cc88e0b780
rtext: always multiply by sign in TextToFloat() ( #4273 )
...
Co-authored-by: Listeria monocytogenes <listeria@disroot.org>
2024-08-21 17:45:14 +02:00
Ray
3abe728712
Minor tweaks
2024-07-08 22:54:19 +02:00
Ray
0979eafa84
WARNING: REMOVED: Default font fallback
2024-06-25 21:40:41 +02:00
Peter0x44
dfabbd8ba8
[rtext] Don't return default font if LoadFontEx fails ( #4077 )
...
It is currently impossible to check a font loaded successfully with
IsFontReady because LoadFontEx will always return a valid font.
DrawTextEx has this check:
if (font.texture.id == 0) font = GetFontDefault(); // Security check in case of not valid font
So anyone relying on the default font as a fallback for fonts failing to
load should still be covered.
2024-06-25 21:38:55 +02:00
Jeffery Myers
e96bab7ce6
[Build] Fix warnings when building in VS 2022 ( #4095 )
...
* Update raylib_api.* by CI
* Fix warnings when building examples in MSVC 2022
* fix auto-format that sneaked in there.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-24 17:47:32 +02:00
Alice Nyaa
b0d49579c1
fixed LoadCodepoints returning a freed ptr when count is 0 ( #4089 )
2024-06-22 19:17:31 +02:00
Ray
8cbde7f84c
tweaks
2024-06-09 13:16:29 +02:00
IoIxD
39f12859dc
rtext: added functions for camel case and snake case (reopened due to formatting errors) ( #4033 )
...
* rtext: added functions for camel case and snake case
* Update raylib_api.* by CI
* rtext: removed always false comparison
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-06-03 20:13:28 +02:00
Ray
e37d19ab1e
REVIEWED: ExportFontAsCode(), avoid const #4013
2024-05-29 17:28:55 +02:00
DarkAssassin23
2804e75869
[rtext] Added cast to ExportFontAsCode output to fix C++ compiler errors ( #4013 )
2024-05-29 17:22:59 +02:00
Ray
9d67f4734b
REVIEWED: LoadBMFont(), issue on not glyph data initialized
2024-05-18 07:41:37 +02:00
Ray
763129e96b
Reviewed some warnings
2024-05-01 18:12:57 +02:00
Ray
b03c8ba945
WARNING: BREAKING: REDESIGN: SetTextLineSpacing()
...
Redesigned function to only consider separation between the end of vertical size of one line and the beginning of next line
2024-04-28 23:07:21 +02:00
Ray
e85f245ad4
REVIEWED: Remove final punctuation in code comments
2024-04-20 20:31:06 +02:00
Ray
29ce13b777
Code gardening
...
- Review formatting
- Improve readability for some functions result return
- Minimize early returns
- Align LoadFileData() to UnloadFileData()
2024-04-20 13:53:13 +02:00
Ray
51486a0606
Update rtext.c
2024-04-19 21:13:36 +02:00
Ray
fea3395fc1
Review formatting
2024-02-29 18:50:44 +01:00
Ray
e42e3188f5
Remove some unneeded line breaks
2024-02-18 11:59:40 +01:00
Ray
401c5a8638
Minor tweaks to avoid some CodeQL warnings
2024-02-13 15:58:02 +01:00
Ray
bb741f53a8
Update rtext.c
2024-02-13 10:43:24 +01:00
Mingjie Shen
6280771dad
[rtext] Change strcpy to strncpy to fix buffer overflow ( #3795 )
2024-02-13 10:38:13 +01:00
Ray
e9291fa4c7
Update rtext.c
2024-02-04 22:50:54 +01:00
Ray
868d515fbc
Update rtext.c
2024-02-04 11:18:46 +01:00
Ray
eed56a45d6
REVIEWED: LoadFontDataBDF() name and formating
2024-02-04 11:10:46 +01:00
Stanley Fuller
0932cd3059
[rtext] Add BDF font support ( #3735 )
...
* Add BDF font support
* Include font ascent in glyph y-offset when loading BDF font
2024-02-03 19:28:12 +01:00
Marrony Neris
c0b081fac0
Fix MeasureTextEx() height calculation ( #3770 )
2024-02-01 21:14:22 +01:00
Idir Carlos Aliane
cb97a8063d
[rtext.c] fixing some comments to align comments style ( #3756 )
2024-01-22 23:15:25 +01:00
Tim Romero
2c124c96df
[rtext] Adjust font atlas area calculation so padding area is not underestimated at small font sizes. ( #3719 )
2024-01-10 21:34:04 +01:00
Ray
3f1e59a7cf
Update copyright to 2024
2024-01-02 20:58:12 +01:00
ubkp
5b5a2d035d
Fix TextReplace warning for const ( #3687 )
2023-12-28 23:13:47 +01:00
maverikou
7cfdf33ff0
TextReplace const correctness ( #3678 )
...
* TextReplace const correctness
* cleanup
2023-12-28 20:09:49 +01:00
Dongkun Lee
9de79861ea
BM Font Extender ( #3536 )
...
* loadbmfont
* bmfontextender
* bm font
* Modify LoadBM Font
* Delete loadbmfontex.diff
* REVIEWED: `LoadBMFont()` PR
* Update rtext.c
* Update rtext.c
---------
Co-authored-by: Dongkun Lee <hope81dklee@outlook.com>
Co-authored-by: Ray <raysan5@gmail.com>
2023-12-15 18:32:01 +01:00
Benjamin Schmid Ties
6083d2b9f3
fixed coding style in function TextToFloat ( #3627 )
...
* function to convert string to float
* fix code to match coding conventions
2023-12-13 21:20:13 +01:00
Ray
731b210f51
REVIEWED: WARNING: LoadFontData() avoid fallback glyphs
...
This is a redesign on font loading, missing glyphs are skipped instead of falling back to font `.notdef` special character (usually "tofu" character).
It is changed because not all fonts support a fallback glyph.
One improvement could be allowing users to define a custom fallback character, for example `?` glyph.
2023-12-04 17:32:55 +01:00
Ray
a016b4ded2
REVIEWED: LoadFontData(), load image only if glyph has been found in font
2023-12-03 20:17:16 +01:00
Ray
64d64cc181
REVIEWED: Potential code issues reported by CodeQL #3476
2023-11-01 15:28:18 +01:00
Ray
e4547eb422
Remove trail spaces
2023-10-26 23:56:03 +02:00
Ray
99ede0f747
Added some notes for alternative implementations #3362
2023-10-17 11:09:56 +02:00
Ray
876e6b3a0d
REVIEWED: TextFormat(), added "..." for truncation #3366
...
It seems more standard than [TRUN]
2023-10-11 20:25:09 +02:00
Ray
61af8e7631
REVIEWED: #3399 , Fix #3366
2023-10-11 12:20:03 +02:00
Murlocohol
28fb58f0ea
[rtext] TextFormat() warn user if buffer overflow occured. ( #3399 )
...
* [rtext] TextFormat now alerts user to truncation.
* Update rtext.c
* Update rcore.c
* Update rtext.c
2023-10-11 12:15:40 +02:00
Ray
e75f85ce58
REVIEWED: TextToPascal() issue when first char is uppercase
2023-09-11 19:01:24 +02:00
Ray
10e4aa32f8
Update rtext.c
2023-09-08 20:01:19 +02:00
Ray
9cce5a93ff
Fix #3293
2023-09-05 20:04:21 +02:00
Ray
75e5cd86d7
Use internal default allocators, instead of user-exposed ones
2023-09-02 12:58:47 +02:00
Ray
0f447f1fb6
REVIEWED: Data size type consistency between functions #3168
2023-09-02 12:05:34 +02:00
Ray
ec6d3bb688
RENAMED: LoadFont*() parameter names for consistency and coherence
2023-09-01 23:23:01 +02:00
ashn
a86c93ebc0
Ignore unused return value of GetCodepointNext in GetCodepointCount ( #3241 )
...
* Ignore unused return value of GetCodepointNext in GetCodepointCount
Removes the last warning from non-external libraries when compiling with
the default build configuration on x64 Linux.
* Remove unnecessary void cast in GetCodepointCount
2023-08-15 00:09:27 +02:00
Ray
93f59a6f59
Review tabs and trail-spaces
2023-08-10 22:47:17 +02:00
RadsammyT
0959f6ebf6
fix typos in rmodels, rshapes, rtext modules ( #3236 )
2023-08-10 00:21:14 +02:00
ashn
90f1749965
Ignore unused function warnings from external headers when compiling with GCC and Clang ( #3235 )
2023-08-09 19:17:12 +02:00
Ray
52541b4a1f
ADDED: SUPPORT_FONT_ATLAS_WHITE_REC
...
Support creating a 3x3 pixels white rectangle at the bottom-right corner of the generated font atlas image, useful for shapes+text drawing in a single draw call!
2023-07-18 17:57:10 +02:00
Ray
0b9fae3c53
Reviewed rcamera/rgestures file-macros for consistency #3161
2023-07-10 19:13:44 +02:00
Ray
685d47938b
Reverted MeasureTextEx() change #3105
2023-07-06 12:31:01 +02:00
Ray
668b37e111
REVIEWED: GenImageFontAtlas(), make atlas size less conservative
2023-07-06 12:29:28 +02:00
Ray
58bd10edb2
Update rtext.c
2023-07-05 18:36:54 +02:00
Ray
4fc5e82e30
REVIEWED: TextToUpper(), TextToLower(), TextToPascal()
2023-07-02 11:10:42 +02:00
Ray
3e4e4b32fd
WARNING: BREAKING: ADDED: SetTextLineSpacing()
2023-07-02 10:52:20 +02:00
Ray
48e2663d03
REVIEWED: Issue #3105
2023-07-02 10:51:39 +02:00
Ray
51387dfbfb
tweak
2023-05-18 16:14:18 +02:00
Ray
7d68aa6869
REVIEWED: Modules description layout
2023-05-01 14:04:22 +02:00
Ray
9d38363e09
Remove trailing spaces
2023-04-17 12:18:06 +02:00
Ray
d8c7b01a3c
REVIEWED: GetGlyphIndex() #3000
2023-04-06 12:49:59 +02:00