summaryrefslogtreecommitdiff
path: root/scene/resources/dynamic_font.cpp
AgeCommit message (Collapse)Author
2020-02-28Removed interactive loader, added proper thread loading.Juan Linietsky
2020-02-26Reimplement Mutex with C++'s <mutex>Pedro J. Estébanez
Main: - It's now implemented thanks to `<mutex>`. No more platform-specific implementations. - `BinaryMutex` (non-recursive) is added, as an alternative for special cases. - Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes. - Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts. - A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this. - `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`. - Thread-safe utilities are therefore simpler now. Misc.: - `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same. - Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock). - `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-11A lot of progress with canvas rendering, still far from working.Juan Linietsky
2020-02-11Texture refactorJuan Linietsky
-Texture renamed to Texture2D -TextureLayered as base now inherits 2Darray, cubemap and cubemap array -Removed all references to flags in textures (they will go in the shader) -Texture3D gone for now (will come back later done properly) -Create base rasterizer for RenderDevice, RasterizerRD
2020-02-07Use modules_enabled.gen.h to improve inter dependency checksRémi Verschelde
- Fix build with gdscript module disabled. Fixes #31011. - Remove unused `gdscript` compile option. - Fix build with regex module disabled. - Fix ImageLoaderSVG to forward declare thirdparty structs.
2020-01-21Allow greater values for DynamicFont size propertyRémi Verschelde
See https://github.com/godotengine/godot/issues/22581#issuecomment-576836691. Not using `or_greater` as there *is* a max size value that the current implementation can accept. If using e.g. size 6000 with FiraSans-Regular.ttf, errors are printed due to failing asserts on a glyph size that should be within 4096x4096 px.
2020-01-20Destroys FreeType library on load errorHaoyu Qiu
2020-01-15Fix typos with codespellRémi Verschelde
Using codespell 1.16.0. See ab3bccdb78cc7dffb6ab796053ef63489f05558d for procedure.
2020-01-07Update size and position for colored font with oversamplingvolzhs
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-10Fixes crash when using DynamicFont::set_font_dataHaoyu Qiu
2019-09-29fix dynamic font crash if no available font sizeRodolfo Ribeiro Gomes
2019-09-25Added some obvious errors explanationsqarmin
2019-08-17Replace last occurrences of 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG'Rémi Verschelde
The last remaining ERR_EXPLAIN call is in FreeType code and makes sense as is (conditionally defines the error message). There are a few ERR_EXPLAINC calls for C-strings where String is not included which can stay as is to avoid adding additional _MSGC macros just for that. Part of #31244.
2019-08-09Remove ERR_EXPLAIN from scene/* codeTomasz Chabora
2019-08-07Add some code changes/fixes proposed by Coverity and Clang Tidyqarmin
2019-05-02Add a property hint for DynamicFont sizeHugo Locurcio
This caps its size to reasonable values in the Inspector. This closes #22581.
2019-01-23Fix warning when setting out of range outline_sizeMarcin Zawiejski
Fixes the warning mentioned in #25046
2019-01-05Fix font kerningvolzhs
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-19Fix colored font rendered in wrong sizevolzhs
Fix #24456 The character->rect.size is properly update at DynamicFontAtSize::_bitmap_to_character so no need to multiply scale again. It was changed with 5cd12f6649387f91d08fd17bf3c70e732798ab58
2018-11-10Add a property to control DynamicFont anti-aliasingHugo Locurcio
- Editor font anti-aliasing can now be disabled in the Editor Settings. - DynamicFonts used in projects can now have their anti-aliasing disabled in their DynamicFontData child. Changes will be visible upon reloading the scene in the editor.
2018-11-08-Moved EditorDefaultValue to ClassDB, made it coreJuan Linietsky
-Removed one and zero hints for properties, replaced by default value
2018-10-20Moved dynamic font list from static to lifetime controlled by main.Ibrahn Sahir
Means the list is destroyed before the OS object, allowing it the opportunity to print an error if there are still dynamic font objects hanging around.
2018-10-19Fixing warnings generated by MSVCDualtagh Murray
Fixes #22684.
2018-10-03Fix fallback font oversampling.Akeru
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-08-24missed outline size in previous commitJuan Linietsky
2018-08-24Initalize font size to 16, closes #21165Juan Linietsky
2018-08-24Make some debug prints verbose-only, remove othersRémi Verschelde
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
2018-07-24Removed unnecessary assignmentsWilson E. Alvarez
2018-06-29Fix the DynamicFont hinting setting being ineffectiveHugo Locurcio
2018-05-14Ceil char width within Label instead of FontRuslan Mustakov
Some classes use Font::get_char_size directly and not only for autowrapping. RichTextLabel is one such example. So this commit reverts aa8561d (PR #17504) and instead ceils character width within Label. This makes sure Label autowraps correctly while not affecting other Font clients. Fixes #18835.
2018-05-11Update oversampling of outlines after window size changeRuslan Mustakov
Fixes #18774.
2018-05-08Always emit dynamic font change in update_oversamplingRuslan Mustakov
Fixes #15787. The issue occurred when two (or more) separate DynamicFont instances used the same DynamicFontAtSize instance due to having equal properties. The first instance updated its data_at_size and emitted "changed" signal, but the second did not because it considered the data_at_size to be up to date, even though it has just been updated.
2018-05-08Perfect FreeType-based outlines for DynamicFontsRuslan Mustakov
- Implement outlines based on FreeType Stroker API. This allows artifact-free results, similar to what you will see in Web or any text editing tools. Outline is a part of DynamicFont rather than Label, because outlines have to be baked into the font's atlas. Font has a default outline_color and a Label can specify font_outline_modulator that will be multiplied with the Font's color to get the final result. - draw_char now has to be called twice to fully render a text - first with p_outline == true for each character and then with p_outline == false for each character. - Number of draw-calls is reduced from 5 to 2 per outlined character. - Overall cleanup of DynamicFont code, extracted duplicated code pieces into separate methods. - The change is backward-compatible - Labels still have outline properties that work exactly as they worked before. Closes #16279.
2018-03-14Ceil dynamic font glyph sizeRuslan Mustakov
Fixes #15459. When oversampling is enabled, glyphs may have fractional size, but they are still rendered into integral pixels, which results in them taking more space than was anticiped by autowrapping algorithm. The solution here is to return ceiled width, which makes autowrapper consider characters a bit larger than they are, but it doesn't hurt the actual rendering and ensures there is enough space for the characters.
2018-02-28Add an hinting mode setting to DynamicFontsHugo Locurcio
- Editor font hinting can now be tweaked in the Editor Settings. - DynamicFonts used in projects now have tweakable hinting settings in their DynamicFontData child. Changes will be visible upon reloading the scene in the editor.
2018-02-19Merge pull request #15780 from volzhs/emojiRémi Verschelde
Support colored font
2018-01-21I have no idea why this commit fixes #15392Juan Linietsky
2018-01-16Support colored fontvolzhs
2018-01-08Two potential glitches in font oversamplingBernhard Liebl
2018-01-07Fix stale dynamic font reference fetch from cacheBernhard Liebl
Seems to fix issue 15392
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-12-19Make dynamic font oversampling fully dynamic.Juan Linietsky
2017-12-19Added font oversampling supportJuan Linietsky
2017-11-25Made Vector::ptrw explicit for writing, compiler was sometimes using the ↵Juan Linietsky
wrong function, leading to unnecesary copy on writes and reduced performance.