dkfont - List of 35 well-known PS fonts #include <dkfont.h> char *dkfont_get_tex_name(size_t n); char *dkfont_get_ps_name(size_t n); char *dkfont_get_svg_family_name(size_t n); int dkfont_get_features(size_t n); dk_font_t *dkfont_get_ps_fonts(void); The dkfont module contains a list of the 35 well-known PS fonts. The font listing contains LaTeX name, PS name and feature list for each font. The enumeration order is the same as in the Fig file format specification. Starting with dklibs version 1.11.0 there are data structures and functions for user-defined font mapping.

Fixed font-mapping
returns the LaTeX name of the specified font. returns the PostScript name of the specified font. returns the font-family for use with SVG. returns the feature list of the specified font. size_t fontno; int i; fontno = 0; /* 0...34 */ i = dkfont_get_features(fontno); switch(i & DK_FONT_FEATURE_FAMILY) { case DK_FONT_FEATURE_RM: { printf("Roman font.\n"); } break; case DK_FONT_FEATURE_SF: { printf("Sans-serif font.\n"); } break; case DK_FONT_FEATURE_TT: { printf("Type writer font.\n"); } break; default: { printf("ERROR: Unknown font type\n"); } break; } if(i & DK_FONT_FEATURE_BD) { printf("Bold/Oblique font.\n"); } if(i & DK_FONT_FEATURE_IT) { printf("Italic font.\n"); } returns a pointer to the start of the array containing the list.

User-defined font mapping
contains the font mapping data for all the 35 PS fonts. contains the font mapping data for one PS font. contains data for one possible substitute of a PS font. creates a new empty dk_font_mapping_t structure. When finished with it, use dk_font_mapping_close() to release ressources. adds the contents of a font configuration file to the mapping data. closes the dk_font_mapping_t structure and releases the memory used by it. returns error code of the last error occured while dk_font_mapping_add_stream(). returns the line number in which the error occured. retrieves a pointer to a dk_one_font_mapping_t structure for the PS font specified by number. marks the specified PS font as ``used by the document''. checks whether or not the specified PS font is ``used by the document''. prepares the dk_one_font_mapping_t for traversing (retrieving all dk_font_replacement_t step by step). retrieves the next dk_font_replacement_t. returns the font name of the replacement. returns the font family name of the replacement. returns the directory part of the URL used to retrieve the replacement font. returns the filename part of the URL used to retrieve the replacement font. returns the font type (i.e. ``svg'' or ``pfb'') of the replacement font. returns the TeX name of the replacement font. returns the font features of the replacement font. returns the source type of the replacement, either DK_FONT_RP_TYPE_SYSTEM for system fonts (ready for use, no download... necessary) or DK_FONT_RP_TYPE_DOWNLOAD (download, installation and further setup necessary...). checks whether or not the replacement font can be used with the specified driver. Functions returning pointers return a valid pointer on success. A NULL pointer is returned to indicate that no matching character or substring was found. The dk_font_mapping_add_stream() functions initializes a dk_font_mapping_t structure from a font configuration file. This configuration file consists of up to 35 sections, one section for each of the 35 PostScript fonts. Each section is started by the PS font name in square brackets, the list of possible replacement fonts descriptions follows. At the start of the a replacement font description there is a line ``name = name''. The remaining lines consists of key/value pairs, key and value are separated by ``=''. The following keys can occur: specifies how applications can find the font. The source type is either ``system'' or ``download''. System fonts are installed on the system ready for use, applications can access these fonts by simply specifying the name. Download fonts are specified by URL. specifies the name of the font family. contains a list of font features: is a list of output drivers which can use this replacement. The names are separated by whitespaces. specifies the directory part of the download URL. contains the file name part of the download URL. is used to specify the font type, i.e. ``svg'' or ``pfb''. specifies the TeX name for the replacement font.

Font configuration file example
The following excerpt from ``combfont.cfg'' shows how to configure font substituion for the PS fonts ``Times-Roman'' and ``Times-Italic'' on Windows systems. For both fonts applications should try Windows fonts first. If these fonts are not found, SVG viewers can attempt to use SVG variants of the GhostScript fonts. [Times-Roman] name = Times New Roman source type = system features = roman family = Times New Roman driver = * name = NimbusRomanNo9L-Regu source type = download directory = ./urw-svg file name = n021003l.svg features = roman family = Nimbus Roman No9 L driver = svg font type = svg [Times-Italic] name = Times New Roman Kursiv source type = system features = roman italic family = Times New Roman driver = * name = NimbusRomNo9L-ReguItal source type = download directory = ./urw-svg file name = n021023l.svg features = roman italic family = Nimbus Roman No9 L driver = svg font type = svg Dirk Krause Copyright (c) 2001-2008, Dirk Krause All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Dirk Krause nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.