-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support non-monospace fonts #16
Comments
Double width characters are supported. Could you tell me which specific characters and fonts cause this problem for you? |
Ah, it looks like those are unicode private use area characters. The house for example is probably U+F7DB. wcwidth will report these as narrow characters. It looks like the way to fix this is by using font ligatures, then some PUA character followed by a space can be displayed using two cells. Ligatures are not currently implemented in havoc, so that would have to be done first. |
st (suckless terminal) and Alacritty both don't support ligatures, yet they display these symbols correctly. |
Does st actually display the symbol using an extra cell? Or does it just draw on the next cell that may have a different character. Try this in st to see: When I use this symbol with a different nerd ttf font it shows correctly in a single cell in havoc. |
All my terminal emulators (kitty, alacritty, st, havoc) render the glyph cut off, occupying a single cell. I tried with official Nerd Font ttf files and by converting the Hasklug Nerd Font using FontForge: fontforge -lang=ff -c 'Open("Hasklug Nerd Font Complete.otf"); Generate("Hasklug.ttf")' When I add a space, the house icon is fully visible in kitty, alacritty, and st. The house icon is cut off in havoc. printf "\xef\x9f\x9b \xe2\x96\x88" Alacritty and st do not support ligatures right now. |
In that case I'm afraid I don't really know what to do about this. havoc only renders each glyph within the confounds of it's cell(s). Non monospace fonts like the one you are trying to use won't work. |
I have a related issue, since I use extensively UTF8 arrows within Venn diagrams for documentation: ─►
◄──
│
▼
▲
│ Is there a way to patch those to work with monospace inside havoc? |
Yes the glyphs of the font just need to not be too wide to fit in a single cell in the terminal. For example with DejaVuSansMono those characters work fine for me, they don't look nice though, maybe you can find a font where they both look nice and are monospace. You can mix and match characters from different fonts by using something like font forge. The problem is that libtsm lets you render one cell at a time only and you can't render into the space of different cells.
It's not inherently difficult to support these, it's just a different way to render them. st probably just renders the whole glyph and then moves a character width forward, nothing special needed, it might even be supported by accident. It's probably possible to modify libtsm to do this but it would be a bit hacky. |
Ah, thanks. Interesting, that the other font I tried did not properly show them (Inconsolata).
Better not then I guess, since libtsm was not designed for it. Folks should probably use foot terminal, if they want these fancy features. |
Fonts like Nerd Fonts use double-width symbols to allow using icons in shell prompts and tmux statuslines. Currently, double-width characters are cut-off at half their width.
The text was updated successfully, but these errors were encountered: