mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-26 04:48:29 +00:00
Merge pull request #303 from aloucks/font_name
Font name length check should use the minimum length
This commit is contained in:
commit
0089636eb2
@ -337,7 +337,7 @@ impl FontConfig {
|
|||||||
raw.EllipsisChar = self.ellipsis_char.map(|x| x as u16).unwrap_or(0xffff);
|
raw.EllipsisChar = self.ellipsis_char.map(|x| x as u16).unwrap_or(0xffff);
|
||||||
if let Some(name) = self.name.as_ref() {
|
if let Some(name) = self.name.as_ref() {
|
||||||
let bytes = name.as_bytes();
|
let bytes = name.as_bytes();
|
||||||
let mut len = bytes.len().max(raw.Name.len() - 1);
|
let mut len = bytes.len().min(raw.Name.len() - 1);
|
||||||
while !name.is_char_boundary(len) {
|
while !name.is_char_boundary(len) {
|
||||||
len -= 1;
|
len -= 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user