1 /***@page m17nDatabaseFormat Data format of the m17n database
3 @section dbformat General format
5 The mdatabase_load () function returns the data specified by tags in
6 the form of plist if the first tag is not @c Mchartable nor @c
7 Mcharset. The keys of the returned plist are limited to
8 <tt>Minteger</tt>, <tt>Msymbol</tt>, <tt>Mtext</tt>, and
9 <tt>Mplist</tt>. The type of the value is unambiguously determined by
10 the corresponding key. If the key is <tt>Minteger</tt>, the value is
11 an integer. If the key is <tt>Msymbol</tt>, the value is a symbol.
14 A number of expressions are possible to represent a plist. For
15 instance, we can use the form <tt>(K1:V1, K2:V2, ..., Kn:Vn)</tt> to
16 represent a plist whose first property key and value are K1 and V1,
17 second key and value are K2 and V2, and so on. However, we can use a
18 simpler expression here because the types of plists used in the m17n
19 database are fairly restricted.
21 Hereafter, we use an expression, which is similar to S-expression, to
22 represent a plist. (Actually, the default database loader of the m17n
23 library is designed to read data files written in this expression.)
25 The expression consists of one or more <i>elements</i>. Each element
26 represents a property, i.e. a single element of a plist.
28 Elements are separated by one or more <i>whitespaces</i>, i.e. a space
29 (code 32), a tab (code 9), or a newline (code 10). Comments begin
30 with a semicolon (<tt>;</tt>) and extend to the end of the line.
32 The key and the value of each property are determined based on the
33 type of the element as explained below.
39 An element that matches the regular expression <tt>-?[0-9]+</tt> or
40 <tt>0[xX][0-9A-Fa-f]+</tt> represents a property whose key is
41 <tt>Minteger</tt>. An element matching the former expression is
42 interpreted as an integer in decimal notation, and one matching the
43 latter is interpreted as an integer in hexadecimal notation. The
44 value of the property is the result of interpretation.
46 For instance, the element <tt>0xA0</tt> represents a property whose value is
51 An element that matches the regular expression
52 <tt>[^-0-9(]([^\\()]|\\.)+</tt> represents a property whose key is
53 <tt> Msymbol</tt>. In the element, <tt>\\t</tt>, <tt>\\n</tt>,
54 <tt>\\r</tt>, and <tt>\\e</tt> are replaced with tab (code 9), newline
55 (code 10), carriage return (code 13), and escape (code 27)
56 respectively. Other characters following a backslash is interpreted
57 as it is. The value of the property is the symbol having the
58 resulting string as its name.
60 For instance, the element <tt>abc\ def</tt> represents a property
61 whose value is the symbol having the name "abc def".
65 An element that matches the regular expression <tt>"([^"]|\\")*"</tt>
66 represents a property whose key is <tt>Mtext</tt>. The backslash escape
67 explained above also applies here. Moreover, each part in the
68 element matching the regular expression <tt>
69 \\[xX][0-9A-Fa-f][0-9A-Fa-f]</tt> is replaced with its hexadecimal
72 After having resolved the backslash escapes, the byte sequence between
73 the double quotes is interpreted as a UTF-8 sequence and decoded into
74 an M-text. This M-text is the value of the property.
78 Zero or more elements surrounded by a pair of parentheses represent a
79 property whose key is <tt>Mplist</tt>. Whitespaces before and after a
80 parenthesis can be omitted. The value of the property is a plist,
81 which is the result of recursive interpretation of the elements
82 between the parentheses.
88 Here is an example of plist that is written in the expression
92 abc 123 (pqr 0xff) "m\"text" (_\\_ ("string" xyz) -456)
95 It represents the following plist:
104 Mplist:(Mtext:string,
109 @section fontenc Font Encoding
111 The m17n library loads information about the encoding of each font
112 form the m17n database by the tags \<font, encoding\>. The plist
113 format of the data is as follows:
120 '(' FONT-SPEC ENCODING ')'
124 [ FOUNDRY FAMILY [ WEIGHT [ STYLE [ STRETCH [ ADSTYLE ] ] ] ] ] REGISTRY
128 @c FOUNDRY to @c REGISTRY are symbols specifying the corresponding
129 XLFD font name fields. Omitted symbols are regarded as @c nil, and
130 @c nil means a wild card. For instance, this @c FONT-SPEC:
133 (nil alice0\ lao iso8859-1)
136 should be applied to all fonts whose family is "alice0 lao", and
137 registry is "iso8859-1".
139 @c ENCODING is a symbol representing a charset. A font matching @c
140 FONT-SPEC supports all characters of the charset, and a character code
141 is mapped to the corresponding glyph code of the font by this charset.
144 @section fontsize Font Resizing
146 In some case, a font contains incorrect information about its size
147 (typically in the case of a hacked TrueType font), which results in a
148 bad text layout when such a font is used in combination with the other
149 fonts. To overcome this problem, the m17n library loads information
150 about font-size correction from the m17n database by the tags \<font,
151 resize\>. The plist format of the data is as follows:
158 '(' FONT-SPEC RESIZE-RATIO ')'
162 [ FOUNDRY FAMILY [ WEIGHT [ STYLE [ STRETCH [ ADSTYLE ] ] ] ] ] REGISTRY
166 The meanings of @c FOUNDRY to @c REGISTRY are the same as @e Font @e
167 Encoding. @c RESIZE-RATIO is an integer number specifying by
168 percentage how much the font-size must be adjusted. For instance,
169 this @c PER-FONT-INFO:
172 ((devanagari-cdac) 150)
175 means that, to use a font of registry "devanagari-cdac" with a
176 specific size, we have to open an 1.5 times bigger one.
178 @section fontset Fontset
180 The m17n library loads a fontset definition from the m17n database by
181 the tags \<fontset, FONTSET-NAME\>. The plist format of the data is
186 PER-SCRIPT * PER-CHARSET * FALLBACK *
189 '(' SCRIPT PER-LANGUAGE + ')'
192 '(' LANGUAGE FONT-SPEC-ELEMENT + ')'
195 '(' CHARSET FONT-SPEC-ELEMENT + ')'
200 FONT-SPEC-ELEMENT ::=
201 '(' FONT-SPEC [ FLT-NAME ] ')'
205 [ FOUNDRY FAMILY [ WEIGHT [ STYLE [ STRETCH [ ADSTYLE ] ] ] ] ] REGISTRY
209 @c SCRIPT is a symbol of script name (e.g. latin, han) or @c nil. @c
210 LANGUAGE is a two-letter symbol of language name code defined by ISO
211 639 (e.g. ja, zh) or @c nil. The meanings of @c FOUNDRY to @c
212 REGISTRY are the same as @e Font @e Encoding. @c FLT-NAME is a name
215 For instance, this @c PER_SCRIPT:
227 instructs the rendering engine to use a font of registry
228 "jisx0208.1983-0" for a "han" character that has @c Mlanguage text
229 propert "ja" if the character is in the repertories of such fonts.
230 Otherwise, try a font of registry "gb2312.1980-0" or "big5-0". If a
231 "han" character does not have @c Mlangauge text property, try all
234 @section flt Font Layout Table
236 Usually, the rendering engine converts character codes of into glyph
237 codes one by one by consulting information about encoding of each
238 selected font. But, for rendering a text that requires complicated
239 layouting (e.g. Thai and Indic), such an one to one conversion is not
240 sufficient. In addition, some glyphs must be shifted 2-dimensionally
241 on the screen. For such a case, a font layout table (FLT in short)
244 A FLT can contain the information equivarent to OpenType Layout Table
245 (CMAP, GSUB, and GPOS) in addition to the information about how to
246 extract a grapheme cluster and how to re-order characters.
248 The m17n library loads a FLT from the m17n database by the tags
249 \<font, layouter, FLT-NAME\>. The plist format of the data is as
254 @section im Input Method