Commit graph

302 commits

Author SHA1 Message Date
bruvzg 5d3fcc5766
[TextServer] Fix system font fallback and caret/selection behavior for composite characters. 2023-08-15 11:42:40 +03:00
David Snopek d585ca546b Use String::resize() and CharString in text_server_adv again 2023-08-14 18:12:05 -05:00
Martin Capitanio ac9e259d3e Update ThorVG to v0.10.0
- Release Notes: https://github.com/thorvg/thorvg/releases/tag/v0.10.0
- API change ARGB8888_STRAIGHT -> ARGB8888S
- SVG-SCsub: Enable static ThorVG object linking
- SVG-SCsub: avoid building unused ThorVG parts
- update-thorvg.sh: add v0.10.0 and copy only the Godot relevant code
2023-08-09 17:15:59 +02:00
Rémi Verschelde faaf27f284
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +02:00
Rémi Verschelde 2c9b7fc7a8
libpng: Enable intrinsics on x86/SSE2, ppc64/VSX, and all arm/NEON 2023-08-04 14:57:21 +02:00
Hendrik Brucker 7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
bruvzg 008d3de1e9
FreeType: Update to version 2.13.1 2023-07-10 12:04:02 +03:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +02:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
Rémi Verschelde 731df52084
Merge pull request #77532 from dsnopek/text_server_adv_gdextension
Fix text_server_adv compiling as a GDExtension
2023-06-23 17:23:29 +02:00
3dnikita 1247c9e64f Fix SVG tag closing for OT font glyphs
Prevent ThorVG "Failed to create SVG canvas" errors
by self-closing empty SVG tags in OpenType fonts,
so the glyphs are renderred correctly in Controls.

