Skip to content

Remove the text-span-and-custom-font based cursor #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rparrett opened this issue Jan 14, 2025 · 0 comments
Open

Remove the text-span-and-custom-font based cursor #87

rparrett opened this issue Jan 14, 2025 · 0 comments
Labels
blocked This cannot more forward until something else changes enhancement New feature or request

Comments

@rparrett
Copy link
Owner

rparrett commented Jan 14, 2025

Prior to Bevy 0.15, this solution was necessary, because it was impossible to accurately determine the "physical" position of the cursor due to limitations in ab_glyph. (Er, seems that we're blocked on 0.16)

We should be able to do something less crazy for a cursor now.

We could either

  1. Use cosmic-text's Editor for cursor management (and buffer manipulation)

    The cosmic text design that landed in Bevy 0.15 didn't include a way to access the cosmic buffer. After Bevy 0.16, it might be possible to do this again thanks to CosmicBuffer is a public type but not not used or accessible in any public API bevyengine/bevy#17748.

    This is arguably "not simple." and we may want to wait for improvements in cosmic-text. The buffer / editor juggling that needs to be done is pretty nasty. But it could potentially simplify other sections of code.

    See cosmic changes #74 (comment)
    And Save and resume editor state / handle external pop-os/cosmic-text#285.

  2. Look up the cursor position in TextLayoutInfo now that it is more reliable.

    Note that PositionedGlyph's size refers to the size of the glyph texture, which is not what we want, especially for space characters.

    After Bevy 0.16, it will be possible to get the correct width value from the cosmic buffer. (though it is tedious to do so)

And draw the cursor as a simple colored Node. (This can/should be a temporary ExtractedNode in the render world)

@rparrett rparrett changed the title Remove the text-span-based cursor Remove the text-span-and-custom-font based cursor Jan 14, 2025
@rparrett rparrett added blocked This cannot more forward until something else changes enhancement New feature or request labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This cannot more forward until something else changes enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant