Skip to content

Commit 554b38c

Browse files
authored
Merge pull request #106 from kas-gui/push-xozrnwozwpvy
Update fontique to 0.6.0
2 parents d2965eb + dd6d941 commit 554b38c

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ log = "0.4"
5151
serde = { version = "1.0.123", features = ["derive"], optional = true }
5252
ab_glyph = { version = "0.2.10", optional = true }
5353
swash = "0.2.4"
54-
fontique = "0.5.0"
54+
fontique = "0.6.0"
5555

5656
[dependencies.rustybuzz]
5757
version = "0.20.1"

src/display/text_runs.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::format::FormattableText;
1414
use crate::{Direction, script_to_fontique, shaper};
1515
use swash::text::LineBreak as LB;
1616
use swash::text::cluster::Boundary;
17-
use unicode_bidi::{BidiClass, BidiInfo, LTR_LEVEL, RTL_LEVEL};
17+
use unicode_bidi::{BidiInfo, LTR_LEVEL, RTL_LEVEL};
1818

1919
#[derive(Clone, Copy, Debug, PartialEq)]
2020
pub(crate) enum RunSpecial {
@@ -119,7 +119,6 @@ impl TextDisplay {
119119
let info = BidiInfo::new(text, default_para_level);
120120
let levels = info.levels;
121121
assert_eq!(text.len(), levels.len());
122-
let classes = info.original_classes;
123122

124123
let mut input = shaper::Input {
125124
text,
@@ -135,6 +134,7 @@ impl TextDisplay {
135134
let mut last_props = None;
136135

137136
let mut face_id = None;
137+
let mut last_real_face = None;
138138

139139
let mut last_is_control = false;
140140
let mut last_is_htab = false;
@@ -172,19 +172,15 @@ impl TextDisplay {
172172
input.script = script_to_fontique(props.script());
173173
}
174174

175-
let opt_last_face = if matches!(
176-
classes[index],
177-
BidiClass::L | BidiClass::R | BidiClass::AL | BidiClass::EN | BidiClass::AN
178-
) {
179-
None
175+
let opt_last_face = if !props.script().is_real() {
176+
last_real_face
180177
} else {
181-
face_id
178+
None
182179
};
183180
let font_id = fonts.select_font(&font, input.script)?;
184181
let new_face_id = fonts
185182
.face_for_char(font_id, opt_last_face, c)
186-
.expect("invalid FontId")
187-
.or(face_id);
183+
.expect("invalid FontId");
188184
let font_break = face_id.is_some() && new_face_id != face_id;
189185

190186
if let Some(face) = face_id
@@ -220,6 +216,11 @@ impl TextDisplay {
220216
last_is_control = is_control;
221217
last_is_htab = is_htab;
222218
face_id = new_face_id;
219+
if props.script().is_real() {
220+
last_real_face = face_id;
221+
} else if font_break || face_id.is_none() {
222+
last_real_face = None;
223+
}
223224
input.dpem = dpem;
224225
}
225226

0 commit comments

Comments
 (0)