Fixes #78374
2023-06-22 17:50:24 +03:00
David Snopek 263c909349 Fix text_server_adv compiling as a GDExtension 2023-06-20 10:50:33 -05:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
bruvzg 35b0354577
Fix SVG font rendering after ThorVG update. 2023-06-07 09:02:04 +03:00
VolTer 151a4ba6a5 Overhaul the top sections of the class reference (GUI classes) 2023-05-28 14:24:54 +02:00
bruvzg b64df2bf74
Update HarfBuzz, ICU and FreeType
HarfBuzz: Update to version 7.3.0
ICU4C: Update to version 73.1
FreeType: Update to version 2.13.0
2023-05-23 03:26:16 +03:00
bruvzg aaddec7cb8
[TextServer] Add support for retrieving OpenType name strings. 2023-05-22 18:08:34 +03:00
Ninni Pipping 71ee65dc57 Enable shadow warnings and fix raised errors 2023-05-11 16:00:59 +02:00
Rémi Verschelde fb3e4e7967
Merge pull request #75975 from bruvzg/bidi_and_log_errors
Improve line BiDi handling, prevent crash on recursive log updates.
2023-04-12 13:28:12 +02:00
bruvzg 282e4231c2
Improve line BiDi handling, prevent crash on recursive log updates. 2023-04-12 11:39:05 +03:00
bruvzg d904516e55
[TextServer] Use dedicated flag for object replacement characters. 2023-04-12 10:08:51 +03:00
bruvzg d8d88e1530
[TextServer] Improve BiDi error handling. 2023-04-11 10:07:00 +03:00
bruvzg 19179238fa [SVG Font] Keep a copy of UTF-8 XML source string during the whole SVG processing. 2023-04-05 09:25:20 +03:00
Pedro J. Estébanez abc13dbd0b Update HarfBuzz to 7.1.0 2023-04-03 09:13:48 +02:00
Yuri Sizov 98d95f3a0e
Merge pull request #74149 from bruvzg/get_char
[Font] Implement `get_char_from_glyph_index` function.
2023-03-16 13:07:11 +01:00
Yuri Sizov b5845f87fc
Merge pull request #74556 from AThousandShips/text_adv_svg_freetype
[TextServer] Make sure Freetype is enabled for ot-svg
2023-03-15 15:04:01 +01:00
bruvzg 8d501a2dc3
[TextServer] Add invalid font scaling check, restrict Linux/BSD system fonts lookup to TrueType/CFF only. 2023-03-10 09:36:17 +02:00
Ninni Pipping 3a5d7a4b54 [TextServer] Make sure Freetype is enabled for ot-svg 2023-03-07 16:27:24 +01:00
bruvzg 016b2f3555
[TextServer] Fix justification on punctuation characters. 2023-03-06 12:39:08 +02:00
Rémi Verschelde a8d2e7f342
Merge pull request #73987 from bruvzg/ft_lock
[TextServer] Add mutex for FreeType face creation/deletion operations.
2023-03-03 11:04:07 +01:00
Rémi Verschelde 7e142e04f5
Merge pull request #73669 from bruvzg/icu_static_data
[TextServer] Ensure ICU data is initialised only one and cleaned only at exit.
2023-03-02 11:26:02 +01:00
bruvzg 8459aeaab0
[Font] Implement get_char_from_glyph_index function. 2023-03-01 09:29:11 +02:00
Rémi Verschelde 1c1524a651
Bump version to 4.1-dev
Can't stop, won't stop, they said, huh?
2023-03-01 01:44:37 +01:00
bruvzg bbc77b6d29
Fix text server GDExtension build. 2023-02-26 18:38:22 +02:00
bruvzg c950a1ab94
[TextServer] Add mutex for FreeType face creation/deletion operations. 2023-02-26 17:55:04 +02:00
bruvzg 7f24433e15
[TextServer] Ensure ICU data is initialised only one and cleaned only at exit. 2023-02-21 09:43:54 +02:00
Rémi Verschelde e2fc0acd36
Fix includes of thirdparty libs which can be unbundled on Linux
Changes `builtin_icu` and `builtin_recast` to match the folder names in
`thirdparty`.
2023-02-16 15:52:13 +01:00
bruvzg c588923433
[TextServer] Preload USpoofChecker to speed up GDScript parsing. 2023-02-05 23:31:54 +02:00
bruvzg 0cc1f4240a
[RichTextLabel] Fix thread unsafe set_physics_process_internal usage. Use WorkerThreadPool instead of creating new threads. 2023-01-30 20:47:45 +02:00
Rémi Verschelde 0f31e6569a
Merge pull request #71931 from bruvzg/ts_s
[TextServer] Fix ICU data loading and exporting with `internationalization/locale/include_text_server_data` setting.
2023-01-23 20:45:58 +01:00
bruvzg 15dafc49d3
[TextServer] Fix ICU data loading and exporting with internationalization/locale/include_text_server_data setting. 2023-01-23 21:13:32 +02:00
bruvzg 458f720ea9
[TextServer] Add fallback code in case of missing ICU data. 2023-01-23 20:50:30 +02:00
bruvzg 96ed1c19dd
Fix BiDi override for the characters outside BMP (e.g., emojis). 2023-01-23 12:51:35 +02:00
Rémi Verschelde 65883cc73b
Merge pull request #71598 from bruvzg/gdscript_bidi_override
Implement BiDi override mode for GDScript source.
2023-01-19 19:33:18 +01:00
bruvzg db7d8c2d87
[GDExtension] Expose some low level functions and String operators. 2023-01-19 12:50:49 +02:00
bruvzg 5361ec9f43
Implement BiDi override mode for GDScript source. 2023-01-18 19:22:20 +02:00
Juan Linietsky 6f0e210093 Refactor ProjectSetting overrides
* Overrides no longer happen for set/get.
* They must be checked with a new function: `ProjectSettings::get_setting_with_override()`.
* GLOBAL_DEF/GLOBAL_GET updated to use this

This change solves many problems:
* General confusion about getting the actual or overriden setting.
* Feature tags available after settings are loaded were being ignored, they are now considered.
* Hacks required for the Project Settings editor to work.

Fixes #64100. Fixes #64014. Fixes #61908.
2023-01-13 15:13:56 +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
bruvzg a28e8f0c8d
[TextServer] Make free calls thread safe. 2023-01-02 21:59:05 +02:00
bruvzg 20d9457f9d
Scale MSDF font outline with the font size and MSDF source size to match dynamic font behavior. 2022-12-17 22:47:54 +02:00
Haoyu Qiu 207e52c161 Fix String::word_wrap() for long words
- Changes `TextServer.string_get_word_breaks()`
  - Returns pairs of boundary start and end offsets
  - Accepts `chars_per_line` to return line breaks
