danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.22k stars 159 forks source link

mangohud: invalid `font_file` declaration #308

Open trueNAHO opened 8 months ago

trueNAHO commented 8 months ago

About

This tracking issue manages the font_file hotfix, resolving:

Steps

  1. [x] https://github.com/danth/stylix/pull/307
  2. [ ] mangohud: declare 'font_file'
trueNAHO commented 6 months ago

cc: @NovaViper

MangoHud appears really small on my monitor

image

-- https://github.com/danth/stylix/pull/307#issuecomment-2024349791

Is this not caused by the

https://github.com/danth/stylix/blob/b5f4ca49df372c3d26ce04b1554fb02a0107cc8d/modules/mangohud/hm.nix#L12-L13

options rather than the removed font_file option 1?

In that case, considering MangoHud's special gaming use case, we could simply add a scaling factor option to the stylix.targets.mangohud option attribute set, or add a more reusable target option to the stylix.fonts.sizes option attribute set. I would prefer adding a stylix.fonts.sizes option.

NovaViper commented 6 months ago

@trueNAHO Hey sorry for the delay! The small text seems to be caused by the font_size and font_size_text options, as even though the font_file option is gone, the it's still extremely small. 🤔 In fact i found that the default MangoHud settings has both of those options set to 24 rather than 10 (which is what the font.sizes.applications value is).

Edit: Can definitely confirm it is those two settings! I forced them both to be 24 and the GUI is large again! When font_size and font_size_text are set to 10 (what stylix is using) image

When font_size and font_size_text are set to 24 image

danth commented 6 months ago

What unit are font_size and font_size_text measured in?

The Stylix options are in points (1 point = 1â…“ pixels).

RANKSHANK commented 6 months ago

What unit are font_size and font_size_text measured in?

The Stylix options are in points (1 point = 1â…“ pixels).

It uses ImGUI under the hood so it should be pixels. This line sets the font scaling accordingly with a factor of 1â…“

I took some screenshots and measured the glyph sizes, and it looks like both the size and scaling need to have the 1â…“ factor applied for the glyph size in pixels to be correct. Not sure why the pt->px scaling needs to be applied twice

It should also be noted that the sizing measurements also included the drop shadow to reach the correct glyph size, which is 1px thick at 10pt and 2px thick at 16pt. I'd almost want to bump the scaling up a touch so that the font size corresponds to the non decorative component of the text.