Skip to content

Commit

Permalink
remove temporary test/fix of positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Sep 9, 2024
1 parent 846414a commit 40464ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
19 changes: 10 additions & 9 deletions sugarloaf/src/components/rich_text/image_cache/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub struct GlyphCacheSession<'a> {
scaler: Scaler<'a>,
scaled_image: &'a mut GlyphImage,
quant_size: u16,
#[allow(unused)]
max_height: &'a u16,
}

Expand Down Expand Up @@ -151,8 +152,8 @@ impl<'a> GlyphCacheSession<'a> {
};
let image = self.images.allocate(req)?;

let mut top = p.top;
let mut height = h;
// let mut top = p.top;
// let mut height = h;

// If dimension is None it means that we are running
// for the first time and in this case, we will obtain
Expand All @@ -165,18 +166,18 @@ impl<'a> GlyphCacheSession<'a> {
// If the rect max height is 50 and the glyph height is 68
// and 48 top, then (68 - 50 = 18) height as difference and
// apply it to the top (bigger the top == up ^).
if self.max_height > &0 && &h > self.max_height {
let difference = h - self.max_height;
// if self.max_height > &0 && &h > self.max_height {
// let difference = h - self.max_height;

top -= difference as i32;
height = *self.max_height;
}
// top -= difference as i32;
// height = *self.max_height;
// }

let entry = GlyphEntry {
left: p.left,
top,
top: p.top,
width: w,
height,
height: h,
image,
is_bitmap: self.scaled_image.content == Content::Color,
};
Expand Down
8 changes: 2 additions & 6 deletions sugarloaf/src/font_introspector/internal/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,8 @@ impl<'a> Os2<'a> {

/// Returns a four character font vendor identifier.
pub fn vendor_id(&self) -> &'a str {
core::str::from_utf8(
self.0
.read_bytes(58, 4)
.unwrap_or(&[b'n', b'o', b'n', b'e']),
)
.unwrap_or("none")
core::str::from_utf8(self.0.read_bytes(58, 4).unwrap_or(b"none"))
.unwrap_or("none")
}

/// Returns the font selection bit flags.
Expand Down

0 comments on commit 40464ad

Please sign in to comment.