To convert a DVI file to SVG, just call dvisvgm with the name of the DVI file. The suffix
In this example, the first page of
.dvi
can be omitted.In this example, the first page of
frktest.dvi
has been converted and written to frktest.svg
. Since the font
yinitas wasn’t available as a vector font, dvisvgm called Metafont and vectorized the two glyphs of Metafont’s
bitmap output required for the document. They are stored in a cache file so that it’s not necessary to call Metafont
for these glyphs again which will speed up the conversion process.Here is the resulting SVG file opened in the Opera browser. Great, the document looks as expected –
all glyphs are rendered correctly.
And this screenshot shows the same SVG file opened in Firefox. Well, the result is not that convincing this time.
Unfortunately, only few SVG renderers support the evaluation of
SVG font elements properly which dvisvgm creates by default.
Thus, in many cases, these SVG files look strange.
In order to avoid these problems, call dvisvgm with option -n
or --no-fonts
. It replaces the font
elements by paths which are supported by nearly all
SVG renderers.
As already mentioned above, dvisvgm doesn’t call Metafont again because the vectorial representation of the required glyphs is present in the font cache and allows for a faster conversion.
The font-free SVG file looks identical to the previous one and Firefox, Chrome, Inkscape etc. render it
correctly. However, as there are no longer font characters present in the SVG file, the drawn text can’t
be selected in the browser.
dvisvgm supports the evaluation of PostScript specials
embedded in the DVI file. It requires Ghostscript to process the PostScript instructions.
If the Ghostscript library can’t be found, you get a corresponding warning message.
If the PostScript specials couldn’t be processed, the resulting SVG usually lacks some parts of the graphic
and/or text elements get the wrong position.
There are several ways to tell dvisvgm where to find the Ghostscript library (see the FAQ),
e.g. by setting the environment variable
LIBGS
. The warning messages go away as soon as Ghostscript is accessible.Now all graphic and positional instructions made it to the SVG file and the result looks as expected.