- Removes `String::word_wrap()`

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-12-16 13:18:57 +08:00
bruvzg 53c76fa5d1
[RTL/TextServer] Add baseline inline alignment mode for objects and RTL tables. 2022-12-15 23:16:02 +02:00
Rémi Verschelde 0ee6ffb257
graphite: Update to latest Git, switch to MIT license
Graphite is now available under:
MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later

We pick MIT which is the same as Godot's main license for simplicity.

Remove define to skip deprecation warnings, upstream fixed those.
2022-12-13 10:06:00 +01:00
Rémi Verschelde f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
evan-gordon 88015b0edb check for empty string TextServer _string_to_upper 2022-12-11 12:01:54 -08:00
bruvzg 3395539ed4
[TextServer] Do not clean up font texture cache when setting allow_system_fallback property. 2022-12-10 17:07:42 +02:00
bruvzg ecec415988
Use system fonts as fallback and improve system font handling.
Add support for font weight and stretch selection when using system fonts.
Add function to get system fallback font from a font name, style, text, and language code.
Implement system font support for Android.
Use system fonts as a last resort fallback.
2022-12-04 18:44:20 +02:00
bruvzg e910aa490c
[TextServer] Fix line breaking for the special fonts that substitute a long string (with breaks opportunities in it) with a single glyph. 2022-11-21 09:42:34 +02:00
bruvzg d77902f33a
Implement SVG in OT support. 2022-11-04 14:10:54 +02:00
bruvzg 02a4b3f859
[TextServer] Fix hex code box positions in vertical text layout. 2022-11-01 11:51:29 +02:00
bruvzg 397fa2fa7a
[TextServer] Fix incorrect line breaks count for embedded objects (e.g. RTL tables). 2022-10-31 17:34:07 +02:00
bruvzg f0b7ff324c
Improve text line breaking performance for long lines. 2022-10-31 15:35:51 +02:00
Rémi Verschelde 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
Rémi Verschelde d43364e3cc
Merge pull request #67968 from bruvzg/icu72.1
ICU: Update to version 72.1
2022-10-31 14:25:37 +01:00
Rémi Verschelde 76ef71bda0
Merge pull request #67585 from bruvzg/fix_no_graphite_build
[TextServer] Fix build with disabled graphite.
2022-10-31 14:22:32 +01:00
Rémi Verschelde 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
bruvzg 4e44a271f0
ICU: Update to version 72.1 2022-10-28 09:11:55 +03:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
bruvzg c1af9d57a3
Improve font glyph cache packing shelf best height fit heuristic. 2022-10-18 18:42:04 +03:00
bruvzg 634c2fbcae
[TextServer] Fix build with disabled graphite. 2022-10-18 18:41:31 +03:00
Rémi Verschelde 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
bruvzg 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
nikitalita 21341ddaed Speed up find_texture_pos_for_glyph() 2022-10-16 22:29:26 -07:00
Haoyu Qiu 6db8e79eed Fix memory leak when _ensure_cache_for_size() fails 2022-10-17 12:47:38 +08:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +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
bruvzg 930be37bb4
[TextServer GDExtension] Update build scripts and .gdextension files to use new target names and arch suffixes. 2022-10-05 11:41:03 +03:00
Rémi Verschelde f47979f087
Merge pull request #66242 from akien-mga/scons-unify-tools-target 2022-09-30 12:28:50 +02:00
Rémi Verschelde 44799b896f Merge pull request #66534 from akien-mga/scons-msvc-graphite-silence-c++17-deprecation-warnings
SCons: Silence MSVC C++17 deprecation warnings in Graphite
2022-09-29 15:33:45 +02:00
Rémi Verschelde 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
Rémi Verschelde 965022e5f6 SCons: Silence MSVC C++17 deprecation warnings in Graphite
Fixes #66497.
2022-09-28 13:27:19 +02:00
bruvzg 51978dde5a
[Text Server] Clear textures after "generate mipmaps" property change. 2022-09-28 12:43:34 +03:00
bruvzg 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
Rémi Verschelde 39facb35a0 SCons: Unify tools/target build type configuration
Implements https://github.com/godotengine/godot-proposals/issues/3371.

