Closed luke-biel closed 3 years ago
So, I've done a bit of research.
It looks like it's trying to access an index (i.e. write to a pixel) outside the bounding box, so there's an index out of bounds error.
I cloned ab_glyph, downloaded your font, and was able to reproduce the panic, taking bevy out of the equation.
The issue itself probably needs to be handled upstream by ab_glyph (ab_glyph_rasterizer to be exact).
I've found the following issues which are similar to your bevy-0.4.0 and bevy-master respectively. https://github.com/alexheretic/ab-glyph/issues/21 https://github.com/alexheretic/ab-glyph/issues/26
The reason it's outside the bounding box is that the bounding box for the 'v' glyph appears to have dimensions of 0 width and 0 height.
I've traced it back to ttf_parser::glyf::outline_impl
which is ultimately just reading binary data.
I cloned ttf_parser and put some dbg!()
s in there. Below is for the character 'v' (glyph id = 89):
glyf_table
[src\tables\glyf.rs:560] &range = 7060..7128
[src\tables\glyf.rs:562] &glyph_data = [
0, # ->
1, # -> number of contours = 1
0, # --->
0, # ---> x_min = 0
0, # ----->
0, # -----> y_min = 0
0, # ------->
0, # -------> x_max = 0
0, # --------->
0, # ---------> y_max = 0
0,
15,
0,
0,
# ...
]
[src\tables\glyf.rs:606] rect = Rect {
x_min: 0,
y_min: 0,
x_max: 0,
y_max: 0,
}
By contrast, this is 'w' (glyph id = 90)
glyf_table
[src\tables\glyf.rs:560] &range = 7128..7212
[src\tables\glyf.rs:562] &glyph_data = [
0, # ->
1, # -> number of contours = 1
0, # --->
0, # ---> x_min = 0
255, # ----->
254, # -----> y_min = -2
6, # ------->
164, # -------> x_max = 1700
5, # --------->
20, # ---------> y_max = 1300
0,
28,
0,
0,
# ...
]
[src\tables\glyf.rs:606] rect = Rect {
x_min: 0,
y_min: -2,
x_max: 1700,
y_max: 1300,
}
[examples\outline-glyph.rs:34] bbox = Rect {
x_min: 0,
y_min: -2,
x_max: 1700,
y_max: 1300,
}
So, it could be that the font itself is corrupt, as it's showing a zero sized bounding box for 'v'. Other text rendering engines handle it fine, so perhaps they have a fallback, or don't use the encoded bounding box, or something like that.
The subpixel work (the biggest/only? difference between bevy 0.4.0 and master) seems to hide this panic for some reason (but still renders nothing). I think it's because it now produces a non-zero-sized bounding box (0 width, 1 high).
The curves themselves seem to be fine, as I tested it with Lyon and successfully rendered a 'v'.
ab_glyph is putting a (work-around) fix in, however, the underlying issue is that the font itself is malformed.
See https://github.com/alexheretic/ab-glyph/issues/29 and https://github.com/RazrFalcon/ttf-parser/issues/49
Ye, I'm not shocked that font may be malformed, I dug it up from depths of web. I'll use something else right now till fix is in master.
Thank you very much for swift response and reaction :)
The dependency has been updated; closing :) See: https://github.com/alexheretic/ab-glyph/issues/29#issuecomment-764993286
Bevy version
0.4 and master
Operating system & version
Mac OS Big Sur 11.1
What you did
Copied
ui/button
example, changed font toairstrip four
(http://www.vicfieger.com/~font/techno.html). Ran example.What you expected to happen
Example displayed button that changes text on hover and press.
What actually happened
On
0.4
game crashed when hovered a button.On
master
game did not crash, just letterv
in wordhover
was not displayed.Additional information
Seems like there's issue in displaying letter
v
in this particular font. Some work must've been done since release of0.4
, becausemaster
is at least not panicking, but desired goal is to have font render properly. UppercaseV
is being displayed.