Commit graph

159 commits

Author SHA1 Message Date
Pedro J. Estébanez
5131b81a4d Enhance label sizing algorithm 2023-02-06 14:12:29 +01:00
Pedro J. Estébanez
ed8c5cd52f Prevent infinite cascade of re-layout after label text reshaping 2023-01-17 13:49:54 +01:00
Juan Linietsky
0e0a6bb39b
Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
6f6482e82b Merge pull request #67083 from RedMser/label-font-warning
Add warning for missing characters in label font
2022-10-09 18:29:06 +02:00
Haoyu Qiu
2a921cc9f8 Fix Label text length mismatch after localization 2022-10-08 23:07:19 +08:00
RedMser
9579d49820 Add warning for missing characters in label font 2022-10-08 17:02:25 +02:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde
7e3afc3d09 Merge pull request #65213 from Mickeon/fix-label-visible-ratio 2022-09-01 23:49:28 +02:00
Micky
511134f55f Fix Label & RichTextLabel's visible_ratio not working 2022-09-01 19:22:12 +02:00
Yuri Sizov
3b1aa240dc Add a lifecycle method for manual theme item caching to Control 2022-09-01 16:35:36 +03:00
bruvzg
7aad14a4b6
[TextServer] Add support for trimming edge spaces on line break. 2022-09-01 08:11:55 +03:00
Micky
e31bb5ffeb Rename CanvasItem.update() to queue_redraw()
Affects a lot of classes. Very thoroughly checked signal connections and deferred calls to this method, add_do_method/add_undo_method calls, and so on.

Also renames the internal `_update_callback()` to `_redraw_callback()` for consistency.

Just a few comments have also been changed to say "redraw".

In CPUParticles2D, there was a private variable with the same name. It has been renamed to `do_redraw`.
2022-08-29 14:59:47 +02:00
VolTer
832950d1f2 Reorganized Label and RichTextLabel properties 2022-08-28 10:26:04 +02:00
Micky
64bd36ecee Rename Label & RichTextLabel.percent_visible to visible_ratio
Also updates the documentation of both `visible_characters` and `visible_ratio` to, better describe what they do and improve consistency between the two Classes.
2022-08-26 12:15:57 +02:00
风青山
e561c68256 Add some codes, returnes directly if the value is not changed.
Avoid executing the following value-changed logics if the value does not really change.
2022-08-23 23:25:22 +08:00
Micky
9a63792a08 Clamp Label's percent_visible properly between 0 and 1.0
Also applies to RichTextLabel
2022-08-22 12:03:03 +02:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Rémi Verschelde
715f556cd4
Merge pull request #62139 from bruvzg/label_font_setttings
Add LabelSettings resource for quick Label theme property override.
2022-07-19 20:16:01 +02:00
bruvzg
cbe3a2dcb7
Use BitField hint for the TextServer enums. Add missing parts for BitField support to the GDextension API. 2022-07-15 08:49:50 +03:00
bruvzg
f63d54126d
Add LabelSettings resource for quick Label theme property override. 2022-07-12 16:05:12 +03:00
bruvzg
344ba0ffaf
Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
bruvzg
b5c96df277
Move duplicate AutoWrap, Overrun and VisibleChar behavior enums to the TextServer. 2022-06-16 16:49:37 +03:00
bruvzg
be611c1c05
Implement Label3D node.
Add "generate_mipmap" font import option.
Add some missing features to the Sprite3D.
Move BiDi override code from Control to TextServer.
Add functions to access TextServer font cache textures.
Add MSDF related flags and shader to the standard material.
Change standard material cache to use HashMap instead of Vector.
2022-04-22 12:08:46 +03:00
bruvzg
f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
Rémi Verschelde
0f5455230c
Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
bruvzg
2e01a0d7a3
[RTL / Label] Reorganize property order to ensure "visible_characters" / "percent_visible" are set after the "text". 2022-02-11 12:31:13 +02:00
bruvzg
215bede6ff
[TextServer] Add function to change font, font size, and OpenType features without invalidating line break points, justification points, or recreating shaped text buffer. 2022-02-02 11:20:44 +02:00
bruvzg
40c56ed410
Improve locale detection.
Use separate language, script and country lists.
Add locale selection dialog and property hint.
2022-01-18 14:30:00 +02:00
bruvzg
e02a097280
[TextServer] Implement locale and context sensitive case conversion functions. 2022-01-17 14:23:36 +02:00
bruvzg
baec983d8a
[TextServer] Improvements for line breaking, "Fill" alignment, overrun, and interaction between these modes.
Fix "Fill" alignment processing wrong side of the text if overrun trim was applied.
Improve "Fill" alignment to avoid adding excessive subsequent spaces or elongations.
Add font detection to the overrun, to correctly add ellipsis (was using last glyph font, which doesn't necessary have dot character).
Improve line breaking to avoid adding excessive subsequent soft break points for languages without word separator.
Port missing overrun/justification code to the Fallback text server.
Fix inferred text direction detection by controls.
Add tests for "Fill" alignment and line breaking glyph flags.
2022-01-13 08:53:28 +02:00
bruvzg
c89c515ccf
[TextServer] Improve ligature cursor handling.
Fix mid-grapheme hit test.
Fix OpenType features property handling, add default features override option.
Enable mid-grapheme cursor by default.
2022-01-09 19:03:48 +02:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Rémi Verschelde
1906b59675
Merge pull request #55636 from bruvzg/vis_char_modes
Add different "visible characters" behavior modes.
2021-12-23 00:43:33 +01:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
kobewi
ea7cc1dea9 Rename minimum_size_changed() method 2021-12-06 14:02:34 +01:00
bruvzg
ad4408d413
Add different "visible characters" behavior modes. 2021-12-06 12:14:49 +02:00
bruvzg
5f9cd9ccbc Fix Label and RichTextLabale text shadows and shadow outlines. 2021-11-06 10:22:09 +02:00
bruvzg
0c0b5c84b0 Implement TextServer GDExtension interface, remove TextServer GDNative interface. 2021-10-01 15:13:29 +03:00
bruvzg
99dc2ec9e1 Fix RTL layout Label text, VBox child, 3D node editor controls, and popup menu alignment. 2021-09-21 10:35:23 +03:00
bruvzg
9d0e3cff09 Fix Label and RichTextLabel visible_characters and percent_visible methods. 2021-09-20 09:35:24 +03:00
Rémi Verschelde
c7455d9d42
Merge pull request #52012 from bruvzg/fix_label_outline 2021-09-13 14:23:52 +02:00
bruvzg
4c3f7d1290 Makes FontData importable resource.
Adds multi-channel SDF font texture generation and rendering support.
Adds per-font oversampling support.
Adds FontData import plugins (for dynamic fonts, BMFonts and monospaced image fonts), font texture cache pre-generation and loading.
Adds BMFont binary format and outline support.
2021-08-27 15:43:18 +03:00
bruvzg
54345f11fb Fix label outline overlaps. 2021-08-23 14:13:13 +03:00
Hendrik Brucker
403f4902d0 Various text layout improvements (TextLine, TextParagraph, Label, TextServer) 2021-08-11 00:09:48 +02:00
Michael Alexsander
94a64d557e Add auto_translate toggle for automatic translation 2021-07-29 18:30:34 -03:00
reduz
6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Hendrik Brucker
56a8d3f30c Improvements to Label's layout options
- Added options to trim the text in case it overruns
- Added more autowrap modes
- Improved line breaking, which ignores trailing spaces
2021-07-04 16:43:55 +02:00
Haoyu Qiu
a57a51750a Update min size on Label::set_text 2021-06-21 19:54:40 +08:00