Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues rendering italic and underlines #60

Closed
nree opened this issue Sep 10, 2019 · 5 comments
Closed

Issues rendering italic and underlines #60

nree opened this issue Sep 10, 2019 · 5 comments

Comments

@nree
Copy link

nree commented Sep 10, 2019

Untitled

Sorry for poor job on the pic but:
Top line is fvim
Bottom line is cmder / conemu running vim (nvim)

This is Windows 10, using same font (SF Mono), same vim config, same wsl / neovim.

  • Cuts off italic last letter
  • Cuts off italic height of some letters (g in settings)
  • Underlines swiggles aren't connected, has a dotted look to them and look poor quality

I tried different fonts:

  • Consolas: italics ok has minor clipping except for underlines
  • Source Code Pro: italics slightly clips but not bad at all, underlines still bad
  • Fira Code: very bad clipping on italics and underline

I've tested fonts on other apps: Cmder (conemu) in the picture, tested with visual studio code, and emacs.

@yatli
Copy link
Owner

yatli commented Sep 11, 2019

interesting. looks like the font measurement function calcs off.
for height, you can workaround this by setting :FVimFontLineHeight (for example, :FVimFontLineHeight '+1.0')

@yatli
Copy link
Owner

yatli commented Sep 16, 2019

The horizontal clipping is weird. fvim conducts backward rendering so if the line comes in, later glyphs will be drawn first.

@yatli
Copy link
Owner

yatli commented Sep 16, 2019

The horizontal clipping is repro'ed and I think I've pinpointed the issue:

fvim/ui.fs

Lines 342 to 348 in 4e77a9b

let RenderText (ctx: IDrawingContextImpl, region: Rect, scale: float, fg: SKPaint, bg: SKPaint, sp: SKPaint, underline: bool, undercurl: bool, text: string, shaper: SKShaper ValueOption) =
ctx.PushClip(region)
// DrawText accepts the coordinate of the baseline.
// h = [padding space 1] + above baseline | below baseline + [padding space 2]
let h = region.Bottom - region.Y
// total_padding = padding space 1 + padding space 2

note that only the last glyph of an italic span gets clipped.

@yatli yatli closed this as completed in af99aed Sep 17, 2019
@yatli
Copy link
Owner

yatli commented Sep 17, 2019

@nree I'll push out a release soon. it should be fixed

@nree
Copy link
Author

nree commented Sep 18, 2019

Looks very very good now! Some of the best I've seen 😁

Regarding line height issue: (italic g, y + underline) I noticed something new... it actually renders good (first render). But then on re-renders after it will clip. Is this a bug? So it seems possible to render these height issues good, just something in the render clips them after. Should I open new issue about this? Opening new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants