Inlyne-Project / inlyne

Introducing Inlyne, a GPU powered yet browserless tool to help you quickly view markdown files in the blink of an eye.
MIT License
1.09k stars 27 forks source link

Bug: Droid Sans font can render incorrectly #79

Closed coastalwhite closed 1 year ago

coastalwhite commented 1 year ago

Running inlyne README.md without any additional specification does not properly load a font. I am going to guess this is a bug in an upstream dependency, but it might be valuable to track that here as well.

Screenshot

image

No errors are shown and the default configuration is used.

coastalwhite commented 1 year ago

Just for some added context. It is loading the system fonts in the fonts::select_best_font function.

trimental commented 1 year ago

Hmm that's unfortunate, font loading is definitely one of those things where "it works on my machine" I'll try to look into this.

CosmicHorrorDev commented 1 year ago

@coastalwhite We cache the selection, so you can find out what it's trying to load by looking at in your cache home (~/.cache/inlyne/font_regular.toml). I have my font set to Fira Sans, so I get this

name = "Fira Sans"

[base]
path = "/usr/share/fonts/TTF/FiraSans-Regular.ttf"
binary = false
font_index = 0

[italic]
path = "/usr/share/fonts/TTF/FiraSans-Italic.ttf"
binary = false
font_index = 0

[bold]
path = "/usr/share/fonts/TTF/FiraSans-Bold.ttf"
binary = false
font_index = 0

[bold_italic]
path = "/usr/share/fonts/TTF/FiraSans-BoldItalic.ttf"
binary = false
font_index = 0

Could see if it's picking up a weird font on your system for some reason

coastalwhite commented 1 year ago

I did manage to resolve the problem by using a different font. I was using Droid Sans and Droid Mono before. These did not work. Switching to Arial and Jetbrains Mono solved the problem. I am guessing there is some issue in glyph_brush with this font.

coastalwhite commented 1 year ago

It does not create a .cache file for me, btw @CosmicHorrorDev. I looked through the code and saw that it does not set these sometimes. I guess my system was that one.

CosmicHorrorDev commented 1 year ago

Huh, I can also reproduce this issue with Droid Sans. It seems to only be the base font and italics that have issues which is selecting a different font file for me than bold and bold+italics

name = "Droid Sans"

[base]
path = "/usr/share/fonts/droid/DroidSansGeorgian.ttf"
binary = false
font_index = 0

[italic]
path = "/usr/share/fonts/droid/DroidSansGeorgian.ttf"
binary = false
font_index = 0

[bold]
path = "/usr/share/fonts/droid/DroidSans-Bold.ttf"
binary = false
font_index = 0

[bold_italic]
path = "/usr/share/fonts/droid/DroidSans-Bold.ttf"
binary = false
font_index = 0
thawkins commented 1 year ago

I have a simular issue, Fedora 38, cloned inlyne repo, did "cargo install inlyne" with no issues. however when I tried to run it against the inlyne README.md file

i get this, Output window is never shown:

[thawkins@fedora inlyne]$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/thawkins/.rustup

stable-x86_64-unknown-linux-gnu (default)
rustc 1.69.0 (84c898d65 2023-04-16)

[thawkins@fedora inlyne]$ neofetch --stdout
thawkins@fedora 
--------------- 
OS: Fedora release 38 (Thirty Eight) x86_64 
Host: Acer Swift SF314-512 V1.09 
Kernel: 6.2.14-300.fc38.x86_64 
Uptime: 15 mins 
Packages: 4893 (rpm) 
Shell: bash 5.2.15 
Resolution: 2560x1440 
DE: GNOME 44.1 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita-dark [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: gnome-terminal 
CPU: 12th Gen Intel i5-1240P (16) @ 1.700GHz 
GPU: Intel Alder Lake-P 
Memory: 5136MiB / 7629MiB 

[thawkins@fedora inlyne]$ 
[thawkins@fedora inlyne]$ ls
Cargo.lock  Cargo.toml  ci  example.png  inlyne.toml.sample  LICENSE  README.md  src  target  tests
[thawkins@fedora inlyne]$ inlyne ./README.md
warning: queue 0x556e08c097f0 destroyed while proxies still attached:
  wl_display@1 still attached
warning: queue 0x556e08c3cff0 destroyed while proxies still attached:
  zwp_linux_dmabuf_feedback_v1@56 still attached
warning: queue 0x556e08bf3300 destroyed while proxies still attached:
  wl_display@1 still attached
warning: queue 0x556e08ad5d20 destroyed while proxies still attached:
  wl_buffer@41 still attached
  wl_buffer@40 still attached
  wl_buffer@38 still attached
  wl_buffer@39 still attached
  wl_subsurface@33 still attached
  wl_surface@32 still attached
  wl_subsurface@31 still attached
  wl_surface@30 still attached
  wl_subsurface@29 still attached
  wl_surface@28 still attached
  wl_subsurface@27 still attached
  wl_surface@26 still attached
  wl_subsurface@25 still attached
  wl_surface@24 still attached
  xdg_wm_base@22 still attached
  xdg_activation_v1@14 still attached
  zwp_text_input_manager_v3@13 still attached
  zwp_pointer_constraints_v1@12 still attached
  zwp_relative_pointer_manager_v1@11 still attached
  wl_seat@10 still attached
  wp_fractional_scale_manager_v1@9 still attached
  wp_viewporter@8 still attached
  wl_subcompositor@7 still attached
  wl_output@6 still attached
  wl_shm@5 still attached
  wl_compositor@4 still attached
  wl_registry@2 still attached
Error: InvalidFont
[thawkins@fedora inlyne]$ 
thawkins commented 1 year ago

If I switch from Wayland to Xorg, I get the same thing but less noise.

[thawkins@fedora inlyne]$ inlyne ./README.md
Error: InvalidFont

It may be worth displaying which font it belives is Invalid.

Note: the ~/.cache/inlyne folder does not exist.