Skip to content
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

Closes #12278 - added filtering #12279

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MNPCMW6444
Copy link

@MNPCMW6444 MNPCMW6444 commented Nov 1, 2024

Description

Issue number and link

#12278
issue #12278

Testing plan

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

Copy link

github-actions bot commented Nov 1, 2024

Thank you for the pull request, @MNPCMW6444! Welcome to the Cesium community!

In order for us to review your PR, please complete the following steps:

Review Pull Request Guidelines to make sure your PR gets accepted quickly.

@ggetz
Copy link
Contributor

ggetz commented Nov 7, 2024

Thanks for the PR @MNPCMW6444!

I can confirm we have a CLA on file for you.

Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

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

Could you please add a unit test to verify this fix?

@@ -118,8 +118,74 @@ function addGlyphToTextureAtlas(textureAtlas, id, canvas, glyphTextureInfo) {

const splitter = new GraphemeSplitter();

// Filter to remove unsupported control characters like RLM (\u200f)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain a bit about how this list was determined? Would it make sense to test for a unicode range instead of listing each character individually?

Copy link
Author

Choose a reason for hiding this comment

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

see my comment please

let text = label._renderedText;

// Filter out unsupported control characters
text = filterUnsupportedCharacters(text);
Copy link
Contributor

Choose a reason for hiding this comment

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

Regex operations can be performance intensive. Is there a way we can ensure the operation runs only once for each label text string, as apposed to every time the glyphs need to be rebound?

Copy link
Author

Choose a reason for hiding this comment

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

I can implement this with a simple .replace(char, '') instead of a RegExp, will it be acceptable?

packages/engine/Source/Scene/LabelCollection.js Outdated Show resolved Hide resolved
@MNPCMW6444
Copy link
Author

Could you please add a unit test to verify this fix?

@ggetz Thanks for your CR!
For the purpose of determing what characters are problematic (turns out not all control chars) and TESTING after the patch I added a full test to sandcastle. but I didn't commit it to PR because I don't think we want it in the sandcastle.
you can see it here - https://github.com/MNPCMW6444/cesium/tree/control-characters-in-labels-causes-the-render-to-stop-%2312278-with-full-test
tell me if you still think I need a unit test or any other comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants