Skip to content

Commit

Permalink
Address other consequences of the upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Sep 23, 2024
1 parent 024481a commit d751c7d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/scenes/src/simple_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl SimpleText {
let x = pen_x;
pen_x += advance;
Some(Glyph {
id: gid.to_u16() as u32,
id: gid.to_u32(),
x,
y: pen_y,
})
Expand Down
2 changes: 1 addition & 1 deletion vello/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl<'a> DrawGlyphs<'a> {
loop {
let ppem = self.run.font_size;
let outline_glyphs = (&mut glyphs).take_while(|glyph| {
let glyph_id = GlyphId::new(glyph.id.try_into().unwrap());
let glyph_id = GlyphId::new(glyph.id);
match colour_collection.get(glyph_id) {
Some(color) => {
final_glyph = Some((EmojiLikeGlyph::Colr(color), *glyph));
Expand Down
7 changes: 5 additions & 2 deletions vello/src/scene/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<'a> BitmapStrikes<'a> {
/// This will prefer `sbix`, `CBDT`, and `CBLC` formats in that order.
///
/// To select a specific format, use [`with_format`](Self::with_format).
pub fn new(font: &impl TableProvider<'a>) -> Self {
pub fn new(font: &(impl TableProvider<'a> + MetadataProvider<'a>)) -> Self {
for format in [BitmapFormat::Sbix, BitmapFormat::Cbdt, BitmapFormat::Ebdt] {
if let Some(strikes) = Self::with_format(font, format) {
return strikes;
Expand All @@ -38,7 +38,10 @@ impl<'a> BitmapStrikes<'a> {
/// Creates a new `BitmapStrikes` for the given font and format.
///
/// Returns `None` if the requested format is not available.
pub fn with_format(font: &impl TableProvider<'a>, format: BitmapFormat) -> Option<Self> {
pub fn with_format(
font: &(impl TableProvider<'a> + MetadataProvider<'a>),
format: BitmapFormat,
) -> Option<Self> {
let kind = match format {
BitmapFormat::Sbix => StrikesKind::Sbix(
font.sbix().ok()?,
Expand Down
2 changes: 1 addition & 1 deletion vello_encoding/src/glyph_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<'a> GlyphCacheSession<'a> {
entry.serial = self.serial;
return Some((entry.encoding.clone(), entry.stream_sizes));
}
let outline = self.outlines.get(GlyphId::new(key.glyph_id as u16))?;
let outline = self.outlines.get(GlyphId::new(key.glyph_id))?;
let mut encoding = self.free_list.pop().unwrap_or_default();
let encoding_ptr = Arc::make_mut(&mut encoding);
encoding_ptr.reset();
Expand Down

0 comments on commit d751c7d

Please sign in to comment.