Skip to content

feat(text_gizmos): add support for accented Latin characters#24003

Open
nuts-rice wants to merge 9 commits into
bevyengine:mainfrom
nuts-rice:text_gizmo_char_support
Open

feat(text_gizmos): add support for accented Latin characters#24003
nuts-rice wants to merge 9 commits into
bevyengine:mainfrom
nuts-rice:text_gizmo_char_support

Conversation

@nuts-rice
Copy link
Copy Markdown
Contributor

@nuts-rice nuts-rice commented Apr 27, 2026

Objective

Solution

  • Adds extended field to StrokeFont
  • Conditional to get_glyph for finding glyphs outside of ASCII
  • Placeholder '?' char for glyphs outside of ASCII
  • Now supporting accented Latin characters
  • EXTENDED_POSITIONS ACCENT_STROKES SIMPLEX_EXTENDED arrays now owned by extended_ fields in SIMPLEX_STROKE_FONTS

Testing

  • 2d_text_gizmos example renders accented characters

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Gizmos Visual editor and debug gizmos A-Text Rendering and layout for characters M-Release-Note Work that should be called out in the blog due to impact S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

@nuts-rice nuts-rice force-pushed the text_gizmo_char_support branch 3 times, most recently from 54d087f to e3016f5 Compare April 27, 2026 17:00
@nuts-rice nuts-rice force-pushed the text_gizmo_char_support branch from e3016f5 to 1868c78 Compare April 27, 2026 17:05
@cart cart closed this May 5, 2026
@cart cart reopened this May 5, 2026
@nuts-rice nuts-rice force-pushed the text_gizmo_char_support branch from 05aa450 to cf17a12 Compare May 5, 2026 15:00
@nuts-rice
Copy link
Copy Markdown
Contributor Author

nuts-rice commented May 5, 2026

Now supporting accent marks

Screenshot_2026-05-05_09-19-59

@nuts-rice nuts-rice marked this pull request as ready for review May 5, 2026 15:31
@nuts-rice nuts-rice force-pushed the text_gizmo_char_support branch from 027740c to 5755a7f Compare May 5, 2026 17:11
@nuts-rice nuts-rice force-pushed the text_gizmo_char_support branch from 5755a7f to 2de6580 Compare May 8, 2026 16:47
@kfc35 kfc35 added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels May 11, 2026
@kfc35 kfc35 self-requested a review May 11, 2026 03:24
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

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

If this is ready for review, you probably should change the PR title to remove WIP

“add support for accented latin characters” sounds like it better conveys what this does

return Some((color, inner));
}

for stroke_idx in current_extended_strokes.by_ref() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: it’d be nice to dedup this logic with the current_main_strokes for loop if possible. they have similar enough bodies, but unsure if it’ll make things less comprehensible

continue;
}

// If this stroke is a closed loop, append one extra point to add a join at the seam.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment still has some value, no? I believe this was clarification for a bug fix previously #22982

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

put that back in, sorry about that

///
/// Only ASCII characters in the range 32–126 are supported.
///
/// Unsupported characters will be rendered as '?'.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this true? I tried typing Japanese hiragana into a text gizmo from your branch and it shows up blank

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unsupported will now render as a box, put hirigana as unsupported in example text_gizmo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These comments will have to be updated from “?” to “☐” (or whatever the appropriate square character is because I cannot find the exact one lol)

Comment thread crates/bevy_gizmos/src/stroke_text.rs Outdated
self.extended[i].3.clone(),
)
} else {
GlyphSource::Standard(self.advance, 0..0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if this merits its own type of GlyphSource::Unsupported

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

put in Unuspported and associated logic

@nuts-rice nuts-rice changed the title feat(text_gizmos): extended and unsupported WIP feat(text_gizmos): add support for accented Latin characters May 11, 2026
@nuts-rice nuts-rice force-pushed the text_gizmo_char_support branch from 7b5c640 to d3cf2d7 Compare May 11, 2026 17:09
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

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

Tested it out and the example looks good

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It’s unfortunate that the starting size doesn’t show every glyph anymore…. seems like it’s time to up the height

Suggested change
resolution: WindowResolution::new(1920, 1920).with_scale_factor_override(1.0),

///
/// Only ASCII characters in the range 32–126 are supported.
///
/// Unsupported characters will be rendered as '?'.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These comments will have to be updated from “?” to “☐” (or whatever the appropriate square character is because I cannot find the exact one lol)

@@ -0,0 +1,13 @@
---
title: Text gizmos extended characters
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, if this gets in before we release 0.19, I think this might be better merged with the existing text gizmos release note…

but a maintainer will let you know for certain, so I wouldn’t do anything just yet.

@kfc35 kfc35 requested a review from ickshonpe May 12, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Gizmos Visual editor and debug gizmos A-Text Rendering and layout for characters C-Feature A new feature, making something new possible M-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants