3

Short Question:

How can I achieve the following two things:

1) Get a list of all Fonts, currently installed on my system, that LaTeX can use?

2) For each font, render the letters a-z, A-Z, 0-9.

Longer Question:

Basically, I want to render all the glyphs that my current system can render. So I want to:

1) get a list of all the fonts that LaTeX can use and 2) render all the glyphs in each of the fonts

How can I do this in LaTeX?

Thanks!

EDIT

It appears the answer to part 1 of my question is

updmap-sys --listmaps | wc -l

from What fonts are installed on my box?

So for part 2. How do I use all of these fonts?

EDIT 3

So turns out my question is a duplicate of:

Lualatex: Font table with examples

fonts
  • 33

1 Answers1

6

Create a new directory and a file:

#!/bin/bash
find `kpsewhich -expand-var='$TEXMFMAIN'`/fonts/tfm -name '*.tfm' -print | \
sed 's@.*/@@; s@\.tfm$@@' | \
xargs sh -c 'for i in "$@"; do (echo $i; echo \\\sample\\\bye) | \
pdftex testfont; mv testfont.pdf $i.pdf; echo $i.pdf; done' sh

make it executable and run it. It creates a lot of pdf files for every single font and shape. Another possible solution is to create first a list of all available font:

 find `kpsewhich -expand-var='$TEXMFMAIN'`/fonts/tfm -name '*.tfm' -print | sed 's@.*/@@; s@\.tfm$@@' > available_fonts.lst

and then running this Perl script, which creates latex test files. It can be extend to create one really big document:

#!/usr/bin/perl -w
use strict;

my $i = 0;
my $lst = {};
my $couter_fonts = 0;
my $couter_files = 0;

    open(F, "available_fonts.lst");
    while(<F>){
      chomp;
      $lst->{enc($i++)} = $_;
    }
close F;

open (F, "+>lst_".$couter_files.".tex\n");
print F qq(\\documentclass{article}\n);
print F qq(\n\\begin{document}\n);
foreach(sort keys %{$lst}){
      if (!(++$couter_fonts % 100)){
        $couter_files ++;
        $couter_fonts = 0;
        print F "\\end{document}\n";
        close F;
        open (F, "+>lst_".$couter_files.".tex\n");
        print F qq(\\documentclass{article}\n);
        print F qq(\n\\begin{document}\n);
      }
  print F "\\newfont{\\myFont$_}{ $lst->{$_} }\n";
  print F "\\myFont$_ $lst->{$_} : Sample Text \\\\ \n";
}
print F qq(\\end{document}\n);
close F;

sub enc{
  my $out = "";
  foreach(split //, shift){
    $out .= chr($_+65);
  }
 return $out;
}
  • Got the LuaLatex example working (and understand the code). Thus, not trying this. However, I appreciate your effort. Thanks! – fonts Sep 26 '15 at 09:34