From 7f5902d364af0be90f8ba10dd92f4ac95ca0af6b Mon Sep 17 00:00:00 2001 From: keith Date: Fri, 24 Jan 2020 11:12:34 -0800 Subject: [PATCH] adjust emoji positioning --- src/renderer/caching_shaper.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/caching_shaper.rs b/src/renderer/caching_shaper.rs index 98fb7d3..ba366df 100644 --- a/src/renderer/caching_shaper.rs +++ b/src/renderer/caching_shaper.rs @@ -115,6 +115,9 @@ impl CachingShaper { let session = LayoutSession::create(text, &style, &collection); + let metrics = font_pair.normal.1.font.metrics(); + let ascent = metrics.ascent * base_size / metrics.units_per_em as f32; + let mut blobs = Vec::new(); for layout_run in session.iter_all() { @@ -128,8 +131,6 @@ impl CachingShaper { let mut blob_builder = TextBlobBuilder::new(); let count = layout_run.glyphs().count(); - let metrics = skribo_font.font.metrics(); - let ascent = metrics.ascent * base_size / metrics.units_per_em as f32; let (glyphs, positions) = blob_builder.alloc_run_pos_h(&skia_font, count, ascent, None); for (i, glyph) in layout_run.glyphs().enumerate() {