Easy way to generate a Glyph/Character Map of fonts?

TOM-MLL's picture

Does any one know how to create a Glyph/Character map, say like how myfonts.com uses? http://new.myfonts.com/fonts/fontbureau/juliana/text-roman/characters.html

I am trying to create some previews of my font designs, but cannot find a way to do something like this, and in a batch process. Any ideas?

Arno Enslin's picture

You may try fontplot. It belongs to the AFDKO (Adobe Font Development Kit for OpenType).

Command "fontplot -h" and "fontplot -help_params". Fontplot stores the character map as PDF. I am not sure, if there is an option for putting the index numbers into the boxes, but if not, maybe someone is willing to modify the Python script.

I did not try it, but you also could redirect the output of the print commands of FontLab and convert the Postscript file to PDF.

But I think, there are more comfortable ways.

Michel Boyer's picture

The AFDKO command tx does what you want.

tx -pdf fontfilename.extension > fontfilename.pdf

does it. Here is the result on the TeX Gyre Pagella font (pdf 1.2Mb)

TOM-MLL's picture

I have never seen/messed with this AFDKO setup, are these command line tools for os x?

Michel Boyer's picture

I use them on OS X. You can download from here. Just follow the instructions.

Arno Enslin's picture

You may also try this with fontplot:

fontplot --drawMeta_Hints 0 --drawMeta_SideBearings 0 --drawGlyph_XAdvance 0 --pageTitleFont Helvetica --metaDataFont Helvetica --metaDataNameSize 110 YOURFONT.otf

But the tx command seems to fill better your purposes. It even includes the Unicode point.

Michel Boyer's picture

You can also try

tx -pdf -1 fontname.otf > fontname.pdf

Each character is then clickable to view more in details. The file generated is much larger (pdf 3.9Mb).

Arno Enslin's picture

@ Michel

Is the redirection per > required on the Mac?

On Windows it is more comfortable to write the command in this way:
tx -pdf -a fontFileName.extension

The -a-option arranges the name of the output by taking the fontFileName as filename and the mode-option (in this case pdf) as extension. (Have you tried the -bc-mode-option? ASCII-art.)

And -A instead of -a takes the internal fontname instead of the name of the input file.

But I need a bit help with the options -dd and -sd. I get an error there: file error [NameOfInputDirectory/-]

Michel Boyer's picture

Redirection is not required. What you suggest also works on the mac. I use Unix pipes a lot (with sed, grep and awk), and the last thing I do is to redirect; with programs whose output is the standard output, it is the thing to do. I was in fact not aware of the -a or -A options. I just tried the dd option. I was in /library/fonts and, after creating the folder $HOME/Arno typed

tx -pdf -a -dd $HOME/Arno Arno*otf

which took as input all the files Arno*otf, applied tx -pdf on them, named the result with a pdf extension and put them in the folder $HOME/Arno.

That is something I would have done with the line command

for i in Arno*.otf; do tx -pdf $i > $HOME/Arno/${i%.otf}.pdf; done

It is faster to type than to read the output of tx -u but that is probably not the kind of text for a typophile thread. It is just to explain why I often miss many options in programs.

Michel

Michel Boyer's picture

Hmm. I wonder what the bc option can be used for. There are lots of interesting things in the AFDKO suite that I have not tried. Most of the time, FontForge answers my needs.

Arno Enslin's picture

I have done it in this way now (in a batch file):

set "p=path to directory with fonts with spaces in path"
for %%f in ("%p%\*.*") do tx -pdf -dd "%p%" -a "%%f"

I wonder, why this did not work:

for %%f in ("path to directory with fonts with spaces in path\*.*") do tx -pdf -dd "%%~dpf" -a "%%f"

And I still have problems with the options sd and sr, when jokers are included. The problem is, that I meanwhile have forgotten so much, that I did know about batch programming.

Michel Boyer's picture

I am not familiar with windows command files. I don't know what "%%~dpf" is meant to be. If you don't use the -dd option, the pdf files go to the current directory. I tried something similar to your last command:
for %%f in ("C:\windows\fonts\*.OTF") do tx -pdf -dd "%~dp0" -A "%%f"
which should do the same as
for %%f in ("C:\windows\fonts\*.OTF") do tx -pdf -A "%%f"
and it did not work; the "%~dp0" expands with a backslash at the end and tx does not seem to like it.

Arno Enslin's picture

@ Michel

%%~dpf is the path to f inclusively the drive and exclusively file name and extension.

-------

For the Windows users. I would like to attach a few batch files, but this does not seem to be possible here.

Create the folders Input and Output in the directory of your choice (same drive as [A]FDK[O]) and create the following batch files:

FDKvars.bat (Change path to the FDK [in the batch file], if it is different.)
@echo off
set "FDK=C:\FDK_25_21898\Tools\win"

Make Character-Map-PDF [Boxes link to ExtraInfo].bat
@echo off
call FDKvars
for %%f in (Input\*.*) do %FDK%\tx -pdf -1 -dd Output "%%f" "%%~nf_Character-Map_and_Extra-Info.pdf"

Make Character-Map-PDF.bat
@echo off
call FDKvars
for %%f in (Input\*.*) do %FDK%\tx -pdf -dd Output "%%f" "%%~nf_Character-Map.pdf"

Empty In- and Output.bat
for %%f in (Input\*.*; Output\*.*) do del "%%f"

TX Help.bat
@echo off
call FDKvars
%FDK%\tx -h
echo.
echo.
echo.
pause

TX Usage.bat
@echo off
call FDKvars
%FDK%\tx -u
echo.
echo.
echo.
pause

Arno Enslin's picture

Addition/correction (FDKvars.bat)

FDKvars.bat (Change path to the FDK [in the batch file], if it is different.)
@echo off
set "FDK=C:\FDK_25_21898\Tools\win"
set "FDKPython=%FDK%\Python\Current\python"
set "FDKScripts=C:\FDK_25_21898\Tools\SharedData\FDKScripts"

Make Character-Map-PDF with Fontplot.bat
@echo off
call FDKvars
for %%f in (Input\*.*) do (
%FDKPython% %FDKScripts%\ProofPDF.py -o "Output\%%~nf_Character-Map_[Fontplot].pdf" -fontplot --openPDFWhenDone 0 --drawMeta_Hints 0 --drawMeta_SideBearings 0 --drawGlyph_XAdvance 0 --pageTitleFont Helvetica --metaDataFont Helvetica --metaDataNameSize 110 "%%f"
start Output\"%%~nf_Character-Map_[Fontplot].pdf")

Note: The parameter for opening the pdf is set to 0, because on my PC the script starts it, before it is saved. So I have added the start command separately (start Output…).

Proof PDF Help-Params [Fontplot for example].bat
@echo off
call FDKvars
%FDKPython% %FDKScripts%\ProofPDF.py -help_params
echo.
echo.
echo.
pause

Proof PDF Help [Fontplot for example].bat
@echo off
call FDKvars
%FDKPython% %FDKScripts%\ProofPDF.py -h
echo.
echo.
echo.
pause

Syndicate content Syndicate content