Skip to content

Commit f26e5f2

Browse files
mike-wardclaude
andcommitted
fix: pass first run's style as RTF base TextConfig
RTF views passed empty TextConfig (no font, size 0) causing wrong primary_ascent and emoji rendered too high. Extract first run's vglyph style as base so PangoLayout gets proper font description. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d3f436f commit f26e5f2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

view_rtf.v

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ fn (mut rtf RtfView) generate_layout(mut window Window) Layout {
4141
// Convert RichText to vglyph.RichText (with math inline objects)
4242
vg_rich_text := rtf.rich_text.to_vglyph_rich_text_with_math(&window.view_state.diagram_cache)
4343

44-
// Create vglyph text config
45-
// Negative indent creates hanging indent (wrapped lines indented)
44+
// Use first run's style as base so PangoLayout gets a proper
45+
// font description (needed for correct emoji vertical centering).
46+
base_style := if vg_rich_text.runs.len > 0 {
47+
vg_rich_text.runs[0].style
48+
} else {
49+
vglyph.TextStyle{}
50+
}
4651
cfg := vglyph.TextConfig{
52+
style: base_style
4753
block: vglyph.BlockStyle{
4854
wrap: .word
4955
width: -1.0

0 commit comments

Comments
 (0)