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

Indic font rendering incorrectly #13010

Closed
neevany opened this issue Apr 18, 2024 · 2 comments
Closed

Indic font rendering incorrectly #13010

neevany opened this issue Apr 18, 2024 · 2 comments
Labels
A-Text Rendering and layout for characters C-Bug An unexpected or incorrect behavior

Comments

@neevany
Copy link

neevany commented Apr 18, 2024

Bevy version

11afe16 / master

Relevant system information

SystemInfo { os: "MacOS 14.4.1 ", kernel: "23.4.0", cpu: "Apple M2 Pro"}
AdapterInfo { name: "Apple M2 Pro", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }

What you did

https://fonts.google.com/noto/specimen/Noto+Sans+Telugu

let text_style = TextStyle {
    font: asset_server.load("fonts/NotoSansTelugu-Medium.ttf"),
    font_size: 60.0,
    ..default()
};
parent.spawn(TextBundle {
  text: Text {
      sections: vec![TextSection::new("రాష్ట్రముల మధ్య", text_style.clone())],
      ..default()
  },
  ..default()
});

What went wrong

the font is not rendering correctly

  • what were you expecting?
    to render font correctly like in the screenshot from google fonts site
Screenshot 2024-04-18 at 8 01 54 AM
  • what actually happened?
    it did not render font correctly like in this screenshot
Screenshot 2024-04-18 at 8 00 53 AM
@neevany neevany added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Apr 18, 2024
@alice-i-cecile alice-i-cecile added A-Text Rendering and layout for characters and removed S-Needs-Triage This issue needs to be labelled labels Apr 18, 2024
@jordanhalase
Copy link

jordanhalase commented Apr 25, 2024

I do not know how to fix this but I decomposed the string into its code points.

రాష్ట్రముల మధ్య

Code points:

U+0C30		ర
U+0C3E		ా
U+0C37		ష
U+0C4D		్
U+0C1F		ట
U+0C4D		్
U+0C30		ర
U+0C2E		మ
U+0C41		ు
U+0C32		ల
U+0020		 
U+0C2E		మ
U+0C27		ధ
U+0C4D		్
U+0C2F		య

The first character looks like a ర with a ◌ా nonspacing mark (U+0C3E) appended. The combining mark is tacked on, but the glyph should render differently when it is applied. They should combine as a రా.

The next visual glyph appears to be made up of five code points, which render completely differently if any are removed. This is me pressing backspace on the second glyph:

ష్ట్ర ష్ట్ ష్ట ష్ ష

For this glyph, the first two code points U+0C37 U+0C4D combine to make ష్ but the second and third code point U+0C4D U+0C1F combine to make ట్, yet the fourth and fifth code point combine to make ్ర. Maybe something is parsing the TTF wrong with the grapheme clusters?

Is this a limitation of the ab_glyph crate that bevy_text uses internally?

Does anyone have any thoughts?

EDIT: I wonder if down the line we could make use of something like rustybuzz as a text shaping engine for complex scripts like Indic or Hebrew. Bevy doesn't seem to support right-to-left languages either at the moment.

@rparrett
Copy link
Contributor

Looks like this was fixed by #10193

image

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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants