protesilaos / modus-themes

Highly accessible themes for GNU Emacs, conforming with the highest standard for colour contrast between background and foreground values (WCAG AAA).
https://protesilaos.com/emacs/modus-themes
GNU General Public License v3.0
553 stars 30 forks source link

fixed sized elements in org when zooming text #75

Closed JonatanSahar closed 1 year ago

JonatanSahar commented 1 year ago

Hi! I get a strange behavior in org-mode buffers which only happens with modus themes: wehn I enarge the text, or headings and some keywords and text remain in a fixed size. for example: image

when I comment out the modus-heading variable, the problem with the headings goes away, but the keywords remain.

This is the relevant configuration:

(require-theme 'modus-themes)

;; Maybe define some palette overrides, such as by using our presets (setq modus-themes-common-palette-overrides `( ;; From the section "Make the mode line borderless" (border-mode-line-active unspecified) (border-mode-line-inactive unspecified)

    ;; From the section "Make matching parenthesis more or less intense"
    (bg-paren-match bg-magenta-intense)
    (underline-paren-match fg-main)

    ;; And expand the preset here.  Note that the ,@ works because
    ;; we use the backtick for this list, instead of a straight
    ;; quote.
    ,@modus-themes-preset-overrides-intense))

(setq modus-themes-common-palette-overrides modus-themes-preset-overrides-intense)

;; Add all your customizations prior to loading the themes. (setq modus-themes-italic-constructs t modus-themes-bold-constructs nil modus-themes-mixed-fonts t modus-themes-variable-pitch-ui nil modus-themes-custom-auto-reload t modus-themes-disable-other-themes t

  ;; Options for `modus-themes-prompts' are either nil (the
  ;; default), or a list of properties that may include any of those
  ;; symbols: `italic', `WEIGHT'
  modus-themes-prompts '(italic) ;; bold)

  ;; The `modus-themes-completions' is an alist that reads two
  ;; keys: `matches', `selection'.  Each accepts a nil value (or
  ;; empty list) or a list of properties that can include any of
  ;; the following (for WEIGHT read further below):
  ;;
  ;; `matches'   :: `underline', `italic', `WEIGHT'
  ;; `selection' :: `underline', `italic', `WEIGHT'
  modus-themes-completions
  '((matches . (extrabold))
    (selection . (semibold italic text-also)))

  modus-themes-org-blocks 'gray-background ; {nil,'gray-background,'tinted-background}

  ;; The `modus-themes-headings' is an alist: read the manual's
  ;; node about it or its doc string.  Basically, it supports
  ;; per-level configurations for the optional use of
  ;; `variable-pitch' typography, a height value as a multiple of
  ;; the base font size (e.g. 1.5), and a `WEIGHT'.

  ;; modus-themes-headings
  ;; '((0 . (variable-pitch light 1.05))
  ;;   (1 . (variable-pitch light 1.05))
  ;;   (2 . (variable-pitch regular 1.05))
  ;;   (3 . (variable-pitch regular 1.05))
  ;;   (4 . (variable-pitch regular 1.05))
  ;;   (5 . (variable-pitch 1.05)) ; absence of weight means `bold'
  ;;   (6 . (variable-pitch 1.05))
  ;;   (7 . (variable-pitch 1.05))
  ;;   (t . (variable-pitch 1.05))
  ;;   (agenda-date . (1.1))
  ;;   (agenda-structure . (variable-pitch light 1.1)))
  )

