Commit graph

90 commits

Author SHA1 Message Date
kobewi
d2900429e8 Add static methods for creating Image and ImageTexture 2022-07-08 13:40:47 +02: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
Rémi Verschelde
632b933a03
Merge pull request #61934 from Geometror/hashfuncs
Hash function improvements
2022-06-15 07:34:43 +02:00
Hendrik Brucker
8c61470fa9 Hash function improvements 2022-06-15 00:32:10 +02:00
bruvzg
6e4cdad3ac
[TextServer] Adds support for TrueType / OpenType collection files (*.TTC, *.OTC). 2022-06-07 11:35:59 +03:00
bruvzg
b3bbf3db47
[GDExtension] Expose Variant, NodePath and StringName hash functions. 2022-06-06 12:19:56 +03:00
bruvzg
cfcdfc38e2
[RTL] Add support for shaping in background thread. 2022-05-19 09:34:44 +03:00
bruvzg
93fba7ead3
Update HarfBuzz, ICU and FreeType.
HarfBuzz: Update to version 4.2.1
FreeType: Update to version 2.12.1
ICU: Update to version 71.1
2022-05-17 18:39:31 +03:00
bruvzg
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
bruvzg
6783d55ce4
Use new HashMap implementation in the TextServer, and Font. 2022-05-12 13:42:25 +03:00
reduz
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
bruvzg
68304bec47 [TextServer] Fix incorrect oversampled font scaling. 2022-05-10 13:57:18 +03:00
reduz
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
Rémi Verschelde
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
bruvzg
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
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
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
bruvzg
aad9d1414c
Delay font texture update, until draw is called. Rasterize glyphs during shaping. 2022-04-05 10:49:41 +03:00
Rémi Verschelde
b78aa4fe19 Style: Apply clang-tidy to current code, add readability-redundant-member-init 2022-04-04 21:49:51 +02:00
bruvzg
40b0634b34
Fix TextServer build with builtin_icu=no. 2022-03-28 11:06:49 +03:00
bruvzg
f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
bruvzg
d9f8cadafb
Improve simulated bold fonts advance. 2022-03-13 15:07:53 +02:00
bruvzg
b32e8d63d8
Add options to embolden and transform font outlines to simulate bold and italic typefaces. 2022-03-11 14:02:30 +02:00
Rémi Verschelde
760a95e86a
Merge pull request #57877 from bruvzg/subpixel_gl_pos 2022-02-15 13:58:38 +01:00
Hugo Locurcio
b68dd2e189
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
bruvzg
29199579f7
Add sub-pixel glyph positioning support. 2022-02-12 19:55:52 +02:00
bruvzg
244db37508
Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +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
Nathan Franke
8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06: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
Rémi Verschelde
7faf02383c
Merge pull request #55225 from bruvzg/fix_ligature_cursor_and_ot_features 2022-01-10 13:32:54 +01:00
bruvzg
af6758e008
Fix freezes when tab is zero or negative width. 2022-01-10 12:19:29 +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
bruvzg
01bac2c469
[Text Server] Fix re-shaping of substrings, improve oversampling scale. 2021-12-15 11:57:22 +02:00
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
Aaron Franke
ae713f8980
Add a minimal template build to CI
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-11-12 09:30:50 -06:00
Rémi Verschelde
88c4380737
Modules: Make sure to include modules_enabled.gen.h where needed 2021-11-12 13:42:58 +01:00
Rémi Verschelde
5968653662
Merge pull request #46721 from bruvzg/custom_word_break_punct 2021-11-09 00:13:59 +01:00
Rémi Verschelde
d9a74fd07f
Merge pull request #54372 from bruvzg/text_edit_ui 2021-11-09 00:13:25 +01:00
M. Huri
4052d85d05 Repaired mistyped of 'threshold' on several files. 2021-10-31 22:11:42 +07:00
bruvzg
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
bruvzg
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
bruvzg
efb1c03243 [TextServer] Add texture index, offsets array size and Unicode char validation. 2021-10-15 18:36:00 +03:00
bruvzg
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
bruvzg
daa613333e [Text Server] Add support for user defined punctuation list, used for word breaking. 2021-10-01 16:45:16 +03:00
bruvzg
0c0b5c84b0 Implement TextServer GDExtension interface, remove TextServer GDNative interface. 2021-10-01 15:13:29 +03:00