doc: expand description of font units (#819)

Link: https://github.com/danth/stylix/pull/819

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
Daniel Thwaites 2025-02-03 19:34:17 +00:00 committed by GitHub
parent 596d664407
commit bae5cbb8fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,41 +61,55 @@ in
};
};
sizes = {
desktop = lib.mkOption {
description = ''
The font size (in pt) used in window titles/bars/widgets elements of
the desktop.
'';
type = with lib.types; (either ints.unsigned float);
default = 10;
};
sizes =
let
mkFontSizeOption =
{ default, target }:
lib.mkOption {
inherit default;
applications = lib.mkOption {
description = ''
The font size (in pt) used by applications.
'';
type = with lib.types; (either ints.unsigned float);
default = 12;
};
description = ''
The font size used for ${target}.
terminal = lib.mkOption {
description = ''
The font size (in pt) for terminals/text editors.
'';
type = with lib.types; (either ints.unsigned float);
default = cfg.sizes.applications;
};
This is measured in [points](https://en.wikipedia.org/wiki/Point_(typography)).
In a computing context, there should be 72 points per inch.
popups = lib.mkOption {
description = ''
The font size (in pt) for notifications/popups and in general overlay
elements of the desktop.
'';
type = with lib.types; (either ints.unsigned float);
default = cfg.sizes.desktop;
[The CSS specification](https://drafts.csswg.org/css-values/#absolute-lengths)
says there should be 96 reference pixels per inch. This means CSS
uses a fixed ratio of 3 points to every 4 pixels, which is
sometimes useful. However, reference pixels might not correspond
to physical pixels, so this conversion may be invalid for other
applications.
The measurements given in inches are likely to be incorrect
unless you've
[manually set your DPI](https://linuxreviews.org/HOWTO_set_DPI_in_Xorg).
'';
type = with lib.types; either ints.unsigned float;
};
in
{
desktop = mkFontSizeOption {
target = "window titles, status bars, and other general elements of the desktop";
default = 10;
};
applications = mkFontSizeOption {
target = "applications";
default = 12;
};
terminal = mkFontSizeOption {
target = "terminals and text editors";
default = cfg.sizes.applications;
};
popups = mkFontSizeOption {
target = "notifications, popups, and other overlay elements of the desktop";
default = cfg.sizes.desktop;
};
};
};
packages = lib.mkOption {
description = ''