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

Floating-point font size interpreted incorrectly on macOS #14028

Open
bcc32 opened this issue Oct 10, 2020 · 12 comments
Open

Floating-point font size interpreted incorrectly on macOS #14028

bcc32 opened this issue Oct 10, 2020 · 12 comments

Comments

@bcc32
Copy link
Contributor

bcc32 commented Oct 10, 2020

Description :octocat:

Floating-point font sizes, according to the help text for font-spec, specify the size of the font in points, unlike integers, which specify them in pixels. E.g., 13 pixels should be equivalent to 10.0 points.

The default font size in Spacemacs, 10.0, was set by #12515 to a floating-point value. But, it gets interpreted as a pixel size rather than a point size on macOS.

Reproduction guide 🪲

Set dotspacemacs-default-font:

   dotspacemacs-default-font `("Anonymous Pro"
                               :size 10.0
                               :weight normal
                               :width normal)
  • Start Emacs

Observed behaviour: 👀 💔
The font is tiny. I measure the distance between the bottom of two consecutive lines of xxx to be 0.075 inch apart on my screen.

Expected behaviour: ❤️ 😄
The font should be bigger! With the font size set to 13 (as an integer, which is supposedly equivalent to 10.0 as a floating-point value), I measure the distance between the bottom of two consecutive lines of xxx to be 0.10 inch on my screen.

System Info 💻

  • OS: darwin
  • Emacs: 27.1
  • Spacemacs: 0.300.0
  • Spacemacs branch: wip-ocamlformat-in-ocaml-layer (rev. 0c6f7fe)
  • Graphic display: t
  • Distribution: spacemacs-base
  • Editing style: hybrid
  • Completion: ivy
  • Layers:
(spell-checking
 (syntax-checking :variables syntax-checking-use-original-bitmaps t)
 (auto-completion :variables auto-completion-idle-delay 1.0)
 (ivy :variables ivy-enable-advanced-buffer-information t)
 helpful ibuffer
 (org :variables org-projectile-file "TODO.org" org-want-todo-bindings t)
 (unicode-fonts :variables unicode-fonts-enable-ligatures t unicode-fonts-ligature-modes
                '(prog-mode))
 autohotkey c-c++ csv nil emacs-lisp nil nil html
 (javascript :variables javascript-fmt-tool 'prettier javascript-fmt-on-save t)
 json markdown
 (ocaml :variables ocaml-format-before-save t)
 perl5 python ruby rust scheme shell-scripts sql
 (typescript :variables typescript-fmt-tool 'prettier typescript-fmt-on-save t)
 yaml nixos osx git
 (version-control :variables version-control-diff-tool nil)
 spacemacs-completion spacemacs-layouts spacemacs-editing spacemacs-editing-visual spacemacs-evil spacemacs-language spacemacs-misc spacemacs-modeline spacemacs-navigation spacemacs-org spacemacs-project spacemacs-purpose spacemacs-visual command-log fasd finance
 (shell :variables shell-enable-smart-eshell t)
 spotify bcc32-org)
  • System configuration features: NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER
@duianto
Copy link
Collaborator

duianto commented Oct 10, 2020

It might be helpful to include some screenshots.
Then someone else with a mac can confirm if they are seeing the same thing.

@bcc32
Copy link
Contributor Author

bcc32 commented Oct 10, 2020

Ah, indeed. Here's some screenshots taken at full screen (2560 x 1600 on my MacBook Air)

Font size 10.0:
Screen Shot 2020-10-10 at 01 28 33

Font size 13:
Screen Shot 2020-10-10 at 01 28 53

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Oct 10, 2021
@lebensterben
Copy link
Collaborator

With the font size set to 13 (as an integer, which is supposedly equivalent to 10.0 as a floating-point value)

@bcc32

Nope. macbook pro is likely to have DPI 225
So 10 * 225 / 72 = 31.25

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label Oct 15, 2021
@bcc32
Copy link
Contributor Author

bcc32 commented Nov 8, 2021

With the font size set to 13 (as an integer, which is supposedly equivalent to 10.0 as a floating-point value)

@bcc32

Nope. macbook pro is likely to have DPI 225 So 10 * 225 / 72 = 31.25

Those numbers were based on a previous MacBook Air which I don't have access to anymore, so I wouldn't be able to check. I'd believe you that the numbers might be different, but in any case, once set to a floating-point size, it should render as the same physical size on the screen regardless of device, according to the documentation.

@lebensterben
Copy link
Collaborator

according to xft specification you can optionally specify dpi.
so point size + manually specified dpi should give you best result

@bcc32
Copy link
Contributor Author

bcc32 commented Nov 9, 2021

Specifying dpi in the font name, or some other config var? That seems unfortunate, because it wouldn't be reusable across machines. Ideally, we'd be able to detect the appropriate DPI and interpret the point size accordingly, but maybe that is not possible.

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Nov 9, 2022
@bcc32
Copy link
Contributor Author

bcc32 commented Nov 13, 2022

This is still an issue. The same floating-point font size (10.5) renders as significantly different physical sizes on macOS vs. other platforms.

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label Nov 13, 2022
@rinconjc
Copy link
Contributor

It seems the font size is ignored 🤔
image

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Oct 24, 2024
@bcc32
Copy link
Contributor Author

bcc32 commented Oct 24, 2024

This issue is still valid. It should not be closed.

@github-actions github-actions bot removed the stale marked as a stale issue/pr (usually by a bot) label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants