dkfont.h File Reference

Font handling module. More...

#include <dk.h>
#include <dktypes.h>
#include <dkfont.h>

Go to the source code of this file.

Defines

#define DK_FONT_FEATURE_RM   1
 Font feature: roman font.
#define DK_FONT_FEATURE_SF   2
 Font feature: sans-serif font.
#define DK_FONT_FEATURE_TT   3
 Font feature: typewriter font.
#define DK_FONT_FEATURE_FAMILY   3
 Font feature mask: Font family.
#define DK_FONT_FEATURE_BD   4
 Font feature: bold.
#define DK_FONT_FEATURE_IT   8
 Font feature: italic.
#define DK_FONT_RP_TYPE_SYTEM   0
 Font replacement type: System.
#define DK_FONT_RP_TYPE_DOWNLOAD   1
 Font replacement type: Download.

Functions

char * dkfont_get_tex_name (size_t number)
 Find TeX name of a font.
char * dkfont_get_ps_name (size_t number)
 Find PS name of a font.
char * dkfont_get_svg_font_id (size_t number)
 Get SVG ID for font.
char * dkfont_get_svg_family_name (size_t number)
 Get SVG font family name.
char * dkfont_get_gs_alias_name (size_t number)
 Get GhostScript alias name for font.
char * dkfont_get_gs_file_name (size_t number)
 Get GhostScript font file name.
int dkfont_get_features (size_t number)
 Get font features.
dk_font_tdkfont_get_ps_fonts (void)
 Get all PS font descriptions.
dk_font_mapping_tdkfont_mapping_open (void)
 Create a new font mapping structure.
void dkfont_mapping_close (dk_font_mapping_t *f)
 Destroy font mapping structure and release memory.
int dkfont_mapping_add_stream (dk_font_mapping_t *f, dk_stream_t *s)
 Add information from an input stream to the font mapping structure.
int dkfont_get_error_code (dk_font_mapping_t *f)
 Retrieve last error code.
unsigned long dkfont_get_error_lineno (dk_font_mapping_t *f)
 Retrieve line number of input in which the last error occured.
dk_one_font_mapping_tdkfont_get_one_font (dk_font_mapping_t *f, size_t s)
 Retrieve font substitution data for one font.
void dkfont_set_used (dk_font_mapping_t *fm, size_t sz, int fl)
 Mark one font in the font mapping structure as used.
int dkfont_get_used (dk_font_mapping_t *f, size_t s)
 Chech whether or not a font is marked as used.
void dkfont_one_font_reset (dk_one_font_mapping_t *s)
 Reset a font substution structure (the internal pointer is set to point to the first substitution candidate structure).
dk_font_replacement_tdkfont_one_font_get (dk_one_font_mapping_t *s)
 Get next font substitution candidate structure in font substitution structure.
char * dkfont_rep_get_name (dk_font_replacement_t *r)
 Get font name of font substitution candidate structure.
char * dkfont_rep_get_family (dk_font_replacement_t *r)
 Get font family name of font substitution candidate structure.
char * dkfont_rep_get_location (dk_font_replacement_t *r)
 Get location (directory part of download URL or directory name) of font file for a font substitution candidate structure.
char * dkfont_rep_get_source_name (dk_font_replacement_t *r)
 Get file name of font file for a font substitution candidate structure.
char * dkfont_rep_get_font_type (dk_font_replacement_t *r)
 Get font type.
char * dkfont_rep_get_tex_name (dk_font_replacement_t *r)
 Get TeX name for substitution candidate.
int dkfont_rep_get_features (dk_font_replacement_t *r)
 Get features of substitution candidate.
int dkfont_rep_get_source_type (dk_font_replacement_t *r)
 Get source type for font substitution candidate.
int dkfont_rep_check_driver (dk_font_replacement_t *r, char *d)
 Check whether a font substitution candidate can be used with a driver.


Detailed Description

Font handling module.

This module provides information about the 35 well-known PS fonts. For each font we can retrieve LaTeX and PS font name and a list of features. use the functions dkfont_get_tex_name(), dkfont_get_ps_name(), dkfont_get_svg_font_id(), dkfont_get_svg_family_name(), dkfont_get_gs_alias_name(), dkfont_get_gs_file_name() and dkfont_get_features() for this purpose.

Since version 1.11.0 the module can read a font configuration file for more comfortable and flexible font substitutions.

See Font configuration details for details about font configuration files.


Define Documentation

#define DK_FONT_FEATURE_BD   4

Font feature: bold.

#define DK_FONT_FEATURE_FAMILY   3

Font feature mask: Font family.

#define DK_FONT_FEATURE_IT   8

Font feature: italic.

#define DK_FONT_FEATURE_RM   1

Font feature: roman font.

#define DK_FONT_FEATURE_SF   2

Font feature: sans-serif font.

#define DK_FONT_FEATURE_TT   3

Font feature: typewriter font.

#define DK_FONT_RP_TYPE_DOWNLOAD   1

Font replacement type: Download.

#define DK_FONT_RP_TYPE_SYTEM   0

Font replacement type: System.


Function Documentation

int dkfont_get_error_code ( dk_font_mapping_t f  ) 

Retrieve last error code.

Parameters:
f Pointer to font mapping structure
Returns:
Error code of last error occured.

unsigned long dkfont_get_error_lineno ( dk_font_mapping_t f  ) 

Retrieve line number of input in which the last error occured.

Parameters:
f Pointer to font mapping structure.
Returns:
The line number in which the last error occured.

int dkfont_get_features ( size_t  number  ) 

Get font features.

Parameters:
number Index of the font (0-34).
Returns:
Or-combined font features.

char* dkfont_get_gs_alias_name ( size_t  number  ) 

Get GhostScript alias name for font.

Parameters:
number Index of the font (0-34).
Returns:
Pointer to name.

char* dkfont_get_gs_file_name ( size_t  number  ) 

Get GhostScript font file name.

Parameters:
number Index of the font (0-34).
Returns:
Pointer to name.

dk_one_font_mapping_t* dkfont_get_one_font ( dk_font_mapping_t f,
size_t  s 
)

Retrieve font substitution data for one font.

Parameters:
f Pointer to font mapping structure.
s Index of the font (0-34).
Returns:
Pointer to font substitution structure.

dk_font_t* dkfont_get_ps_fonts ( void   ) 

Get all PS font descriptions.

Returns:
Pointer to an array (35 elements) of descriptions for PS fonts.

char* dkfont_get_ps_name ( size_t  number  ) 

Find PS name of a font.

Parameters:
number Index of the font (0-35).
Returns:
Pointer to name.

char* dkfont_get_svg_family_name ( size_t  number  ) 

Get SVG font family name.

Parameters:
number Index of the font (0-35).
Returns:
Pointer to font family name.

char* dkfont_get_svg_font_id ( size_t  number  ) 

Get SVG ID for font.

Parameters:
number Index of the font (0-35).
Returns:
Pointer to name.

char* dkfont_get_tex_name ( size_t  number  ) 

Find TeX name of a font.

Parameters:
number Index of the font (0-34).
Returns:
Pointer to name.

int dkfont_get_used ( dk_font_mapping_t f,
size_t  s 
)

Chech whether or not a font is marked as used.

Parameters:
f Pointer to font mapping structure.
s Index of the font (0-34).
Returns:
Flag to indicate whether the font is marked as used.

int dkfont_mapping_add_stream ( dk_font_mapping_t f,
dk_stream_t s 
)

Add information from an input stream to the font mapping structure.

Parameters:
f Pointer to font mapping structure.
s Pointer to stream.
Returns:
Flag to indicate success.

void dkfont_mapping_close ( dk_font_mapping_t f  ) 

Destroy font mapping structure and release memory.

Parameters:
f Pointer to font mapping structure to destroy.

dk_font_mapping_t* dkfont_mapping_open ( void   ) 

Create a new font mapping structure.

The font mapping structure is created in dynamically allocated memory, use dkfont_mapping_close() to destroy the structure and release the memory if the structure is no longer needed.

Returns:
Pointer to new font mapping structure on success, NULL on error.

dk_font_replacement_t* dkfont_one_font_get ( dk_one_font_mapping_t s  ) 

Get next font substitution candidate structure in font substitution structure.

Parameters:
s Pointer to font substitution structure.
Returns:
Pointer to font substitution candidate structure on success, NULL on error.

void dkfont_one_font_reset ( dk_one_font_mapping_t s  ) 

Reset a font substution structure (the internal pointer is set to point to the first substitution candidate structure).

Parameters:
s Pointer to font substution structure.

int dkfont_rep_check_driver ( dk_font_replacement_t r,
char *  d 
)

Check whether a font substitution candidate can be used with a driver.

Parameters:
r Font substitution candidate structure.
d Driver name.
Returns:
Flag to indicate whether the font substitution candidate can be used.

char* dkfont_rep_get_family ( dk_font_replacement_t r  ) 

Get font family name of font substitution candidate structure.

Parameters:
r Font substitution candidate structure.
Returns:
Font family name.

int dkfont_rep_get_features ( dk_font_replacement_t r  ) 

Get features of substitution candidate.

Parameters:
r Font substitution candidate structure.
Returns:
Or-combined font features.

char* dkfont_rep_get_font_type ( dk_font_replacement_t r  ) 

Get font type.

Parameters:
r Font substitution candidate structure.
Returns:
Pointer to type name or NULL on error.

char* dkfont_rep_get_location ( dk_font_replacement_t r  ) 

Get location (directory part of download URL or directory name) of font file for a font substitution candidate structure.

Parameters:
r Font substitution candidate structure.
Returns:
Pointer to directory name or NULL on error.

char* dkfont_rep_get_name ( dk_font_replacement_t r  ) 

Get font name of font substitution candidate structure.

Parameters:
r Font substitution candidate structure.
Returns:
The name.

char* dkfont_rep_get_source_name ( dk_font_replacement_t r  ) 

Get file name of font file for a font substitution candidate structure.

Parameters:
r Font substitution candidate structure.
Returns:
Pointer to file name or NULL on error.

int dkfont_rep_get_source_type ( dk_font_replacement_t r  ) 

Get source type for font substitution candidate.

Parameters:
r Font substitution candidate structure.
Returns:
DK_FONT_RP_TYPE_SYSTEM for system fonts or DK_FONT_RP_TYPE_DOWNLOAD for fonts to download.

char* dkfont_rep_get_tex_name ( dk_font_replacement_t r  ) 

Get TeX name for substitution candidate.

Parameters:
r Font substitution candidate structure.
Returns:
Pointer to TeX font name on success, NULL on error.

void dkfont_set_used ( dk_font_mapping_t fm,
size_t  sz,
int  fl 
)

Mark one font in the font mapping structure as used.

Parameters:
fm Pointer to font mapping structure.
sz Index of the font (0-34).
fl Flag (1=font used, 0=font not used).


Generated on Mon Feb 16 17:12:04 2009 for dklibs by  doxygen 1.5.6