rive-app / rive-app/rive-runtime
Font fallback api in command_queue.hpp
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 121
- PR merge metrics
- No merged PRs in 30d
Description
As we've discussed offline, the command_queue.hpp is the api that we want to move towards.
However, I'm not sure how this CommandQueue::addGlobalFontAsset(std::string name, FontHandle handle) should work for fonts.
In my use case, I have two use cases.
- out-of-band/referenced fonts
- font fallbacks
If it's already possible, can you provide examples of how to do this?
- After loading a
.riv, the user wants to swap one font in theFileHandle. - After loading a
.rivfile, and setting a localised text, the text uses glyphs that aren't present in the default font. Adding one or more font fallbacks is needed.
Suggestions:
-
Add
CommandQueue::addFont(FileHandle file, std::string name, FontHandle handle, uint64_t requestId = 0)- Replaces the font asset withnamewith a new font. -
Add
CommandQueue::removeFont(FileHandle file, std::string name, FontHandle handle, uint64_t requestId = 0)- Removed the font asset withnamewith a new font. Leaves it empty, as one has to be able to explicitly control memory usage. -
Add
CommandQueue::addFontFallback(FontHandle font, FontHandle fallback, uint64_t requestId = 0)-- adds a font fallback (e.g. japanese) to an existing font -
Add
CommandQueue::removeFontFallback(FontHandle font, FontHandle fallback, uint64_t requestId = 0)-- removes a font fallback from an existing font
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with command_queue.hpp and inspect the existing CommandQueue, FileHandle, and FontHandle APIs. Compare the requested font replacement, removal, and fallback operations with the two stated use cases; done means the API behavior and usage examples are agreed and implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100