alacritty / alacritty

A cross-platform, OpenGL terminal emulator.
https://alacritty.org
Apache License 2.0
56.1k stars 3.01k forks source link

font ignored on laptop screen #3319

Closed anntnzrb closed 4 years ago

anntnzrb commented 4 years ago

System

OS: Linux (Void) Version: alacritty 0.4.1 Linux: X11 ; xcompmgr as compositor & i3 as WM

Issue

my setup is a laptop and a monitor i use as my primary display (my laptop screen as extended secondary screen), i don't have any issues with my main monitor, the thing is that whenever i drag an alacritty window from the this external monitor to my laptop's screen, the font becomes huge.

at the beginning i thought this was cool as my laptop screen is 15' and (somehow thought) this was cleverly adjusted to compensate the dimensions difference... (allowed me to see better as the font was bigger on this smaller display). yesterday for the first time (with alacritty) i used my laptop without the monitor... and there was just no way to resize the font.

short words: the font is respected only when my main monitor is hooked, i tried deleting my .Xresources and .alacritty.yml config files without luck.

i'm attaching both configuration files mentioned above and also my $ xrandr output:

alacritty.yml .Xresources xrandr

kchibisov commented 4 years ago

This isn't a bitmap font, right? I'd assume Control + + and Control + - (font change won't working)? Also make sure you're actually using the right config with alacritty -v? I don't see anything wrong in ranr output tbh. Also, if your font is a bitmap one, there's a change you can't resize it.

anntnzrb commented 4 years ago

This isn't a bitmap font, right?

i wouldn't be able to tell, i'm attaching the output of $ fc-list | grep Overpass

/usr/share/fonts/OTF/overpass-bold-italic.otf: Overpass:style=Bold Italic
/usr/share/fonts/OTF/overpass-thin.otf: Overpass,Overpass Thin:style=Thin,Regular
/usr/share/fonts/OTF/overpass-extralight.otf: Overpass,Overpass ExtraLight:style=ExtraLight,Regular
/usr/share/fonts/OTF/overpass-heavy.otf: Overpass,Overpass Heavy:style=Heavy,Regular
/usr/share/fonts/OTF/overpass-regular.otf: Overpass:style=Regular
/usr/share/fonts/OTF/overpass-semibold-italic.otf: Overpass,Overpass SemiBold:style=SemiBold Italic,Italic
/usr/share/fonts/OTF/overpass-extralight-italic.otf: Overpass,Overpass ExtraLight:style=ExtraLight Italic,Italic
/usr/share/fonts/OTF/overpass-mono-bold.otf: Overpass Mono:style=Bold
/usr/share/fonts/OTF/overpass-bold.otf: Overpass:style=Bold
/usr/share/fonts/OTF/overpass-mono-light.otf: Overpass Mono,Overpass Mono Light:style=Light,Regular
/usr/share/fonts/OTF/overpass-heavy-italic.otf: Overpass,Overpass Heavy:style=Heavy Italic,Italic
/usr/share/fonts/OTF/overpass-mono-regular.otf: Overpass Mono:style=Regular
/usr/share/fonts/OTF/overpass-italic.otf: Overpass:style=Italic
/usr/share/fonts/OTF/overpass-light.otf: Overpass,Overpass Light:style=Light,Regular
/usr/share/fonts/OTF/overpass-semibold.otf: Overpass,Overpass Light:style=SemiBold,Bold
/usr/share/fonts/OTF/overpass-extrabold-italic.otf: Overpass,Overpass ExtraBold:style=ExtraBold Italic,Italic
/usr/share/fonts/OTF/overpass-extrabold.otf: Overpass,Overpass ExtraBold:style=ExtraBold,Regular
/usr/share/fonts/OTF/overpass-mono-semibold.otf: Overpass Mono,Overpass Mono Light:style=SemiBold,Bold
/usr/share/fonts/OTF/overpass-light-italic.otf: Overpass,Overpass Light:style=Light Italic,Italic
/usr/share/fonts/OTF/overpass-thin-italic.otf: Overpass,Overpass Thin:style=Thin Italic,Italic

I'd assume Control + + and Control + - (font change won't working)?

my keybindings are working fine, +, -, and 0 are doing their job but they're still bigger (still when i drag back to monitor gets "fixed") i'm also attaching two images... pic-selected-200210-2128-44 pic-selected-200210-2129-18

first picture is my external monitor and second one is on my laptop's screen (didn't resize or anything, literally just dragged the window)

Also make sure you're actually using the right config with alacritty -v?

$ alacritty -v

[2020-02-10 21:33] [INFO] Welcome to Alacritty
[2020-02-10 21:33] [INFO] Configuration loaded from "/home/dennisbergkamp/.config/alacritty/alacritty.yml"
[2020-02-10 21:33] [INFO] Device pixel ratio: 1
[2020-02-10 21:33] [INFO] Initializing glyph cache...
[2020-02-10 21:33] [INFO] ... finished initializing glyph cache in 0.008271586s
[2020-02-10 21:33] [INFO] Cell Size: 9 x 19
[2020-02-10 21:33] [INFO] Padding: 12 x 12
[2020-02-10 21:33] [INFO] Width: 699, Height: 366
[2020-02-10 21:33] [INFO] PTY Dimensions: Line(18) x Column(75)
[2020-02-10 21:33] [INFO] Initialisation complete
[2020-02-10 21:33] [INFO] Width: 616, Height: 347

edit: i just noticed that it's not actually a font issue (probably?) alacritty is resizing my terminal window when dragging between displays... (just tested with urxvt and it doesn't changed the dimensions)

$ xdotool getwindowfocus getwindowgeometry

monitor 1 (external monitor via HDMI):

Window 67108866
  Position: 1032,299 (screen: 0)
  Geometry: 616x347

monitor 2 (laptop):

Window 67108866
  Position: 2295,211 (screen: 0)
  Geometry: 924x521

for some reason (screen: 0) is being displayed on both displays...?

kchibisov commented 4 years ago

Could you try to launch alacritty with WINIT_HIDPI_FACTOR=1 alacritty ?

anntnzrb commented 4 years ago

Could you try to launch alacritty with WINIT_HIDPI_FACTOR=1 alacritty ?

just tried, works as it should be, no more resizing.

i also edited the post above in case you missed it, anyhow what you just posted seems to have worked, is it possible to set this as an option in the .yml file?

kchibisov commented 4 years ago

Alacritty is doing DPI adjustments by default, the result is that your font should have identical size in millimeters across your monitors, however some monitors could report odd values.

There are 2 options to avoid automatic DPI scaling based on randr metrics:

I've noticed that you have Xft.dpi in Xresources, but I feel like we're failing to pick up it, anyway, could you try to set it like Xft.dpi instead of Xft*dpi.

Note: most X11 doesn't do DPI scaling, so it's hard to use them with mixed DPI setups.

anntnzrb commented 4 years ago

There are 2 options to avoid automatic DPI scaling based on randr metrics:

  • Add this variable to a env section in alacritty.yml, so it should be WINIT_HIDPI_FACTOR: "1" in env section.

that did the trick. appreciate the support 🤝