7

When using \setmonofont with fontspec in XeTeX, I wonder what fonts (or type faces) I can use.

fc-list yields among others:

Terminus:style=Bold
Terminus:style=Regular

So I tried this:

\usepackage{fontspec}
\setmonofont[Mapping=tex-text]{Terminus}
[...]
\testtt{monospace text}

I get the error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "Terminus" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

Now, which fonts can I use?

Is there a way to list them, or something? Incidentally, is there a way how I could use Terminus in XeTeX for monospaced text?

polemon
  • 3,555
  • 4
  • 32
  • 42
  • Operating system? TeX distribution? Location of Teriminus in the file system? Font Type (.otf?)? – Caramdir Aug 15 '11 at 21:43
  • Linux, installed font from repos. Font is not available as OpenType font, but appears in fc-list, so fontconfig does see it. I'm using XeTeX, and the fact that I use tools such as fc-list, makes it somewhat clear, that I use Linux. For reference, the font is located in /usr/share/fonts/terminus, and is a gziped X11 bitmap format (.pcf.gz). – polemon Aug 15 '11 at 21:49
  • fontspec is used for OpenType and TrueType fonts, so no, you can't use a bitmap version of Terminus with it. – Caramdir Aug 15 '11 at 21:55
  • OK, and how can I list available fonts then? – polemon Aug 15 '11 at 21:57
  • http://tex.stackexchange.com/questions/12881/how-to-get-a-list-of-all-available-ttf-fonts-with-xetex suggests to use fc-list, but apparently that also prints legacy fonts. – Caramdir Aug 15 '11 at 21:59
  • Not sure if this is entirely correct, but fc-list -f "%{family} (%{fontformat})\n" | sort --unique | grep --color=never TrueType might help. – Caramdir Aug 15 '11 at 22:03
  • 1
    Simpler: fc-list :fontformat=TrueType. – Caramdir Aug 15 '11 at 22:20
  • @Caramdir: OK, all fonts listed there are usable. Don't know if that's all of them or just a subset. Thanks anyways! – polemon Aug 16 '11 at 01:47
  • 1
    @Caramdir: this won't print CFF (.otf) and Type 1 fonts and both can be used by XeTeX/LuaTeX. fc-list :outline -f "%{family}\n" should avoid listing bitmap only fonts (but I don't have such fonts to test). – خالد حسني Aug 16 '11 at 01:47
  • There is a TTF version of the font here. – خالد حسني Aug 16 '11 at 01:50
  • @Khaled Hosny: The font I tried to use in the first place, Terminus, doesn't show up, so I guess it works. Thanks! The TTF version is quite poor, though. I decided to use another monospace font. – polemon Aug 16 '11 at 01:53
  • @Khaled You should add your solution as an answer. – Alan Munn Aug 17 '11 at 13:38

2 Answers2

9

Bitmap fonts are not supported by XeTeX/LuaTeX. To list outline fonts only, try:

fc-list :outline -f "%{family}\n"

There is also a TTF version of Terminus, though it seems outdated.

egreg
  • 1,121,712
  • The command is what I was looking for, many thanks! The TTF version of Terminus isn't looking too good in print, I'll see if someone ever makes an OpenType version of it... – polemon Aug 21 '11 at 05:49
3

I would suggest:

fc-list :outline -f "%{family}\n" | sort -u

It will sort them and removes duplicates out of the list.