Skip to content

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Oct 30, 2025

Objective

Update bevy_text's cosmic-text dependency to 0.15

Fixes #21766

Solution

Very minimal changes here, nothing user facing except an error return type.

  • Cosmic-text no longer uses ttf_parser, so, to validate fonts during asset loading, a skrifa::FontRef is constructed instead. If the font is invalid, the font asset loader now returns a skrifa::ReadError, not a ttf_parser::FaceParsingError.
  • To get a font from the global CosmicFontSystem instance, the get_font function requires a weight now. The weight is looked up from the CosmicFontSystems font database, immediately before the get_font call.

The changes here are a little hackish, but that's a symptom of our lack of support for font collections.

@ickshonpe ickshonpe added C-Dependencies A change to the crates that Bevy depends on A-Text Rendering and layout for characters D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 30, 2025
Copy link
Contributor

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how small the diff is here, this seems worth doing even if we decide to switch to Parley soon. Will give fairer performance comparisons too.

@ickshonpe ickshonpe added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 6, 2025
@cart cart added this pull request to the merge queue Nov 13, 2025
Merged via the queue into bevyengine:main with commit 2a24658 Nov 13, 2025
40 checks passed
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Nov 15, 2025
# Objective

Update `bevy_text`'s cosmic-text dependency to 0.15

Fixes bevyengine#21766

## Solution

Very minimal changes here, nothing user facing except an error return
type.

* Cosmic-text no longer uses `ttf_parser`, so, to validate fonts during
asset loading, a `skrifa::FontRef` is constructed instead. If the font
is invalid, the font asset loader now returns a `skrifa::ReadError`, not
a `ttf_parser::FaceParsingError`.
* To get a font from the global `CosmicFontSystem` instance, the
`get_font` function requires a weight now. The weight is looked up from
the `CosmicFontSystems` font database, immediately before the `get_font`
call.

The changes here are a little hackish, but that's a symptom of our lack
of support for font collections.

Co-authored-by: François Mockers <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Nov 16, 2025
# Objective

Update `bevy_text`'s cosmic-text dependency to 0.15

Fixes bevyengine#21766

## Solution

Very minimal changes here, nothing user facing except an error return
type.

* Cosmic-text no longer uses `ttf_parser`, so, to validate fonts during
asset loading, a `skrifa::FontRef` is constructed instead. If the font
is invalid, the font asset loader now returns a `skrifa::ReadError`, not
a `ttf_parser::FaceParsingError`.
* To get a font from the global `CosmicFontSystem` instance, the
`get_font` function requires a weight now. The weight is looked up from
the `CosmicFontSystems` font database, immediately before the `get_font`
call.

The changes here are a little hackish, but that's a symptom of our lack
of support for font collections.

Co-authored-by: François Mockers <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Nov 16, 2025
# Objective

Update `bevy_text`'s cosmic-text dependency to 0.15

Fixes bevyengine#21766

## Solution

Very minimal changes here, nothing user facing except an error return
type.

* Cosmic-text no longer uses `ttf_parser`, so, to validate fonts during
asset loading, a `skrifa::FontRef` is constructed instead. If the font
is invalid, the font asset loader now returns a `skrifa::ReadError`, not
a `ttf_parser::FaceParsingError`.
* To get a font from the global `CosmicFontSystem` instance, the
`get_font` function requires a weight now. The weight is looked up from
the `CosmicFontSystems` font database, immediately before the `get_font`
call.

The changes here are a little hackish, but that's a symptom of our lack
of support for font collections.

Co-authored-by: François Mockers <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Nov 18, 2025
# Objective

Update `bevy_text`'s cosmic-text dependency to 0.15

Fixes bevyengine#21766

## Solution

Very minimal changes here, nothing user facing except an error return
type.

* Cosmic-text no longer uses `ttf_parser`, so, to validate fonts during
asset loading, a `skrifa::FontRef` is constructed instead. If the font
is invalid, the font asset loader now returns a `skrifa::ReadError`, not
a `ttf_parser::FaceParsingError`.
* To get a font from the global `CosmicFontSystem` instance, the
`get_font` function requires a weight now. The weight is looked up from
the `CosmicFontSystems` font database, immediately before the `get_font`
call.

The changes here are a little hackish, but that's a symptom of our lack
of support for font collections.

Co-authored-by: François Mockers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Text Rendering and layout for characters C-Dependencies A change to the crates that Bevy depends on D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update cosmic-text to version 0.15

6 participants