def get_fontspec():
 latex_fontspec = []
 texcommand = get_texcommand()
 if (texcommand != u'pdflatex'):
  latex_fontspec.append(u'\\usepackage{fontspec}')
 if ((texcommand != u'pdflatex') and rcParams.get(u'pgf.rcfonts', True)):
  families = [u'serif', u'sans-serif', u'monospace']
  fontspecs = [u'\\setmainfont{%s}', u'\\setsansfont{%s}', u'\\setmonofont{%s}']
  for (family, fontspec) in zip(families, fontspecs):
   matches = [f for f in rcParams[(u'font.' + family)] if (f in system_fonts)]
   if matches:
    latex_fontspec.append((fontspec % matches[0]))
   else:
    pass
 return u'\n'.join(latex_fontspec)

def get_fontspec ( ) : latex_fontspec = [ ] texcommand = get_texcommand ( ) if ( texcommand != u'pdflatex' ) : latex_fontspec . append ( u'\\usepackage{fontspec}' ) if ( ( texcommand != u'pdflatex' ) and rcParams . get ( u'pgf.rcfonts' , True ) ) : families = [ u'serif' , u'sans-serif' , u'monospace' ] fontspecs = [ u'\\setmainfont{%s}' , u'\\setsansfont{%s}' , u'\\setmonofont{%s}' ] for ( family , fontspec ) in zip ( families , fontspecs ) : matches = [ f for f in rcParams [ ( u'font.' + family ) ] if ( f in system_fonts ) ] if matches : latex_fontspec . append ( ( fontspec % matches [ 0 ] ) ) else : pass return u'\n' . join ( latex_fontspec )
build fontspec preamble from rc .