Re: Questions on xlfd and other fonts: proper usage with -draw?
Bob Friesenhahn <[email protected]> Mon, 24 Dec 2018 09:47:50 -0600 (CST)
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 22 Dec 2018, Tom Browder wrote: > > My goal is to be able to provide a label with a given font and know > its dimensions algorithmically just as I can do with PostScript Type 1 > fonts. > > My preference is to use PostScript Type 1 fonts if at all possible for > annotation—I just need to know how to ensure GM can find them. GraphicsMagick is a bit primitive when it comes to finding fonts. The definition for fonts comes from the installed file type.mgk which can include other similar files. These are XML text files. To introduce a new font family, one would use a text (or XML) editor to create a "foo.mgk" file containing definitions for the font files in that font family. Examples of this provided in the distribution are "type-windows.mgk" and "type-ghostscript.mgk". These can included by the installed "type.mgk" file. > Questions: > > 1. For an xlfd font, do I need to specify the font size in both the > name as well as after the -pointsize option? Either you need to specify the font file path/name directly or add a XML description of the font family so that the correct files are selected automatically based on your description. > 2. For a PostScript Type 1 font, what name do I use with the -font > option? I have had success using ‘helvetica’ alone but haven’t yet > been able to see any change when I try to make it bold. Each font file only support one type face. This means that you can't make a non-bold font bold, or a non-italic font italic. The correct file needs to be selected for those properties. > 3. Where do I find the mapping of the xlfd scalable font names to the > source of font metrics? The font metrics are a property of the font learned from the font file. Properties like "bold" need to be obtained in a different way, such as using some other utility to deduce the description, or using a description of the fonts which was provided to you by the author of the fonts. > 4. Does it matter whether the -pointsize option comes before or after > the -font option? I don't think so. The pointsize is used when the text is actually rendered. > 5. For the -pointsize option, is that in units of PostScript points or pixels? Postscript points. > 6. When using scalable xlfd fonts, are values in the four fields > affecting size and resolution being used? I am not sure what an 'xlfd' font is. The font is either obtained from an X11 server (in which case old-style X11 naming must be used) or it is obtained directly from a font file format that FreeType supports. The selection of fonts via properties requires font files that FreeType supports in conjunction with a XML description of the font family. Use 'gm convert -list type' to list the fonts that GM knows about based on XML descriptions. > 7. If the answer to question 6 is yes, how do those fields interact > with each other and with the -pointsize option? First the appropriate font file needs to be selected based on the described properties. Then, if the font is a scalable font (based on vectors rather than a bitmap) it will be rendered to the size indicated by -pointsize. If you are doing a vector drawing, then there are MVG/SVG equivalents to options like -pointsize which are much better to use than the command line options. I am away on holiday at the moment and it seems that the network connectivity supporting graphicsmagick.org has been unreliable (comes and goes) for allmost two days so it has taken some time for me to finish preparing this email. Hopefully the network issues will not return. 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 _______________________________________________ Graphicsmagick-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help