|
@@ -221,18 +221,19 @@ impl FontLoader {
|
|
|
let mut id = 0;
|
|
|
let mut width = 0;
|
|
|
for (i, charcode) in string.char_indices() {
|
|
|
- let (this_id, char_width) = self.glyphset_and_width_for_char(charcode).unwrap();
|
|
|
- width += char_width;
|
|
|
- if i == 0 {
|
|
|
- id = this_id;
|
|
|
- }
|
|
|
- else if id != this_id {
|
|
|
- ret.push(TextGroup {
|
|
|
- text: &string[prev..i],
|
|
|
- glyphset: id
|
|
|
- });
|
|
|
- id = this_id;
|
|
|
- prev = i;
|
|
|
+ if let Some((this_id, char_width)) = self.glyphset_and_width_for_char(charcode) {
|
|
|
+ width += char_width;
|
|
|
+ if i == 0 {
|
|
|
+ id = this_id;
|
|
|
+ }
|
|
|
+ else if id != this_id {
|
|
|
+ ret.push(TextGroup {
|
|
|
+ text: &string[prev..i],
|
|
|
+ glyphset: id
|
|
|
+ });
|
|
|
+ id = this_id;
|
|
|
+ prev = i;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
ret.push(TextGroup {
|