New `target` presets
====================

The `tools` option is removed and `target` changes to use three new presets,
which match the builds users are familiar with. These targets control the
default optimization level and enable editor-specific and debugging code:

- `editor`: Replaces `tools=yes target=release_debug`.
  * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_debug`: Replaces `tools=no target=release_debug`.
  * Defines: `DEBUG_ENABLED`, `-O2`/`/O2`
- `template_release`: Replaces `tools=no target=release`.
  * Defines: `-O3`/`/O2`

New `dev_build` option
======================

The previous `target=debug` is now replaced by a separate `dev_build=yes`
option, which can be used in combination with either of the three targets,
and changes the following:

- `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`),
  enables generating debug symbols, does not define `NDEBUG` so `assert()`
  works in thirdparty libraries, adds a `.dev` suffix to the binary name.

Note: Unlike previously, `dev_build` defaults to off so that users who
compile Godot from source get an optimized and small build by default.
Engine contributors should now set `dev_build=yes` in their build scripts or
IDE configuration manually.

Changed binary names
====================

The name of generated binaries and object files are changed too, to follow
this format:

`godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]`

For example:
- `godot.linuxbsd.editor.dev.arm64`
- `godot.windows.template_release.double.x86_64.mono.exe`

Be sure to update your links/scripts/IDE config accordingly.

More flexible `optimize` and `debug_symbols` options
====================================================

The optimization level and whether to generate debug symbols can be further
specified with the `optimize` and `debug_symbols` options. So the default
values listed above for the various `target` and `dev_build` combinations
are indicative and can be replaced when compiling, e.g.:

`scons p=linuxbsd target=template_debug dev_build=yes optimize=debug`
will make a "debug" export template with dev-only code enabled, `-Og`
optimization level for GCC/Clang, and debug symbols. Perfect for debugging
complex crashes at runtime in an exported project.
2022-09-26 16:31:46 +02:00
bruvzg 970592274d
[RTL] Fix font variations / OpenType features of theme default font not updated when default font is changed. 2022-09-26 13:04:40 +03:00
bruvzg 8cdb482738
[TextServer] Always prefer main font over fallbacks, regardless of script/language support. 2022-09-25 23:07:30 +03:00
bruvzg 163257d51b
[GDExtension] Implement support for typed arrays. 2022-09-22 23:31:27 +03:00
Rémi Verschelde 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
kobewi 9f2dc68279 Replace File/Directory with FileAccess/DirAccess 2022-09-19 11:03:31 +02:00
Haoyu Qiu 2d0d6e4f63 Fix crash when executing FontFile.get_face_count 2022-09-18 14:38:57 +08:00
bruvzg 19443a7fef
Fix line trim/ellipsis when line do not have space or newline at the end. 2022-09-16 19:46:26 +03:00
Rémi Verschelde 3a62c294c7 Merge pull request #65170 from KoBeWi/your_argument_is_TypedArray 2022-09-02 13:57:02 +02:00
kobewi 7adc8376ed Change Array arguments to TypedArray 2022-09-01 13:13:19 +02:00
bruvzg d83b6b1e1c
[TextServer] Fix LCD AA fonts reading wrong glyphs. 2022-09-01 08:10:33 +03:00
Rémi Verschelde 8fa9d1ae46
Merge pull request #65098 from bruvzg/msdf_modulate
Fix MSDF fonts color modulation.
2022-08-30 23:57:19 +02:00
Fabio Alessandrelli f958f00283 [Web] Require threads, rtti, allow optimize=speed.
Update export names (web[_dlink]_[release|debug].zip).

The Build with dynamic linking is broken due to high number of imports
in output wasm (likely emscripten regression issue 15487).
2022-08-30 20:01:19 +02:00
bruvzg fbcb98855d
Fix MSDF fonts color modulation. 2022-08-30 20:28:53 +03:00
Fabio Alessandrelli d20b32186f [Web] Rename JavaScript platform to Web.
Also rename export name from "HTML5" to "Web".
2022-08-29 11:52:00 +02:00
Rémi Verschelde 7013c68619
Merge pull request #64422 from bruvzg/make_fonts_unbearably_ugly_2.0 2022-08-26 11:59:07 +02:00