summaryrefslogtreecommitdiff
path: root/scene/gui/label.cpp
AgeCommit message (Collapse)Author
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-09-05Merge pull request #40649 from themvl/masterRémi Verschelde
Fix bug where leading and trailing spaces werent taken into account with center and right allignment
2020-09-03[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg
2020-08-31Fix bug where leading and trailing spaces werent taken into account with ↵mvl
center and right allignment.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-27Renaming of servers for coherency.Juan Linietsky
VisualServer -> RenderingServer PhysicsServer -> PhysicsServer3D Physics2DServer -> PhysicsServer2D NavigationServer -> NavigationServer3D Navigation2DServer -> NavigationServer2D Also renamed corresponding files.
2020-03-26Popups are now windows also (broken!)Juan Linietsky
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-01-28Revert "make Label consider spaces for visible_characters"Rémi Verschelde
This reverts commit 695980a0f21adbe66eb12e1015fdc8c51fb62bf9. Fixes #35668.
2020-01-10Update minimum size on Label::set_autowrapHaoyu Qiu
If `clip_text` is true, the minimum height is one line if `autowrap` is true , or one pixel otherwise.
2020-01-08Merge pull request #34874 from wingedadventurer/bugfix-label-visible-charactersRémi Verschelde
Make Label node consider spaces for visible_characters property
2020-01-06make Label consider spaces for visible_characterswingedadventurer
2020-01-07Calculate label size more accuratelyvolzhs
2020-01-06Fix calculating label sizevolzhs
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-11-04Fixed cases where labels with autowrap can overflow the editor uiPouleyKetchoupp
Fixes #33155
2019-10-16Allow Label autowrap to cut words when they exceed line widthPouleyKetchoupp
Fixes #30832
2019-06-28Draw the outline as part of the Label font shadowHugo Locurcio
This closes #30165.
2019-06-26Some code changed with Clang-Tidyqarmin
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-18Merge pull request #24428 from akien-mga/label-uppercaseRémi Verschelde
Label: Fix kerning when using Uppercase mode
2018-12-17Don't accidentally convert string content to charHein-Pieter van Braam
Due to the right hand side of the :? trickery the rhs was cast to a char losing precision. Previously this didn't matter, but with CharProxy it does. (Previously we could just happily cast it back to a wchar_t and get the original 16 - 32 bits. Now we'll only ever get the first 8).
2018-12-17Label: Fix kerning when using Uppercase modeRémi Verschelde
Seemingly a typo, I did not check what exact impact it had, but the x_ofs would likely have accumulated errors when using fonts with varying char widths.
2018-11-15Fix return value of get_total_character_countThomas ten Cate
Also document that it only counts visible characters. Fixes #23720
2018-11-08-Moved EditorDefaultValue to ClassDB, made it coreJuan Linietsky
-Removed one and zero hints for properties, replaced by default value
2018-10-04fix enum cast warnings on clangkarroffel
2018-09-19Fix Label::get_minimum_size not updating cache size for autowrapGuilherme Felipe
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-07-18Fix Label autowrap clips textvolzhs
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-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-01-12Bind many more properties to scriptsBojidar Marinov
Notable potentially breaking changes: - PROPERTY_USAGE_NOEDITOR is now PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK, without PROPERTY_USAGE_INTERNAL - Some properties were renamed, and sometimes even shadowed by new ones - New getter methods (some virtual) were added
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-19Added font oversampling supportJuan Linietsky
2017-09-02Fix use of unitialized variablesHein-Pieter van Braam
The second in my quest to make Godot 3.x compile with -Werror on GCC7
2017-08-31Merge pull request #10096 from toger5/label_styleboxRémi Verschelde
fixed Import LineEdit to label + label stylebox
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-20ClassDB: Provide the enum name of integer constantsIgnacio Etcheverry
2017-08-19Fixes to label and code editor to make editing code hopefully fast again.Juan Linietsky
2017-08-18Rename localization method to `tr` againRémi Verschelde
Partial revert of #10380 based on contributor ~~bullying~~ feedback.
2017-08-17Rename `XL_MESSAGE` aka `tr` to `localize`Rémi Verschelde
Also renames `set_message_translation` to `set_message_localization` for consistency.
2017-08-17fixed Import LineEdit to label + label styleboxtoger5
- added a normal stylebox to label. default is StyleBoxEmpty - changed drawing so that it draws correct with styleboxes with margins - changed the LineEdit in the import to use a label with the lineEdit stylebox
2017-07-25Label: update min size when regenerate wordcachePoommetee Ketson
2017-07-21Label: add auto_heightPoommetee Ketson