How can the font cryst be used in asymptote in particular with WebGL output?

1. PDF output of Asymptote

Consider my file label3zoom.tex:



% \DeclareFontFamily{U}{cry}{\hyphenchar\font=-1}
% \DeclareFontShape{U}{cry}{m}{n}{ <-> cryst}{}
% \newcommand{\cry}[1]{{\usefont{U}{cry}{m}{n} \symbol{#1}}}


% Hello cryst ``\cry{41}'' % works

import three;
texpreamble("\DeclareFontShape{U}{cry}{m}{n}{ <-> cryst}{}");
texpreamble("\newcommand{\cry}[1]{{\usefont{U}{cry}{m}{n} \symbol{#1}}}");

    draw(scale3(4)*extrude("Hello cryst ``\cry{41}''",2Z), material(blue));


The sequence

$ pdflatex label3zoom.tex
$ asy label3zoom-*.asy
$ pdflatex label3zoom.tex

gives me following output:

enter image description here

As you can see the \cry{41} command does not produce any output. In pdflatex \cry{41} prints a little square with spikes in the corners

enter image description here

Why is there only whitespace in the output of Asymptote and how can I fix this?

2. WebGL output of Asymptote

One can generate with

$ asy --version
Asymptote version 2.70 [(C) 2004 Andy Hammerlindl, John C. Bowman, Tom Prince]

WebGL    3D HTML rendering

and the flag -f html

$ asy -f html label3zoom.asy

HTML pages with WebGL rendering. This works for the official example label3zoom.asy.

I assume when the problem with the pdf output is fixed, the webgl output might work as well. But I will see.

I am on macOS 10.15.7 using MacTeX-2021 based on current TeXLive 2021.

  • I managed to get a bit further with pen fpen=font("U","cry","m","n"); label("\symbol{41}",(0mm,-10mm),fpen+blue); but I didn't manage to put this inside an extrude command.
    – Marijn
    Commented Aug 26, 2021 at 15:52
  • 1
    I guess Asymptote current only for smooth and continuous symbols, while \cry{41} is not smooth. You can test another math symbols. Commented Aug 27, 2021 at 8:04
  • Thanks for your comments, efforts and thoughts. They pointed me in the direction to check whether the vector-based font of cryst is actually used. An old question of mine was about the proper installation of the font cryst. My recent new installation of TeXLive 2021 made it necessary to update the font configuration of cryst once again which I missed and apparently solved this question as well.
    – Hotschke
    Commented Aug 28, 2021 at 10:16

1 Answer 1


Ensure that Type-1 (vector-based) font of the package cryst is used

(files cryst.afm and cryst.pfb )

In order to check what kind of font is currently used, compile a pdf document using the cryst font without asymptote, e.g.:


\DeclareFontShape{U}{cry}{m}{n}{ <-> cryst}{}
\newcommand{\cry}[1]{{\usefont{U}{cry}{m}{n} \symbol{#1}}}


Hello cryst ``\cry{41}''.


Then check the log file for font entries. If a pixel-based font is used following type of entry can be found (search pattern cryst.[0-9]*pk)


Also a visual inspection with a pdf viewer by larger zoom levels reveals whether a vector- or pixel-based font is used.

After I followed the accepted answer of an old question

Install cryst font on macOS 10.14 for pdflatex and lualatex,

the log entry will point to the file cryst.pfb.

Now when I run the given example in the question, I get

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .