bug#42109: 27.0.91; Cannot use italics with some fonts

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

bug#42109: 27.0.91; Cannot use italics with some fonts



I can't figure out how to get some fonts to show up with an italic face,
while others work without a problem. I'm comparing DejaVu Sans Mono and
JetBrains Mono, both of which are ttf with an italic face having the
same dimensions the roman face. All of this happens in emacs -Q and
isn't related to a theme.

;; 1. Works, italic and roman everywhere as expected
(set-frame-font "DejaVu Sans Mono-16")

;; 2. Works, italic everywhere and faces that explicitly set
;; :slant 'normal will use the roman variant of the same font
(set-frame-font "JetBrains Mono-16:slant=italic")

;; 3. Does not work, all text is rendered roman. In 1 this works with a
;; different font. From result of 2, there exists an italic face for
;; this font which works with the roman face
(set-frame-font "JetBrains Mono-16")

;; 4. Does not work, all text is rendered roman, same as 3. Both fonts
;; have same dimensions per 'describe-font, verified in 2 and 3
(set-frame-font "JetBrains Mono-16")
(set-face-font 'italic "JetBrains Mono-16:slant=italic")

;; 5. Partly works, will show italics in some buffers which seem to
;; support different fonts together (org-mode, helm-mini) but not others
;; (emacs-lisp-mode with font-lock-comment-face customized to :slant
;; 'italic, still shown in JetBrains Mono roman). Similar to 4 but with
;; a different font for italic. Sizes between these two fonts aren't
;; equal though, char heights are different but I've read something
;; about that being an issue in emacs.
(set-frame-font "JetBrains Mono-16")
(set-face-font 'italic "DejaVu Sans Mono-16")

;; 6. Same results as 5, although using fonts that are equal in char
;; dimensions (height, ascent, width), but techincally different 'size'
;; (21 for JetBrains, 22 for DejaVu)
(set-frame-font "JetBrains Mono-16")
(set-face-font 'italic
  "-PfEd-DejaVu Sans Mono-normal-oblique-normal-*-22-*-*-*-m-0-iso10646-1")

;; 7. Size isn't consistent for roman/italic at different sizes, seen by
;; evaluating each statement separately to switch between italic and
;; roman faces. eg, at -16 the characters are the same size, but -14 has
;; slightly larger italic (width 11 vs 12, same other dimensions). This
;; isn't true in other programs, eg LibreOffice or font-manager.
(set-frame-font "JetBrains Mono-16")
(set-frame-font "JetBrains Mono-16:slant=italic")
(set-frame-font "JetBrains Mono-14")
(set-frame-font "JetBrains Mono-14:slant=italic")

Some other things I've tried:
- Different font sizes
- Explicitly set char dimensions with the expanded style, eg:
"-JB  -JetBrains Mono-normal-*-*-*-21-13-27-*-m-0-iso10646-1"
- Convert JetBrains Mono to otf (from woff), remove the ttf version and
rebuild font cache
- Same issues in GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+
Version 3.24.11) of 2019-09-23, modified by Debian built on
- Same issues when using recommended font setting via

Any ideas what else I might try here? Thanks!


In GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.18)
 of 2020-06-27 built on difference-engine
Repository revision: 0121db27021ce77350999b108b4e5aed21d73064
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 20.04 LTS

Recent messages:
Making completion list...

Configured features:

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

(misearch multi-isearch pp shadow sort mail-extr emacsbug sendmail
eieio-opt cl-extra speedbar sb-image ezimage dframe help-fns radix-tree
help-mode apropos vc-git diff-mode cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs org-element
avl-tree generator ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnir
gnus-sum url url-proxy url-privacy url-expand url-methods url-history
mailcap shr url-cookie url-domsuf url-util url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs json map url-vars svg xml dom
browse-url gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec password-cache epa
derived epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search seq
byte-opt gv bytecomp byte-compile cconv mail-utils mm-util mail-prsvr
ol-docview doc-view jka-compr image-mode exif dired dired-loaddefs
ol-bibtex bibtex ol-bbdb ol-w3m org ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete
comint ansi-color ring org-list org-faces org-entities time-date subr-x
noutline outline easy-mmode org-version ob-emacs-lisp ob-core ob-eval
org-table ol org-keys org-compat advice org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs kmacro crm
thingatpt cus-edit easymenu cus-start cus-load wid-edit cl-loaddefs
cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 206117 26336)
 (symbols 48 22389 3)
 (strings 32 70493 2946)
 (string-bytes 1 2441537)
 (vectors 16 37519)
 (vector-slots 8 792526 127340)
 (floats 8 223 497)
 (intervals 56 1297 16)
 (buffers 1000 23))

Reply | Threaded
Open this post in threaded view

bug#42109: 27.0.91; Cannot use italics with some fonts

A small update, I've re-built with cairo support and #7 no
longer happens:

> 7. Size isn't consistent for roman/italic at different sizes