;; Optionally define a key to switch between Modus themes. Also check ;; the user option `modus-themes-to-toggle'. (define-key global-map (kbd "") #'modus-themes-toggle) (setq modus-themes-to-toggle '(modus-operandi-tinted modus-vivendi-tinted))

;; Load the theme of your choice. (load-theme 'modus-operandi-tinted :no-confirm)

protesilaos commented 1 year ago

Hello @JonatanSahar!

Please move the cursor over those fixed-size elements and do M-x describe-char. That will produce a Help buffer. Towards the bottom, it mentions the face that is used. Click on that link to show its details.

Can you then include here the contents of those Help buffers?

JonatanSahar commented 1 year ago

sure, for the keywords I get:

Face: org-document-info-keyword (sample) (customize this face)

Documentation: Face for document information keywords. This face applies to the #+TITLE:, #+SUBTITLE:, #+AUTHOR:,

+EMAIL: and #+DATE: keywords.

Defined in ‘org-faces.el’.

       Family: unspecified
      Foundry: unspecified
        Width: unspecified
       Height: unspecified
       Weight: unspecified
        Slant: unspecified
   Foreground: #005077

DistantForeground: unspecified Background: unspecified Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Extend: unspecified Inherit: unspecified

[back]

while for those that are not fixed, I get:

Face: org-meta-line (sample) (customize this face)

Documentation: Face for meta lines starting with "#+".

Defined in ‘org-faces.el’.

       Family: unspecified
      Foundry: unspecified
        Width: unspecified
       Height: unspecified
       Weight: unspecified
        Slant: unspecified
   Foreground: #005077

DistantForeground: unspecified Background: unspecified Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Extend: unspecified Inherit: modus-themes-fixed-pitch

This face was introduced, or its default value was changed, in version 22.1 of Emacs.

[back]

So they are different faces indeed.

For the headings, when they behave well, I get:

Face: org-level-1 (sample) (customize this face)

Documentation: Face used for level 1 headlines.

Defined in ‘org-faces.el’.

       Family: unspecified
      Foundry: unspecified
        Width: unspecified
       Height: unspecified
       Weight: unspecified
        Slant: unspecified
   Foreground: unspecified

DistantForeground: unspecified Background: unspecified Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Extend: t Inherit: modus-themes-heading-1

[back]

and when I set the modus variable, and the headings become fixed sizes, I get... the same:

Face: org-level-1 (sample) (customize this face)

Documentation: Face used for level 1 headlines.

Defined in ‘org-faces.el’.

       Family: unspecified
      Foundry: unspecified
        Width: unspecified
       Height: unspecified
       Weight: unspecified
        Slant: unspecified
   Foreground: unspecified

DistantForeground: unspecified Background: unspecified Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Extend: unspecified Inherit: modus-themes-heading-1

[back]

JonatanSahar commented 1 year ago

there's also an overlay for the headings, which is also the same between the two conditions:

Face: hl-line (sample) (customize this face)

Documentation: Default face for highlighting the current line in Hl-Line mode.

Defined in ‘hl-line.el’.

       Family: unspecified
      Foundry: unspecified
        Width: unspecified
       Height: unspecified
       Weight: unspecified
        Slant: unspecified
   Foreground: unspecified

DistantForeground: unspecified Background: #bfefff Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: unspecified Fontset: unspecified Extend: t Inherit: unspecified

This face was introduced, or its default value was changed, in version 22.1 of Emacs.

[back]

protesilaos commented 1 year ago

Thanks! Also do M-x describe-face and check fixed-pitch. I suspect it has an absolute height value instead of something like 1.0.

JonatanSahar commented 1 year ago

it does! it's 180:

Face: fixed-pitch (sample) (customize this face)

Documentation: The basic fixed-pitch face.

Defined in ‘faces.el’.

       Family: Iosevka Comfy
      Foundry: outline
        Width: normal
       Height: 181
       Weight: normal
        Slant: normal
   Foreground: unspecified

DistantForeground: unspecified Background: unspecified Underline: unspecified Overline: unspecified Strike-through: unspecified Box: unspecified Inverse: unspecified Stipple: unspecified Font: #<font-object -outline-Iosevka Comfy-normal-normal-normal-mono-24----c--iso8859-1> Fontset: unspecified Extend: unspecified Inherit: unspecified

protesilaos commented 1 year ago

Okay. Do something like this, while tinkering with the floating point:

(set-face-attribute 'fixed-pitch nil :height 1.15)

Mine is 1.0

JonatanSahar commented 1 year ago

that works great for the keywords, but not for headings, and also not for the title text. Also, if I reload the theme I need to reapply that change to fixed-pitch.

protesilaos commented 1 year ago

Can you show me how you define your fonts originally? In general, anything with an absolute :height value will retain that value. Only the default face must have an absolute :height. Everything else should be a floating point, which is a multiple of the default font :height.