Commit Graph

248 Commits

Author SHA1 Message Date
b54c5c2683 [TextServer] Ensure that built-in library headers are always included before system header, add HarfBuzz version checks for optional features. 2022-07-31 22:52:59 +03:00
c7255388e1 Remove ThreadWorkPool, replace by WorkerThreadPool
The former needs to be allocated once per usage. The later is shared for all threads, which is more efficient.
It can also be better debugged.
2022-07-25 15:39:50 +02:00
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
d2900429e8 Add static methods for creating Image and ImageTexture 2022-07-08 13:40:47 +02:00
344ba0ffaf Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
b5c96df277 Move duplicate AutoWrap, Overrun and VisibleChar behavior enums to the TextServer. 2022-06-16 16:49:37 +03:00
632b933a03 Merge pull request #61934 from Geometror/hashfuncs
Hash function improvements
2022-06-15 07:34:43 +02:00
8c61470fa9 Hash function improvements 2022-06-15 00:32:10 +02:00
136f84fc35 Merge pull request #61772 from bruvzg/ft_ot_collect 2022-06-13 11:13:05 +02:00
b667469bbf [TextServer] Add missing font mutex lock. 2022-06-13 10:33:36 +03:00
6e4cdad3ac [TextServer] Adds support for TrueType / OpenType collection files (*.TTC, *.OTC). 2022-06-07 11:35:59 +03:00
b3bbf3db47 [GDExtension] Expose Variant, NodePath and StringName hash functions. 2022-06-06 12:19:56 +03:00
ffcb2a4702 Fix build error when FreeType is disabled 2022-06-02 22:46:50 +08:00
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
cfcdfc38e2 [RTL] Add support for shaping in background thread. 2022-05-19 09:34:44 +03:00
b154f445d5 Merge pull request #60507 from bruvzg/textmesh
Implement TextMesh.
2022-05-16 13:52:57 +02:00
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
05963674a7 Implement TextMesh resource.
Apply simulated slant and embolden to the TextServer `gont_get_glyph_contours` results.
2022-05-13 08:20:22 +03:00
6783d55ce4 Use new HashMap implementation in the TextServer, and Font. 2022-05-12 13:42:25 +03:00
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
68304bec47 [TextServer] Fix incorrect oversampled font scaling. 2022-05-10 13:57:18 +03:00
931838b330 Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
b831fb0a54 Rename Transform2D "elements" to "columns" 2022-04-29 08:02:39 -05:00
6ab672d1ef Implement text-to-speech support on Android, iOS, HTML5, Linux, macOS and Windows.
Implement TextServer word break method.
2022-04-28 14:35:41 +03:00
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
9381acb6a4 Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
f851c4aa33 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
aad9d1414c Delay font texture update, until draw is called. Rasterize glyphs during shaping. 2022-04-05 10:49:41 +03:00
b78aa4fe19 Style: Apply clang-tidy to current code, add readability-redundant-member-init 2022-04-04 21:49:51 +02:00
803e1ae920 [Help] Add simulated slanted font support to the editor help. 2022-03-22 16:16:04 +02:00
f19cd44346 Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
d9f8cadafb Improve simulated bold fonts advance. 2022-03-13 15:07:53 +02:00
b32e8d63d8 Add options to embolden and transform font outlines to simulate bold and italic typefaces. 2022-03-11 14:02:30 +02:00
29199579f7 Add sub-pixel glyph positioning support. 2022-02-12 19:55:52 +02:00
244db37508 Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
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
e02a097280 [TextServer] Implement locale and context sensitive case conversion functions. 2022-01-17 14:23:36 +02:00
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
7faf02383c Merge pull request #55225 from bruvzg/fix_ligature_cursor_and_ot_features 2022-01-10 13:32:54 +01:00
af6758e008 Fix freezes when tab is zero or negative width. 2022-01-10 12:19:29 +02:00
8c973f21ee Fix glyph index for bitmap fonts.
Fix TextEdit glyph position rounding.
2022-01-10 08:00:27 +02:00
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
fe52458154 Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
01bac2c469 [Text Server] Fix re-shaping of substrings, improve oversampling scale. 2021-12-15 11:57:22 +02:00
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
41a20171eb align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
88c4380737 Modules: Make sure to include modules_enabled.gen.h where needed 2021-11-12 13:42:58 +01:00
5968653662 Merge pull request #46721 from bruvzg/custom_word_break_punct 2021-11-09 00:13:59 +01:00