Skip to content

Font fallback api in command_queue.hpp #80

@JCash

Description

@JCash

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions