Commit Graph

87 Commits

Author SHA1 Message Date
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
d9a74fd07f Merge pull request #54372 from bruvzg/text_edit_ui 2021-11-09 00:13:25 +01:00
4052d85d05 Repaired mistyped of 'threshold' on several files. 2021-10-31 22:11:42 +07:00
3f33e1d7d6 Add functions for getting name and font style from dynamic and bitmap fonts.
Add font selection toolbar editor plugin.
2021-10-31 12:40:58 +02:00
63f3051154 Implement TextServer strip_diacritics function. 2021-10-28 10:12:57 +03:00
ebbc25e89c Ignore empty Font resources as theme override.
Add range hint to font_size properties.
Remove excessive `base_size` Font property.
2021-10-25 14:05:37 +03:00
efb1c03243 [TextServer] Add texture index, offsets array size and Unicode char validation. 2021-10-15 18:36:00 +03:00
8e98e71997 Move static feature set and number system StringNames to the singleton.
Remove `hb_` prefix from the custom bitmap font functions to avoid potential conflicts with the HarfBuzz.
Cleanup commented debug code.
Update numbering system data to CLDR 39.
2021-10-12 12:47:18 +03:00
daa613333e [Text Server] Add support for user defined punctuation list, used for word breaking. 2021-10-01 16:45:16 +03:00
0c0b5c84b0 Implement TextServer GDExtension interface, remove TextServer GDNative interface. 2021-10-01 15:13:29 +03:00
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
ba65730cbf Rename RID's getornull() to get_or_null() 2021-09-29 23:58:02 +02:00