Re: SVG to PNG

Bob Friesenhahn <[email protected]> Tue, 17 Nov 2020 08:24:58 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Tue, 17 Nov 2020, Pro Turm wrote:

> Thanks.
> It was a more prosaic reason for the above. StaticModules[] are traversed
> alphabetically, and if they are not declared alphabetically for loading
> (e.g.
>
> STATICM("SVG",RegisterSVGImage,UnregisterSVGImage)), than they are not
> registered :
>
>     if (StaticModules[index].name[0] > module_name[0])
>
>        break;

It is indeed true that the list is ordered and this is used as a form 
of optimization when searching.  The list is ordered as delivered.

> Another questions arouse further:
> What kind of fonts are a prerequisite? I'm having a Calibri font in the
> svg, and graphicsmagick has a fallback to urw fonts (n019004l.pfb)? If they
> are Ghostscript installed fonts I would have a problem with the license.
> What would be the right approach to follow in this case, i.e. whats
> GraphicsMagick design about fonts?

The GraphicsMagick design regarding fonts is perhaps a bit weak since 
it is not tightly integrated with the Windows operating system.  Font 
rendering is not dependent on the operating system although font 
discovery may be aided by the operating system.

In the 'config' sub-directory you will see files named starting with 
'type'.  For example:

   type-ghostscript.mgk.in
   type-solaris.mgk.in
   type-windows.mgk.in
   type.mgk.in

For the Autoconf configure-based build, these have substitutions 
performed on them and then they become files which end with '.mgk' 
rather than '.mgk.in'.

Likewise, in the VisualMagick/bin directory I currently see:

   type-ghostscript.mgk
   type.mgk

Normally what happens is that type.mgk is loaded, and this may include 
other files (such as type-ghostscript.mgk).

For Microsoft Windows there is a special case in that Windows fonts 
are also found via the Windows registry.  In magick/nt_feature.c there 
is a NTGetTypeList() function which attempts to discover fonts via the 
Windows registry and then deduce their characteristics based on 
naming.

Regardless of use of the registry, it is possible to add your own type 
configuration file (prepared by hand) and add an inclusion for it to 
type.mgk.  This could be useful if you have some proprietary fonts you 
would like to use.  They would not need to be formally installed in 
the operating system.

Regarding the "Ghostscript" fonts, Aladdin Ghostscript no longer 
distributes the supposed "Ghostscript" fonts (which really came from 
URW by agreement with the FSF).  It is my understanding that these 
files were distributed via the GPLv2 license.  I distribute these 
files on the GraphicsMagick ftp site in the delegates directory as 
'ghostscript-fonts-std-8.11.tar.gz'.  The "Ghostscript" fonts do not 
require Ghostscript in order to be rendered since they are rendered 
directly using FreeType.  Currently, the "Ghostscript" fonts are 
discovered by first searching for an installed Ghostscript using the 
Windows registry.  In the provided type-ghostscript.mgk, the path to 
the Ghostscript fonts is substituted at run-time by replacing 
'@ghostscript_font_dir@' with the actual path.

If you are sensitive to license, then take care about Ghostscript 
since it is offered under several different licenses depending on how 
old the Ghostscript is, and who offers it.  To me, the AGPL license 
does not seem suitable for some uses without paying Aladdin for a 
license.  Aladdin is interested in getting commercial users to pay to 
use AGPL Ghostscript if they run it on a server or otherwise prepare 
content which is downloaded by a user.

Test the availability of fonts using this command:

   gm convert -list type

It will show how fonts were discovered and which fonts are available.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt