Commit Graph

150 Commits

Author SHA1 Message Date
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
chocolate42
8367abad1a [rtext] Fix GetCodepointNext() to return default value on invalid input with size=0 (#2997)
* Fix GetCodepointNext to return default value with size=0 on invalid input. Modify LoadCodepoints to work when GetCodepointNext returns a size of 0. All internal use of GetCodepointNext and GetCodepointPrev checked. This fix may break external code dealing with invalid input as the old code erroneously never returned a size of 0, external code that doesn't properly check for size=0 may endlessly loop or overflow a buffer on invalid input.

* Change default behaviour of GetCodepointNext to return a size of 1 instead of 0. This matches existing prod behaviour and guarantees size 1..4 is returned. Simplify internal code that uses GetCodepointNext that previously had to account for size=0.

* Simplified progressing through a UTF-8 string in ImageTextEx and MeasureTextEx. This change matches existing precedent in DrawTextEx

* GetCodepointNext: Add 10xxxxxx checks to multibyte encodings.

---------

Co-authored-by: anon <anon>
2023-04-06 12:34:37 +02:00
Ray
ecb6a6af32 Review format 2023-03-22 11:08:46 +01:00
Hanaxar
e55bdd5d8a Fix packing logic error in ``GenImageFontAtlas`` (#2979)
Basic packing algorithm currently follows this order: Copy pixel data -> Move offsetX for current glyph -> Check remaining space for current glyph...
Since X offset already moved according current glyph, remaining space should be checked for next glyph. Because of this, occasionally, current logic causes glyphs wrapping around texture.
Proposed fix accomplishes that by moving offsetX check to the beginning of the loop.
2023-03-22 11:00:13 +01:00
Hanaxar
02a8a49961 Calculate exact image size in GenImageFontAtlas (#2963)
* Calculate exact image size in GenImageFontAtlas

Calculate exact image size with a method based on total glyph width and glyph row count
Current method seemed a little bit overkill with square root, log and power functions and only approximates image size which can be wonky with some weird fonts like cursive fonts.
Proposed method calculates image size directly with a simpler method and results exact image size needed.

* Update rtext.c

* Update rtext.c

Changed do-while to while loop, and also added an extra step to calculate maximum glyph width and excluding it from image width for extra safety.
2023-03-22 10:59:28 +01:00
Ray
a7f81b06b9 Remove trailing spaces 2023-03-13 12:08:23 +01:00
Ray
ab1e246367 REVIEWED: Data types validation 2023-03-07 20:33:45 +01:00
Ray
ca98a84d68 Update rtext.c 2023-02-24 15:27:25 +01:00
Ray
d652b95fbf ADDED: Security checks 2023-02-22 17:28:25 +01:00
Julio C. Galindo
6ae21d6581 Fixed some grammar mistakes and typos. (#2914)
* Fixed some grammar mistakes.

* Fixed some typos.
2023-02-09 13:17:47 +01:00
Ray
1fea266472 Clean trailing spaces 2023-02-05 16:30:23 +01:00
Rob Loach
83ff7b2466 ADDED: IsShaderReady(), IsImageReady(), IsFontReady(), IsWaveReady(), IsSoundReady(), IsMusicReady() (#2892)
These IsReady() functions provide a method in order to verify whether or not the object was loaded successfully. They're useful to make sure the assets are there prior to using them.
2023-01-27 19:24:03 +01:00
Rob Loach
d8af76f67c Fix to use TRACELOG() instead of TraceLog() for internal modules (#2881)
There were a few raylib modules that continued to use TraceLog() instead of the TRACELOG() macro. This change ensures that all the internal raylib modules use the TRACELOG() pattern consistently.
2023-01-22 11:10:38 +01:00
Ray
e2a8066fca Update year to 2023 2023-01-01 16:07:51 +01:00
Ray
fc5894e734 REVIEWED: Some compilation warnings (for strict rules) 2022-11-28 14:16:59 +01:00
Ray
7459d906de Update rtext.c 2022-10-03 00:07:22 +02:00
Ray
810a0330ab WARNING: Several changes on UTF-8/Codepoints API
- ADDED: `GetCodepointPrevious()`
 - RENAMED: `GetCodepoint()` -> `GetCodepointNext()`, actually, reimplemented
 - `GetCodepoint()` has been kept for the moment, for compatibility and also because implementation is different
 - RENAMED: `TextCodepointsToUTF8()` to `LoadUTF8()`, simpler name and more aligned with raylib conventions (functions loading memory start with Load*()), parameters should be descriptive of functionailty.
 - ADDED: `UnloadUTF8()`, aligned with `LoadUTF8()` to avoid allocators issues.
2022-09-22 20:35:55 +02:00
Ray
35c777ef2c REVIEWED: Avoid crash on bad data provided 2022-08-18 15:11:23 +02:00
Dan Bechard
56072a631d Fix Codepoint position truncation (#2636)
This truncation causes text that spans the zero coord boundary to round differently left or zero vs. right of zero, in turn causing letters to appear squished together. If you actually need the position to be an integer, you should instead `floorf()` the float, rather than doing an integer truncation, but I don't see any reason to convert it to an integer in the first place. Everything else in the equation is a float.
2022-08-13 11:18:57 +02:00
Ray
fd191a32ea Remove trailing spaces 2022-08-02 00:36:31 +02:00
Ray
bb6b43b7cb REVIEWED: GenImageFontAtlas() #2556
Just reviewed font atlas size estimation, now it considers `fontSize` instead of `chars[i].image.height`, increasing considerably the atlas size estimation.
2022-07-29 12:01:18 +02:00
veclavtalica
63568721f9 fix: precision loss, discard unused (#2541) 2022-06-24 10:59:31 +02:00
The Tophat Demon
a6e31cadbd Changed ExportFontAsCode to use given font's padding. (#2525) 2022-06-17 00:12:21 +02:00
Ray
8294e04749 Correct typo 2022-05-29 18:23:48 +02:00
Ray
fe28aa7c9b Review log messages 2022-05-29 17:39:10 +02:00
Ray
df3f64bfd2 Corrected typo 2022-05-07 18:04:34 +02:00
Ray
666aa44a84 Reviewed some comments 2022-05-01 11:14:28 +02:00
Ray
9c2d337e99 Update rtext.c 2022-03-29 18:11:33 +02:00
megagrump
7584ce6f48 Increase atlas size guesstimate; print warnings if atlas size is too small (#2365) 2022-03-01 11:26:48 +01:00
raysan5
937e7b3dd9 REVIEWED: Some functions input parametes that should be const 2022-02-20 20:35:28 +01:00
raysan5
d4382f4a52 Removed trailing spaces 2022-02-18 20:30:46 +01:00
Ray
4bc6e0d7de Update rtext.c 2022-02-13 10:47:19 +01:00
Siddharth Roy
e5ee69a0f5 Add DrawTextCodepoints (#2308)
* Add DrawTextCodepoints

* Fixed top comment
2022-01-26 12:55:34 +01:00
Ray
2116a98745 ADDED: ExportFontAsCode() 2022-01-03 20:45:56 +01:00
raysan5
a940f41b4b Update year to 2022 2021-12-31 20:06:22 +01:00
raysan5
803ce9f44b Detected some pixel-errors due to rounding issues on position 2021-12-28 15:39:57 +01:00
Ray
fd0e3a4fdd REVIEWED: GetCodepoint() #2201 2021-12-09 20:13:53 +01:00
Ray
e637ad9d2a Support custom modules inclusion
Allow to choose which modules are compiled with raylib, if some modules are excluded from compilation, required functionality is not available but smaller builds are possible.
2021-12-04 19:56:02 +01:00
Ray
21ec8c38ae Review variables initialization
- All variables are initialized on declaration, some arrays were not properly initialized
 - Static array buffers require memset() for re-initialization on every function call
2021-11-09 11:49:03 +01:00
Luke Krasnoff
8ec5b2dc2f Protect TextIsEqual from NULLs (#2121) 2021-11-09 11:37:55 +01:00
raysan5
bba035c20c Minor type tweak 2021-11-01 19:14:55 +01:00
Ray
83b3478fe4 Reviewed some TODO 2021-10-13 23:45:57 +02:00
Ray
a1db0220a1 REVIEWED: LoadFontFromImage()
Avoid crash on wrong sprite font
2021-10-12 23:00:00 +02:00
Ray
f869229b7f Minor format tweaks 2021-10-03 12:09:59 +02:00
Ray
00a763ea44 Reviewed some TODO comments 2021-09-23 00:18:47 +02:00
Ray
99ab4d6cb8 WARNING: MODULES RENAMING!!!
raylib modules have been slightly renamed to add some identity and note that they are independent modules that can be used as standalone separate parts of raylib if required.

The renamed modules are:
 - `core` -> `rcore`
 - `shapes` -> `rshapes`
 - `textures` -> `rtextures`
 - `text` -> `rtext`
 - `models` -> `rmodels`
 - `camera` -> `rcamera`
 - `gestures` -> `rgestures`
 - `core` -> `rcore`

All the build systems has been adapted to this change.
2021-09-22 00:15:06 +02:00