rive-app / rive-app/rive-runtime

Font fallback api in command_queue.hpp

Open
#80 0 comments 0 reactions 0 assignees View on GitHub

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?

  1. After loading a .riv, the user wants to swap one font in the FileHandle.
  2. After loading a .riv file, 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 with name with a new font.

  • Add CommandQueue::removeFont(FileHandle file, std::string name, FontHandle handle, uint64_t requestId = 0) - Removed the font asset with name with 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.