Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: expand description of font units #819

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions stylix/fonts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ let
};
};

unitsDoc = ''
This is measured in [points](https://en.wikipedia.org/wiki/Point_(typography)).
In a computing context, there should be 72 points per inch.

[The CSS specification](https://drafts.csswg.org/css-values/#absolute-lengths)
says there should be 96 reference pixels per inch. These are not always
equal to one physical pixel, but it means CSS uses a fixed ratio of 3
points to every 4 pixels, which is sometimes useful.

Other programs might measure in physical pixels, which makes the previously
mentioned conversion invalid.

The measurements in inches are likely to be incorrect unless you've
[carefully configured your DPI](https://linuxreviews.org/HOWTO_set_DPI_in_Xorg).
'';

in
{
options.stylix.fonts = {
Expand Down Expand Up @@ -64,33 +80,41 @@ in
sizes = {
danth marked this conversation as resolved.
Show resolved Hide resolved
desktop = lib.mkOption {
description = ''
The font size (in pt) used in window titles/bars/widgets elements of
the desktop.
The font size used in window titles/bars/widgets elements of the
desktop.

${unitsDoc}
'';
type = with lib.types; (either ints.unsigned float);
default = 10;
};

applications = lib.mkOption {
description = ''
The font size (in pt) used by applications.
The font size used by applications.

${unitsDoc}
'';
type = with lib.types; (either ints.unsigned float);
default = 12;
};

terminal = lib.mkOption {
description = ''
The font size (in pt) for terminals/text editors.
The font size for terminals/text editors.

${unitsDoc}
'';
type = with lib.types; (either ints.unsigned float);
default = cfg.sizes.applications;
};

popups = lib.mkOption {
description = ''
The font size (in pt) for notifications/popups and in general overlay
The font size for notifications/popups and in general overlay
elements of the desktop.

${unitsDoc}
'';
type = with lib.types; (either ints.unsigned float);
default = cfg.sizes.desktop;
Expand Down