7 Commits

Author SHA1 Message Date
1848316d20 Support supplying mobile fallback fonts by style with caching
This pull request builds on top of fallback font support on iOS by including the ability to provide fallback fonts based on the styling of the missing character. Currently, the style information only contains weight. This weight is grabbed by calling `getAxisValue`. According to Luigi, this is a linear search, so perhaps there's room for a performance optimization later on.

There is one lower-level C++ change: `gFallbackProc` returns the font for the missing character, in addition _to_ the missing character (as a second parameter). This font will be used to generate the requested styling within the iOS runtime.

This adds a new class property to `RiveFont`: `fallbackFontCallback` (whose name I'm open to changing). This is a block (i.e closure) that will be called when a fallback font is requested. It supplies the styling of the missing character so that, for example, different fonts can be used based on the weight of the missing character. For example usage, see `SwiftFallbackFonts.swift`. This provider is what's used under-the-hood, and utilizes the pre-existing `fallbackFonts` class property

The "trickiest" bit here is the caching. NSDictionary requires equatable / hashable types as keys, and we want to minimize additional generation of a Rive font, so we cache any used fonts in a wrapper type, used as the value. When new fallback fonts are provided, either directly or when a new provider block is set, the cache will be reset. Once the weight is determined, generating the right key is as simple as calling the right initializer, and when set, generating the right value is simple as calling the right initializer with the created Rive font.

Finally, `RiveFactory` was getting a little bloated, so I did a little file cleanup.

This pull requests also includes Android support from #8621

Diffs=
7986d64d83 Support supplying mobile fallback fonts by style with caching (#8396)
fb8ecf3552 fixed url for canddiates and goldens in not pack mode (#8649)
4b82cf2e91 treat remapped animations as always settled (#8643)
d7db032e08 update measure function to use its text wrap and max size (#8640)
406e938c3d add support for standalone custom properties to bind values to (#8634)
8f3b760a6c Dx11 support (#8577)

Co-authored-by: David Skuza <david@rive.app>
Co-authored-by: Umberto <usonnino@gmail.com>
Co-authored-by: Umberto Sonnino <umberto@rive.app>
2024-11-27 16:54:48 +00:00
12aac262f5 slim down harfbuzz
Diffs=
c36e16cb6 slim down harfbuzz (#6710)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-03-02 04:57:22 +00:00
e43e18973e Lua formatter
Format all our lua scripts with Stylua

https://www.notion.so/rive-app/Formatters-be8845abbca34e39b5d4c212b2437b3f?pvs=4

Diffs=
858215cc4 Lua formatter (#6525)
b8875ef31 Reorganize premake (#6522)
fddb050ca Build Android deps with audio (#6515)
5cfc226f2 PLS external framebuffer optimizations (#6516)
2018358a6 Properly generate an android_ndk toolset (#6506)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-01-26 23:52:44 +00:00
ff3dcae269 Audio engine
Adds an audio engine abstraction (implemented with miniaudio) in Rive. We can selectively replace it with other abstractions later if we find miniaudio isn't well suited everywhere but I'm confident it will be based on flexibility with getting it working in the recorder.

Adds audio support in:

- packages/rive_common
  - WASM: rive_audio_wasm.dart
  - FFI: rive_audio_ffi.dart
- packages/runtime
- packages/recorder

Subsequent PR will add support in:

- packages/rive_unity
  - This is getting meaty enough...
- packages/rive_flutter
  - This requires publishing rive_common so I want to make sure this is reviewed and accepted before publishing
  - I'd also prefer to merge layout constraints into rive_common before this lands.

Editor features:
- Updated preview window:
<img width="248" alt="CleanShot 2024-01-15 at 14 44 31@2x" src="https://github.com/rive-app/rive/assets/454182/a9588be6-8370-4e22-ab32-af1e9ed71183">

- Preview waveforms in the timeline:
<img width="651" alt="CleanShot 2024-01-15 at 14 44 53@2x" src="https://github.com/rive-app/rive/assets/454182/2710667f-838f-483d-9647-e2bcb9e0237a">

- Subsequent PR will also use threads in web editor build (currently uses a time/frame based decoder to offload ui). I can't do that until I can verify the Shared Memory access is granted once rive_common lands in pub.dev and then we can push to UAT.

Diffs=
73bf11db3 Audio engine (#6454)
b098ad23a IntersectionBoard optimizations (#6486)
fafdef56c IntersectionBoard cleanups (#6474)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2024-01-23 04:14:10 +00:00
c6f1ae4cff Removed single-threaded counter.
This counter type is single-threaded and makes all objects using it thread-unsafe.

Diffs=
6a74a01f2 Removed single-threaded counter. (#6090)
b4ef09a6d Removed Cargo workspace dependencies. (#6089)
c63346b93 Fission the CG and Skia renderers (#6071)

Co-authored-by: Dragoș Tiselice <dragos@rive.app>
2023-10-13 15:11:10 +00:00
a989837116 Fix diacritics
The big churn is from bumping us to Harfbuzz 6.0.0 (we were on a master from June 2022, 6.0.0 was released December 2022) as it fixes some diacritic positioning with Arabic text.

The main fix, however, comes from marshaling the glyph offsets to Dart (and storing them in C++ which we weren't doing). This is a translation offset within the local space (baseline and advance) of the glyph. It was causing our Arabic diacritics (the "accents" if you will) to be positioned incorrectly.

Prior to the fix:
![image](https://user-images.githubusercontent.com/454182/235834041-a683851a-96b0-4c72-adb9-f68c97682c14.png)

Post fix:
![image](https://user-images.githubusercontent.com/454182/235834074-23db8fab-08be-4529-98b3-f8a04ebe623a.png)

Same word displayed in Google Fonts (confirming correctness, also confirmed by an Arabic reader  on our Discord):
![CleanShot 2023-05-02 at 21 43 33@2x](https://user-images.githubusercontent.com/454182/235834273-9e423c7f-9dc2-48c3-afec-c7f7a9986416.png)

Diffs=
a8c1e3e75 Fix diacritics (#5200)
c7ecbe025 Run clang-format on .glsl files (#5180)
9945a7d2d Merge sbs_render_and_advance into master (#5181)
542e320d2 Discard empty verbs from RawPath (#5166)
2023-05-03 21:39:19 +00:00
e618def5cd Text
Uses it in the artboard title but also updates the flutter runtime massively to support FFI & WASM C++ Rive Text. PRing to let the tests run.

Diffs=
3be5ff0d8 Text (#4372)
90245a5e1 Fix the Android debug build
0a0f3c267 Fix for missing animation in a blend state. (#4415)
440512dca Add simd::if_then_else (#4403)
ec9fb5bfc Revert "Update SIMD booleans to use bitwise logic operators"
701d8dee2 Update SIMD booleans to use bitwise logic operators
e98b93a61 Add SIMD fallbacks for missing builtins
466f68e3a Add some more core math and SIMD functions
2022-11-15 23:07:11 +00:00