Commit Graph

151 Commits

Author SHA1 Message Date
d77902f33a Implement SVG in OT support. 2022-11-04 14:10:54 +02:00
cd25e48456 Merge pull request #67562 from bruvzg/improve_font_packing
Improve font glyph cache packing shelf best height fit heuristic.
2022-10-31 14:26:13 +01:00
ae81a569b9 Merge pull request #67409 from bruvzg/fix_oversampling_rounding
[TextServer] Do not round glyph advances / coordinates if font oversampling or bitmap glyph scaling is used.
2022-10-31 14:21:56 +01:00
e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
c1af9d57a3 Improve font glyph cache packing shelf best height fit heuristic. 2022-10-18 18:42:04 +03:00
3c4b110ae0 Merge pull request #67521 from nikitalita/speed_up_texture_pos
Speed up `find_texture_pos_for_glyph()`
2022-10-17 17:31:54 +02:00
68ec84cded [TextServer] Do not round glyph advances / coordinates if font oversampling or bitmap glyph scaling is used. 2022-10-17 10:57:49 +03:00
21341ddaed Speed up find_texture_pos_for_glyph() 2022-10-16 22:29:26 -07:00
6db8e79eed Fix memory leak when _ensure_cache_for_size() fails 2022-10-17 12:47:38 +08:00
072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
24b36354ff Merge pull request #66532 from bruvzg/mipmap_change
[Text Server] Clear textures after "generate mipmaps" property change.
2022-09-28 17:13:57 +02:00
51978dde5a [Text Server] Clear textures after "generate mipmaps" property change. 2022-09-28 12:43:34 +03:00
8f5d56e04a [GDExtension] Use function names with underscore for TextServer extension, add macros to generate wrappers for module functions. 2022-09-28 10:04:11 +03:00
8cdb482738 [TextServer] Always prefer main font over fallbacks, regardless of script/language support. 2022-09-25 23:07:30 +03:00
a0c85c11c6 Merge pull request #65914 from bruvzg/fix_trim_wo_space
Fix line trim/ellipsis when line do not have space or newline at the end.
2022-09-21 18:55:44 +02:00
2d0d6e4f63 Fix crash when executing FontFile.get_face_count 2022-09-18 14:38:57 +08:00
19443a7fef Fix line trim/ellipsis when line do not have space or newline at the end. 2022-09-16 19:46:26 +03:00
3a62c294c7 Merge pull request #65170 from KoBeWi/your_argument_is_TypedArray 2022-09-02 13:57:02 +02:00
7adc8376ed Change Array arguments to TypedArray 2022-09-01 13:13:19 +02:00
d83b6b1e1c [TextServer] Fix LCD AA fonts reading wrong glyphs. 2022-09-01 08:10:33 +03:00
fbcb98855d Fix MSDF fonts color modulation. 2022-08-30 20:28:53 +03:00
7013c68619 Merge pull request #64422 from bruvzg/make_fonts_unbearably_ugly_2.0 2022-08-26 11:59:07 +02:00
62c3e72b6f Merge pull request #63959 from KoBeWi/typo_arrray
Replace Array return types with TypedArray (part 1)
2022-08-23 08:52:13 +02:00
bcc3643989 Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
1c5a50fac6 Fix color modulation of the grayscale glyphs in font with mixed color / grayscale data. 2022-08-22 21:01:22 +03:00
bf1cc6326a Allow MSDF rendering for system fonts, fix crash on loading damaged / unsupported font files. 2022-08-09 14:21:09 +03:00
80c9a44492 Fix overrun flag check and HarfBuzz safe to break flag check. 2022-08-04 22:58:28 +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
6e4cdad3ac [TextServer] Adds support for TrueType / OpenType collection files (*.TTC, *.OTC). 2022-06-07 11:35:59 +03:00
cfcdfc38e2 [RTL] Add support for shaping in background thread. 2022-05-19 09:34:44 +03: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
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
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
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
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