Closed VincentTam closed 2 years ago
I guess, the SVG file contains the correct font data but your SVG viewer can't render it properly. That's a common issue. If you call dvisvgm with option --no-fonts
, which replaces all text elements by paths, or --font-format=woff
, the SVG should render correctly. There's also some information about this in the FAQ.
I saw that GhostScript is in the dependencies. However, with MikTeX, the command for GS is mgs instead of gs. Does dvisvgm recognise this?
Yes, if dvisvgm was built for MiKTeX, it also looks for mgsdll64.dll
or mgsdll32.dll
.
Thx very much with your response & link to FAQ. I finally got the exacted output. :tada:
For personal reference only.
here's the result run with --no-fonts
.
it's OK after uploading through GitHub.
However, the SVG created by --font-format=woff
that I had uploaded in my prev msg would be distorted after GitHub upload.
what surprises me is that the good svg takes less spaces than the bad one:
$ curl -L https://user-images.githubusercontent.com/5748535/174452553-cd79f0ba-972d-4286-9288-e6526e065204.svg > gd.svg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13116 100 13116 0 0 130k 0 --:--:-- --:--:-- --:--:-- 132k
$ curl -L https://user-images.githubusercontent.com/5748535/174452321-b78ee8d9-371b-43c4-9e4e-f4ed26a864d8.svg > bd.svg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13362 100 13362 0 0 189k 0 --:--:-- --:--:-- --:--:-- 189k
$ ls -l {gd,bd}.svg
-rw-r--r-- 1 xxxx 197609 13362 juin 18 21:03 bd.svg
-rw-r--r-- 1 xxxx 197609 13116 juin 18 21:03 gd.svg
Great to hear that you were able to fix the problem.
However, the SVG created by
--font-format=woff
that I had uploaded in my prev msg would be distorted after GitHub upload.
That's a security measure of the web browser which prevents loading the embedded font data if you load the SVG from a server.
What surprises me is that the good svg takes less spaces than the bad one:
The base64 encodings of the embedded WOFF fonts are quite lengthy and enlarge the file a bit. In contrast, the path variant without any fonts is more compact. You can reduce the file size even more by restricting the number of decimal places used in the SVG, e.g. with --precision=2
and by using relative path commands (option --relative
).
I appreciate your help. I used -d 2
and the file size is reduced by 30-40%.
$ dvisvgm --no-fonts -R -d 2 -o foobar.svg 220617-fill.dvi
pre-processing DVI file (format version 2)
processing page 1
graphic size: 213.73pt x 173.01pt (75.12mm x 60.81mm)
output written to foobar.svg
1 of 2 pages converted in 0.119 seconds
$ curl -L https://user-images.githubusercontent.com/5748535/174454795-c09be583-7748-43db-a6a7-1936b16d775a.svg > precision2.svg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8266 100 8266 0 0 115k 0 --:--:-- --:--:-- --:--:-- 115k
$ ls -l precision2.svg
-rw-r--r-- 1 sere 197609 8266 juin 18 21:39 precision2.svg
Background
I'm using the same version as in https://github.com/mgieseki/dvisvgm/issues/184, and the MWE from https://github.com/MiKTeX/miktex/issues/1112#issuecomment-1159117316
Problem
latex
.dvisvgm
without-P
.Expected output:
A SVG that looks like the following (with transparent background).
I saw that GhostScript is in the dependencies. However, with MikTeX, the command for GS is
mgs
instead ofgs
. Doesdvisvgm
recognise this?