tweak vertical positioning (#795)

macos-click-through
Keith Simmons 4 years ago committed by GitHub
parent 305f791b31
commit 80c57bb339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
Cargo.lock generated

@ -2276,7 +2276,7 @@ dependencies = [
[[package]]
name = "skia-bindings"
version = "0.40.2"
version = "0.39.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e49c0905fe8fa4a4fe348f0ec33a3b3fc78e73f4602c7154d8fb70d4b0aaee2"
dependencies = [
@ -2294,7 +2294,7 @@ dependencies = [
[[package]]
name = "skia-safe"
version = "0.40.2"
version = "0.39.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147b9ab328c7c40dbf590151313df9cd721be8c418cfefa2533c9a0c056ef21b"
dependencies = [

@ -111,7 +111,7 @@ impl CachingShaper {
pub fn y_adjustment(&mut self) -> u64 {
let metrics = self.metrics();
(metrics.ascent + metrics.leading) as u64
(metrics.ascent + metrics.leading).ceil() as u64
}
fn build_clusters(
@ -248,7 +248,7 @@ impl CachingShaper {
pub fn shape(&mut self, cells: &[String], bold: bool, italic: bool) -> Vec<TextBlob> {
let current_size = self.current_size();
let (glyph_width, _) = self.font_base_dimensions();
let (glyph_width, glyph_height) = self.font_base_dimensions();
let mut resulting_blobs = Vec::new();
@ -272,7 +272,11 @@ impl CachingShaper {
shaper.shape_with(|glyph_cluster| {
for glyph in glyph_cluster.glyphs {
glyph_data.push((glyph.id, glyph.data as u64 * glyph_width));
let position = (
(glyph.data as u64 * glyph_width) as f32,
glyph.y,
);
glyph_data.push((glyph.id, position));
}
});
@ -282,10 +286,10 @@ impl CachingShaper {
let mut blob_builder = TextBlobBuilder::new();
let (glyphs, positions) =
blob_builder.alloc_run_pos_h(&font_pair.skia_font, glyph_data.len(), 0.0, None);
for (i, (glyph_id, glyph_x_position)) in glyph_data.iter().enumerate() {
blob_builder.alloc_run_pos(&font_pair.skia_font, glyph_data.len(), None);
for (i, (glyph_id, glyph_position)) in glyph_data.iter().enumerate() {
glyphs[i] = *glyph_id;
positions[i] = *glyph_x_position as f32;
positions[i] = (*glyph_position).into();
}
let blob = blob_builder.make();

Loading…
Cancel
Save