Variables: Keys of font property. | |
MSymbol | Mfoundry |
Key of font property specifying foundry. | |
MSymbol | Mfamily |
Key of font property specifying foundry. | |
MSymbol | Mweight |
Key of font property specifying weight. | |
MSymbol | Mstyle |
Key of font property specifying style. | |
MSymbol | Mstretch |
Key of font property specifying stretch. | |
MSymbol | Madstyle |
Key of font property specifying additional style. | |
MSymbol | Mregistry |
Key of font property specifying registry. | |
MSymbol | Msize |
Key of font property specifying size. | |
MSymbol | Mresolution |
Key of font property specifying resolution. | |
Typedefs | |
typedef MFont | MFont |
Type of fonts. | |
Functions | |
MFont * | mfont () |
Create a new font. | |
MFont * | mfont_from_name (char *name) |
Create a new font from fontname. | |
MFont * | mfont_copy (MFont *font) |
Return a copy of a font. | |
char * | mfont_name (MFont *font) |
Create a fontname from a font. | |
void * | mfont_get_prop (MFont *font, MSymbol key) |
Get a property value of a font. | |
int | mfont_put_prop (MFont *font, MSymbol key, void *val) |
Put a property value to a font. | |
MSymbol * | mfont_selection_priority () |
Return the font selection priority. | |
int | mfont_set_selection_priority (MSymbol *keys) |
Set the font selection priority. | |
MFont * | mfont_find (MFrame *frame, MFont *spec, int *score, int limited_size) |
Find a font. | |
int | mfont_set_encoding (MFont *font, MSymbol encoding_name, MSymbol repertory_name) |
Set encoding of a font. | |
Variables | |
MPlist * | mfont_freetype_path |
List of font files and directories that contain font files. |
MFont
. A font can have font properties. Like other types of properties, a font property consists of a key and a value. The key of a font property must be one of the following symbols:
Mfoundry
, Mfamily
, Mweight
, Mstyle
, Mstretch
, Madstyle
, Mregistry
, Msize
, Mresolution
.
When the key of a font property is Msize
or Mresolution
, its value is an integer. Otherwise the value is a symbol. "The font property that belongs to font F and whose key is Mxxx"
may be shortened to "the xxx property of F".
The value of a foundry property is a symbol representing font foundry information, e.g. adobe, misc, etc.
The value of a family property is a symbol representing font family information, e.g. times, helvetica, etc.
The value of a weight property is a symbol representing weight information, e.g. normal, bold, etc.
The value of a style property is a symbol representing slant information, e.g. normal, italic, etc.
The value of a stretch property is a symbol representing width information, e.g. normal, semicondensed, etc.
The value of an adstyle property is a symbol representing abstract font family information, e.g. serif, sans-serif, etc.
The value of a registry property is a symbol representing registry information, e.g. iso10646-1, iso8895-1, etc.
The value of a size property is an integer representing design size in the unit of 1/10 point.
The value of a resolution property is an integer representing assumed device resolution in the unit of dots per inch (dpi)
The m17n library uses font objects for two purposes: to receive font specification from an application program, and to present available fonts to an application program. When the m17n library presents an available font to an application program, all font properties have a concrete value.
The m17n library supports three kinds of fonts: Window system fonts, FreeType fonts, and OpenType fonts.
The m17n-X library supports all fonts handled by an X server and an X font server. The correspondence between XLFD fields and font properties are shown below.
XLFD field property --------------- -------- FOUNDRY foundry FAMILY_NAME family WEIGHT_NAME weight SLANT style SETWIDTH_NAME stretch ADD_STYLE_NAME adstyle POINT_SIZE size RESOLUTION_Y resolution CHARSET_REGISTRY-CHARSET_ENCODING registry
XLFD fields not listed in the above table are ignored.
The m17n library, if configured to use the FreeType library, supports all fonts that can be handled by the FreeType library. The variable mfont_freetype_path is initialized properly accoding to the configuration of the m17n librayr and the environment variable M17NDIR
. See the documentation of the variable for details.
The family name of a FreeType font corresponds to the family property. Style names of FreeType fonts correspond to the weight, style, and stretch properties as below.
style name weight style stretch ---------- ------ ----- ------- Regular medium r normal Italic medium i normal Bold bold r normal Bold Italic bold i normal Narrow medium r condensed Narrow Italic medium i condensed Narrow Bold bold r condensed Narrow Bold Italic bold i condensed Black black r normal Black Italic black i normal
Style names not listed in the above table are treated as "Regular".
Combination of a platform ID and an encoding ID corresponds to the registry property. For example, if a font has the combination (1 1), the registry property is 1-1. Some frequent combinations have a predefined registry property as below.
platform ID encoding ID registry property ----------- ----------- ----------------- 0 3 unicode-bmp 0 4 unicode-full 1 0 apple-roman 3 1 unicode-bmp 3 1 unicode-full
Thus, a font that has two combinations (1 0) and (3 1) corresponds to four font objects whose registries are 1-0, apple-roman, 3-1, and unicode-bmp.
The m17n library, if configured to use both the FreeType library and the OTF library, supports any OpenType fonts. The list of actually available fonts is created in the same way as in the case of FreeType fonts. If a fontset instructs to use an OpenType font via an FLT (Font Layout Table), and the FLT has an OTF-related command (e.g. otf:deva), the OTF library converts a character sequence to a glyph code sequence according to the OpenType layout tables of the font, and the FreeType library gives a bitmap image for each glyph.
|
The type MFont is the structure defining fonts. It contains information about the following properties of a font: foundry, family, weight, style, stretch, adstyle, registry, size, and resolution. This structure is used both for specifying a font in a fontset and for storing information about available system fonts. The internal structure is concealed from application code.
|
|
The mfont() function creates a new font object that has no property.
|
|
The mfont_from_name() function creates a new font object. The properties are extracted fontname name. How to extract properties is window system dependent. The m17n-X library parses name as XLFD (X Logical Font Description).
|
|
The mfont_copy() function returns a new copy of font. |
|
The mfont_name() function creates a fontname string created from font. The syntax of fontname is window system dependent. The m17n-X library returns a fontname conforming to XLFD (X Logical Font Description).
|
|
The mfont_get_prop() function gets the value of key property of font. key must be one of the following symbols:
Msize or Mresolution , this function returns the corresponding value as an integer. If the font does not have key property, it returns 0.
If key is something else, it returns |
|
The mfont_put_prop() function puts a font property whose key is key and value is val to font. key must be one of the following symbols:
If key is |
|
The mfont_selection_priority() function returns a newly created array of six symbols. The elements are the following keys of font properties ordered by priority.
The m17n library selects the best matching font according to the order of this array. A font that has a different value for a property of lower priority is preferred to a font that has a different value for a property of higher priority. |
|
The mfont_set_selection_priority() function sets font selection priority according to keys, which is an array of six symbols. Each element must be one of the below. No two elements must be the same.
See the documentation of the function mfont_selection_priority() for details. |
|
The mfont_find() function returns a pointer to the available font that matches best the specification spec on frame frame. score, if not NULL, must point to a place to store the score value that indicates how well the found font matches to spec. A smaller score means a better match. |
|
The mfont_set_encoding() function sets the encoding information of font. If encoding_name is be a symbol representing a charset that has the same encoding as the font.
If repertory_name
|
|
The variable Mfoundry is a symbol of name |
|
The variable Mfamily is a symbol of name |
|
The variable Mweight is a symbol of name |
|
The variable Mstyle is a symbol of name |
|
The variable Mstretch is a symbol of name |
|
The variable Madstyle is a symbol of name |
|
The variable Mregistry is a symbol of name |
|
The variable Msize is a symbol of name |
|
The variable Mresolution is a symbol of name |
|
The variable The macro M17N_INIT() sets up this variable to contain the sub-directory "fonts" of the m17n database and the environment variable "M17NDIR". The first call of mframe() creates the internal list of the actually available fonts from this variable. Thus, an application program, if necessary, must modify the variable before calling mframe(). If it is going to add a new element, value must be a string that can be safely freed. If the m17n library is not configured to use the FreeType library, this variable is not used. |