hismailbulut / Neoray

Simple and lightweight GUI client for Neovim
MIT License
146 stars 5 forks source link

Font render failure. #19

Open ray-x opened 3 years ago

ray-x commented 3 years ago

Please complete the following information:

Describe the bug Some font failed to render

Steps to reproduce Can not render emoji Also some font failed to render:

image Left: in kitty, same font Right: neoray

Your neoray config in init.vim (Only the part that concerns neoray!)

vim.api.nvim_set_option('guifont', 'Victor Mono:h14')

Crash log if available (may be generated by neoray after crash)

Debug output (you can generate starting neoray with --verbose option) [DEBUG] [NVIM] Neovim started with command: nvim --embed [TRACE] [NVIM] Neovim version 0.6.0 [DEBUG] [NVIM] Attached to neovim as an ui client. [TRACE] [NEORAY] Glfw version: 3.3.4 Cocoa NSGL EGL OSMesa [DEBUG] [NEORAY] Monitor count: 1 Selected monitor: Built-in Retina Display [DEBUG] [NEORAY] Video mode &{Width:1792 Height:1120 RedBits:8 GreenBits:8 BlueBits:8 RefreshRate:60} [DEBUG] [NEORAY] Glfw window created with size 800 600 [DEBUG] [NEORAY] Monitor diagonal: 15.95 pdpi: 264.98 ldpi: 144.00 [DEBUG] [NEORAY] Using logical dpi. [DEBUG] [NEORAY] Input callbacks are initialized. [DEBUG] [RENDERER] Initializing opengl. [TRACE] [RENDERER] Opengl Version: 4.1 ATI-3.10.22 [DEBUG] [RENDERER] Vendor: ATI Technologies Inc. [DEBUG] [RENDERER] Renderer: AMD Radeon Pro 5300M OpenGL Engine [DEBUG] [RENDERER] GLSL: 4.10 [DEBUG] [NEORAY] Loading default font. [DEBUG] [NEORAY] Default font loaded. [DEBUG] [NEORAY] Requesting deprecated options. [DEBUG] [NEORAY] Checking user options. [DEBUG] [NVIM] Option CursorAnimTime is 0.04 [DEBUG] [NVIM] Option Transparency is 0.95 [DEBUG] [NVIM] Option TargetTPS is 120 [DEBUG] [NVIM] Option ContextMenuOn is true [DEBUG] [NVIM] Option WindowSize is 120 40 [DEBUG] [NEORAY] Loading font Victor Mono with size 14 [TRACE] [NEORAY] Regular: Victor Mono Regular Nerd Font Complete.ttf [TRACE] [NEORAY] Bold Italic: Victor Mono Bold Italic Nerd Font Complete.ttf [TRACE] [NEORAY] Italic: Victor Mono Italic Nerd Font Complete.ttf [TRACE] [NEORAY] Bold: Victor Mono Bold Nerd Font Complete.ttf

hismailbulut commented 3 years ago

Currently neoray doesn't have an ability for rendering emojis, sorry for that. It seems like your font does not have this glyph and kitty uses some sort of another symbol font. Neoray currently can only render glyphs if it is in the specified user font or in default font.

ray-x commented 3 years ago

Yes. I am using nvim-web-devicons plugin. So some of the fonts are from devicons but not in nerd fonts. Also noticed that the ligature is not working.

reykjalin commented 3 years ago

I have the same issue despite registering the Nerd Font:

[TRACE] [NEORAY] Regular: Fira Code Retina Nerd Font Complete.otf
[WARNING] [NEORAY] Font has no bold italic face.
[WARNING] [NEORAY] Font has no italic face.
[WARNING] [NEORAY] Font has no bold face.
image

Here's the same part in my terminal using the same font:

image

Oddly enough, many other icons work in Neoray, so maybe it's just the arrow symbol that happens to be missing 🤔


However, what matters more to me is that ligatures aren't supported:

image

Do you know if this is a limitation of the font rendering library that's being used?

ray-x commented 3 years ago

I solve this by using a manually patched nerdfont. But it took lots of efforts. Would be great neoray can load the graph vector from a built-in default font.

hismailbulut commented 3 years ago

@ray-x @reykjalin Currently neoray using x/image/opentype font library which is a new library and maintained by only one person (I think). It's a complete opentype parser and uses x/image/vector for rasterizing fonts. Both libraries are almost complete, well written in pure go by google devs. This is the reason why I choosed them. But vector library is not drawing well in low dpi lcd monitors like cleartype or freetype and opentype parser library doesn't supports ligatures and emojis. Adding this features requires hard work but I believe golang devs will add them if we open an issue and when they have some free time. But this is not something I can do.

And one simplest solution for missing glyphs is find the actual fonts where these glyphs are coming from and then I can pack them with default font.

Other solution is we can add a new option for letting users to give some alternative font names to neoray and then neoray can use them in order for missing glyphs.

The last solution is like second, but instead asking to user, we will define some default symbol fonts per platform and use it if they available. These font's are not guaranteed to be in the user's system especially for linux.

The last two solutions disadvantage is neoray will load the fonts even when they don't need to be used and will increase memory consumption. Also I haven't got some free time for doing these soon.

reykjalin commented 3 years ago

Personally I think it's fine to wait for the libraries to add support for these icons/ligatures — no rush from my end. Thank you for the work on neoray, it's great!