Closed lamyergeier closed 2 months ago
This article might be helpful to you https://github.com/AvaloniaUI/Avalonia/wiki/Configuring-X11-per-monitor-DPI.
This app actually has fully DPI awareness on Windows and macOS. On Linux, since there's so many desktop environments, it may not work by default. Currently, the AvaloniaUI
(which UI framework used by this app) will try to read some global environment variables to do this job. The source code is:
static IScalingProvider GetScalingProvider(AvaloniaX11Platform platform)
{
var envSets = new[]
{
("AVALONIA_GLOBAL_SCALE_FACTOR", "AVALONIA_SCREEN_SCALE_FACTORS", new[] { "AVALONIA_USE_PHYSICAL_DPI" })
}.ToList();
if (Environment.GetEnvironmentVariable("AVALONIA_SCREEN_SCALE_IGNORE_QT") != "1")
{
envSets.Add(("QT_SCALE_FACTOR", "QT_SCREEN_SCALE_FACTORS",
new[] { "QT_AUTO_SCREEN_SCALE_FACTOR", "QT_USE_PHYSICAL_DPI" }));
}
UserScalingConfiguration? config = null;
double global = 1;
bool forceAuto = false;
foreach (var envSet in envSets)
{
var envConfig = TryGetEnvConfiguration(envSet.Item1, envSet.Item2, envSet.Item3);
if (envConfig != null)
{
(config, global, forceAuto) = envConfig.Value;
break;
}
}
IScalingProvider provider;
if (config != null)
provider = new UserConfiguredScalingProvider(config.NamedConfig, config.IndexedConfig);
else if (forceAuto)
provider = new PhysicalDpiScalingProvider();
else
provider = new XrdbScalingProvider(platform);
// ReSharper disable once CompareOfFloatsByEqualityOperator
if (global != 1)
provider = new PostMultiplyScalingProvider(provider, global);
return provider;
}
@love-linger Thanks, but I don't use X11 as most modern Linux desktops are now using Wayland.
May I suggest that you could provide users to be able to define line height factor as a multiple of Font size (as shown in the above image). And this line height factor can be defined in the software for all row height (also applicable to above image). Users could a choose a value from 1 to 2.5 in steps of 0.25 to have tight spacing or more spacing between lines.
https://github.com/AvaloniaUI/Avalonia/wiki/Configuring-X11-per-monitor-DPI this also works on Wayland since there are many of X11 software runs on XWayland
close due to no more feedback
@love-linger
a side note: Any plans to migrate to Wayland?
a side note: Any plans to migrate to Wayland?
It depends on AvaloniaUI
project.
Date=$(date +%Y-%m-%d)
so users can specify+%Y-%m-%d
)Spacing can be adjusted as per font size so that it doesn't look cluttered on High-DPI screen
On my High resolution screen I would like to use Font size 28 to avoid straining my eyes (please adjust row height (multiple of font size, like 1.5 times or 2 times) and column width (fits column headers and still have some spacing from the edge, Left tab column width) for adequate spacing):