TLDR:
- Emacs gives primacy to the
font family
name. This is in spite of the fact that the Menu Bar -> Options -> Set Default Font
displays the Font Name
and NOT the Family Name
.
- None of the
Coelacanth
font files, defines slant property. So, it is not surprising that Emacs
doesn't honour the italic
property requested in slant
property.
I installed Coelacanth
font from http://benwhitmore.altervista.org/wp-content/uploads/2014/08/Coelacanth20140829.zip. See Coelacanth: a type family inspired by Bruce Rogers' Centaur.
I set the default font using Menu Bar -> Options -> Set Default Font
as below
The default font wasn't typeset in Italic.
To investigate this behaviour further, I eval
-led the following forms
(face-attribute 'default :font)
=>
#<font-object "-PfEd-Coelacanth-medium-normal-normal-*-15-*-*-*-*-0-iso10646-1">
(font-info (face-attribute 'default :font))
=>
["-PfEd-Coelacanth-medium-normal-normal-*-15-*-*-*-*-0-iso10646-1"
"Coelacanth:pixelsize=15:foundry=PfEd:weight=medium:slant=normal:width=normal:scalable=true"
15 20 0 0 0 17 14 6 3 7 "~/.local/share/fonts/Coelac_R14.otf"
(opentype
...)]
You can see that font file used is Coelac_R14.otf
, and the fontspec doesn't have any italic in it.
Then I did this
~$ echo "|%{fullname}| %{file} | %{foundry} | %{family}| %{slant}|\n"; fc-list -f "|%{fullname} |%{file} | %{foundry} | %{family}| %{slant}|\n" | grep 'Coela'
| %{fullname} | %{file} | %{foundry} | %{family} | %{slant} |
| Coelacanth_Regular 24op | Coelac_R24.otf | PfEd | Coelacanth | 0 |
| CoelacanthLight 14op | Coelac_L14.otf | PfEd | CoelacanthLight | 0 |
| CoelacanthSemibold 14op | Coelac_S14.otf | PfEd | CoelacanthSemibold | 0 |
| CoelacanthLight 4op | Coelac_L4.otf | PfEd | CoelacanthLight | 0 |
| CoelacanthLight 6op | Coelac_L6.otf | PfEd | CoelacanthLight | 0 |
| CoelacanthHeavy 14op | Coelac_H14.otf | PfEd | CoelacanthHeavy | 0 |
| Coelacanth_Bold 8op | Coelac_B8.otf | PfEd | Coelacanth | 0 |
| Coelacanth_Regular 14op | Coelac_R14.otf | PfEd | Coelacanth | 0 |
| Coelacanth_Bold 6op | Coelac_B6.otf | PfEd | Coelacanth | 0 |
| Coelacanth_Bold 4op | Coelac_B4.otf | PfEd | Coelacanth | 0 |
| CoelacanthLight_8op | Coelac_L8.otf | PfEd | CoelacanthLight | 0 |
| Coelacanth_Bold 14op | Coelac_B14.otf | PfEd | Coelacanth | 0 |
| CoelacanthSemibold_6op | Coelac_S6.otf | PfEd | CoelacanthSemibold | 0 |
| CoelacanthSemibold_8op | Coelac_S8.otf | PfEd | CoelacanthSemibold | 0 |
| Coelacanth_Regular 60op | Coelac_R60.otf | PfEd | Coelacanth | 0 |
| Coelacanth Italic | Coelac14-I.otf | PfEd | Coelacanth | 0 |
| CoelacanthSemibold 4op | Coelac_S4.otf | PfEd | CoelacanthSemibold | 0 |
| Coelacanth_Regular 6op | Coelac_R6.otf | PfEd | Coelacanth | 0 |
| Coelacanth_Regular 4op | Coelac_R4.otf | PfEd | Coelacanth | 0 |
| Coelacanth_Regular 8op | Coelac_R8.otf | PfEd | Coelacanth | 0 |
There are 2 things you can notice in above output
- The
Coelacanth Italic
comes from Coelac14-I.otf
. It's family name is Coelacanth
- The
slant
of the font is 0
.
The reason that Emacs
is not picking up this font file, is because the font file doesn't declare the slant
property. (When you set up italic
face, Emacs is essentially looking for a font-entity
that defines the slant
.)
So, what I did was open the font file, which was providing the italic
font, but NOT the slant
property, and fixed the font family
as below.
~$ fontforge ~/.local/share/fonts/Coelac14-I.otf
followed by Fontforge -> Menu bar -> File -> Generate Fonts
.
Then I updated the font cache with,
$ fc-cache -f -v
I restarted Emacs, set the default font---Menu bar -> Options -> Set Default Font
---to one of the Coelacanth
fonts.
Then I did, M-x customize-face RET italic
as before and I applied the changes.
Font configuration - ArchWiki claims the following
Create bold and italic styles for incomplete fonts
FreeType has the ability to automatically create italic and bold styles for fonts that do not have them, but only if explicitly required by the application.
Since Emacs
is a very old beast, I wouldn't be surprised if Emacs
goes an extra step in creating italic
style out of "incomplete" fonts.