Skip to content

Incorrect font size of scaled fonts inside code block #925

@bernardjoseph

Description

@bernardjoseph

When using a scaled face for code, the font size inside code blocks is not correct.

Expected Behavior

The font size inside the code block should be the font size of the markdown-code-face face.

Actual Behavior

I use the fixed-pitch-serif face inside code blocks. The face is enlarged by the :height property, because otherwise the Courier font is too small comparing to the default font.

(custom-set-faces '(fixed-pitch-serif ((t (:height 1.1 :family "Courier"))))
                  '(markdown-code-face ((t (:inherit fixed-pitch-serif)))))
(setq markdown-fontify-code-blocks-natively nil)

Now the font size inside the code block is too big. I think the reason is inside the function markdown-fontify-code-blocks-generic. Both text properties (face markdown-pre-face) and (face markdown-code-face) are added to the code region, and both inherit the properties of the fixed-pitch-serif face. That seems to have the effect, that :height 1.1 is applied twice.

Steps to Reproduce

Put the text of the »Actual Behavor« section inside a Markdown file and apply the Emacs settings of the emacs-lisp code block of that section. Then the font size inside emacs-lisp block is too big.

Software Versions

  • Markdown Mode: 2.8-alpha
  • Emacs: 30.1
  • OS: Debian GNU/Linus 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions