[Tex/LaTex] Using setmonofont with Bera Sans Mono in Beamer produces garbled output

beamerfontspeclistings

I am using Bera Sans Mono as the monospaced font for typesetting code listings using the listings package. This is done for slides which are produced using beamer and XeLaTeX. My preamble includes the following (which used to work before a recent update to the MikTeX engine, the fontspec package, and the above-mentioned packages):

\usepackage{fontspec}
\setmonofont{Bera Sans Mono}[Scale=0.9] % for code listings beramono is used
\newfontfamily\quotefont{Linux Libertine O}[Ligatures=TeX] % selects Libertine for quotation marks

The output produced is:
Garbled code listing

If I do not use \setmonofont and have the following preamble instead, the correct output is produced:

\usepackage{fontspec}
\usepackage[scaled]{beramono}
\usepackage[T1]{fontenc}
\newfontfamily\quotefont{Linux Libertine O}[Ligatures=TeX] % selects Libertine for quotation marks

Correct code listing

Why am I unable to use \setmonofont{Bera Sans Mono}[Scale=0.9] (which used to work before)?

Some additional points to note:

  1. XeLaTeX is able to find the font
  2. \setmonofont appears to work correctly with other fonts, just not Bera Sans Mono.

Best Answer

There is no opentype font Bera Sans Mono, xelatex finds the normal type1 version and as it is not unicode encoded you get garbage.

To quote the CTAN info (http://www.ctan.org/pkg/bera)

The Bera fam­ily is a repack­ag­ing, for use with TEX, of the Bit­stream Vera fam­ily.

So with xelatex you should use

\setmonofont{Bitstream Vera Sans Mono}