Skip to content

Commit 450c078

Browse files
committed
Move to the latest released version of Skrifa instead of a git dep
1 parent 557a5a2 commit 450c078

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/hb/face.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ impl<'a> hb_font_t<'a> {
133133
}
134134

135135
pub(crate) fn get_nominal_glyph(&self, c: u32) -> Option<GlyphId> {
136-
self.font.nominal_glyph(c).map(|gid| GlyphId(gid.to_u16()))
136+
self.font
137+
.nominal_glyph(c)
138+
.map(|gid| GlyphId(gid.to_u32() as u16)) // TODO: remove as u16 when fully on read-fonts GlyphId
137139
}
138140

139141
pub(crate) fn glyph_variation_index(&self, c: char, vs: char) -> Option<GlyphId> {
140142
self.font
141143
.nominal_variant_glyph(c as u32, vs as u32)
142-
.map(|gid| GlyphId(gid.to_u16()))
144+
.map(|gid| GlyphId(gid.to_u32() as u16)) // TODO: remove as u16 when fully on read-fonts GlyphId
143145
}
144146

145147
pub(crate) fn glyph_h_advance(&self, glyph: GlyphId) -> i32 {

src/hb/fonta/ot/gpos/pair.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn find_second_glyph<'a>(
104104
while lo < hi {
105105
let mid = (lo + hi) / 2;
106106
let record_offset = set_offset + 2 + mid * record_size;
107-
let glyph_id = base_data.read_at::<skrifa::GlyphId>(record_offset).ok()?;
107+
let glyph_id = base_data.read_at::<skrifa::GlyphId16>(record_offset).ok()?;
108108
if glyph_id < second_glyph {
109109
lo = mid + 1
110110
} else if glyph_id > second_glyph {
@@ -119,7 +119,7 @@ fn find_second_glyph<'a>(
119119

120120
impl Apply for PairPosFormat2<'_> {
121121
fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> {
122-
let first_glyph = ctx.buffer.cur(0).as_skrifa_glyph();
122+
let first_glyph = ctx.buffer.cur(0).as_skrifa_glyph16();
123123
self.coverage().ok()?.get(first_glyph)?;
124124

125125
let mut iter = skipping_iterator_t::new(ctx, ctx.buffer.idx, false);
@@ -132,7 +132,7 @@ impl Apply for PairPosFormat2<'_> {
132132
}
133133

134134
let second_glyph_index = iter.index();
135-
let second_glyph = ctx.buffer.info[second_glyph_index].as_skrifa_glyph();
135+
let second_glyph = ctx.buffer.info[second_glyph_index].as_skrifa_glyph16();
136136

137137
let finish = |ctx: &mut hb_ot_apply_context_t, iter_index: &mut usize, has_record2| {
138138
if has_record2 {

src/hb/fonta/ot/gsub/multiple.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ impl WouldApply for MultipleSubstFormat1<'_> {
2020

2121
impl Apply for MultipleSubstFormat1<'_> {
2222
fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> {
23-
let glyph = ctx.buffer.cur(0).as_glyph().0;
24-
let index = self.coverage().ok()?.get(skrifa::GlyphId::new(glyph))? as usize;
23+
let gid = ctx.buffer.cur(0).as_skrifa_glyph16();
24+
let index = self.coverage().ok()?.get(gid)? as usize;
2525
let substs = self.sequences().get(index).ok()?.substitute_glyph_ids();
2626
match substs.len() {
2727
// Spec disallows this, but Uniscribe allows it.

src/hb/fonta/ot/gsub/single.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ use ttf_parser::GlyphId;
55

66
impl WouldApply for SingleSubstFormat1<'_> {
77
fn would_apply(&self, ctx: &WouldApplyContext) -> bool {
8+
let gid = skrifa::GlyphId::from(ctx.glyphs[0].0);
89
ctx.glyphs.len() == 1
910
&& self
1011
.coverage()
11-
.map(|cov| cov.get(ctx.glyphs[0].0.into()).is_some())
12+
.map(|cov| cov.get(gid).is_some())
1213
.unwrap_or_default()
1314
}
1415
}
1516

1617
impl Apply for SingleSubstFormat1<'_> {
1718
fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> {
18-
let glyph = ctx.buffer.cur(0).as_skrifa_glyph();
19+
let glyph = ctx.buffer.cur(0).as_skrifa_glyph16();
1920
self.coverage().ok()?.get(glyph)?;
2021
let subst = (glyph.to_u16() as i32 + self.delta_glyph_id() as i32) as u16;
2122
ctx.replace_glyph(GlyphId(subst));

0 commit comments

Comments
 (0)