Fix the handling of LAM-ALEF.
[m17n/m17n-db.git] / FORMATS / FLT.txt
index c58b8de..a90be42 100644 (file)
@@ -41,8 +41,9 @@ glyph code.
 
 <li> category
 
-This is the category code defined in the @c CATEGORY-TABLE
-of the current stage.
+The category code defined in the @c CATEGORY-TABLE of the current
+stage, or defined in the one of the former stages and not overwritten
+by later stages.
 
 <li> combining-spec
 
@@ -65,21 +66,20 @@ overlap with the next one.
 
 When the layout engine draws text, it at first determines a font and
 an FLT for each character in the text.  For each subsequence of
-characters that use use the same font and FLT, the layout engine
-generates an intermediate glyph sequence from the character
-subsequence.  Each element in the intermediate glyph sequence
-has the corresponding character code as the code attribute and zeroes
-for other attributes.  This sequence is processed in the
+characters that use the same font and FLT, the layout engine generates
+a corresponding intermediate glyph sequence.  The code attribute of
+each element in the intermediate glyph sequence is its character code,
+and all other attributes are zeros.  This sequence is processed in the
 first stage of FLT as the current @e run (substring).
 
 Each stage works as follows.
 
-At first, if the stage has a @c CATEGORY-TABLE, the category of each glyph
-in the current run is updated.  If there is a glyph that has no category,
-the current run ends before that glyph.
+At first, if the stage has a @c CATEGORY-TABLE, the category of each
+glyph in the current run is updated.  If there is a glyph that has no
+category, the current run ends before that glyph.
 
-Then, the default values of code-offset, combining-spec, and left-padding-flag
-of this stage are initialized to zero.
+Then, the default values of code-offset, combining-spec, and
+left-padding-flag of this stage are initialized to zero.
 
 Next, the initial conversion rule of the stage is applied to the
 current run.
@@ -95,15 +95,15 @@ The m17n library loads an FLT from the m17n database using the tag
 @verbatim
 FONT-LAYOUT-TABLE ::= FLT-DECLARATION ? STAGE0 STAGE *
 
-FLT-DECLARATION ::= '(' 'font' 'layouter' NAME nil PROP * ')'
-NAME ::= SYMBOL
+FLT-DECLARATION ::= '(' 'font' 'layouter' FLT-NAME nil PROP * ')'
+FLT-NAME ::= SYMBOL
 PROP :: = VERSION | FONT
 VERSION ::= '(' 'version' MTEXT ')'
 FONT ::= '(' 'font' FONT-SPEC ')'
 FONT-SPEC ::=
-     '(' [ FOUNDRY FAMILY
+     '(' [[ FOUNDRY FAMILY
            [ WEIGHT [ STYLE [ STRETCH [ ADSTYLE ]]]]]
-         REGISTRY
+         REGISTRY ]
         [ OTF-SPEC ] [ LANG-SPEC ] ')'
 
 STAGE0 ::= CATEGORY-TABLE GENERATOR
@@ -125,7 +125,7 @@ CATEGORY is ASCII code of an upper or lower letter, i.e. one of 'A',
 ... 'Z', 'a', .. 'z'.
 
 The first form of @c CATEGORY-SPEC assigns @c CATEGORY to a glyph
-whose code @c CODE.  The second form assigns @c CATEGORY to glyphs
+whose code is @c CODE.  The second form assigns @c CATEGORY to glyphs
 whose code falls between the two @c CODEs.
 
 @verbatim
@@ -138,10 +138,10 @@ RULE ::= REGEXP-BLOCK | MATCH-BLOCK | SUBST-BLOCK | COND-BLOCK
 MACOR-DEF ::= '(' MACRO-NAME RULE + ')'
 @endverbatim
 
-Each @c RULE specifies glyphs to be consumed and glyphs to be produced.  When
-some glyphs are consumed, they are taken away from the current run.  A
-rule may fail in some condition.  If not described explicitly to
-fail, it should be regarded that the rule succeeds.
+Each @c RULE specifies glyphs to be consumed and glyphs to be
+produced.  When some glyphs are consumed, they are taken away from the
+current run.  A rule may fail in some condition.  If not described
+explicitly to fail, it should be regarded that the rule succeeds.
 
 @verbatim
 DIRECT-CODE ::= INTEGER
@@ -192,15 +192,14 @@ No glyph is consumed.  No glyph is produced.
 
 <li> @c @]
 
-This rule changes the right-padding-flag of the lastly generated
-glyph to 1.
-No glyph is consumed.  No glyph is produced.
+This rule changes the right-padding-flag of the lastly generated glyph
+to 1.  No glyph is consumed.  No glyph is produced.
 
 <li> @c |
 
 This rule consumes no glyph and produces a special glyph whose
-category is ' ' and other attributes are zero.  
-This is the only rule that produces that special glyph.
+category is ' ' and other attributes are zero.  This is the only rule
+that produces that special glyph.
 
 </ul>
 
@@ -261,11 +260,11 @@ If no match is found, this rule fails.
 
 @verbatim
 FONT-FACILITY-BLOCK ::= '(' FONT-FACILITY RULE * ')'
-FONT-FACILITY = '(' font-facility' CHARACTER * ')'
+FONT-FACILITY = '(' 'font-facility' CODE * ')'
                | '(' 'font-facility' FONT-SPEC ')'
 @endverbatim
 
-If the current font has glyphs for @c CHARACTERs or matches with
+If the current font has glyphs for @c CODEs or matches with @c
 FONT-SPEC, this rule succeeds and @c RULEs are executed.  Otherwise,
 this rule fails.
 
@@ -276,6 +275,7 @@ COND-BLOCK ::= '(' 'cond' RULE + ')'
 This rule sequentially executes @c RULEs until one succeeds.  If no
 rule succeeds, this rule fails.  Otherwise, it succeeds.
 
+@anchor OTF-SPEC
 @verbatim
 OTF-SPEC ::= SYMBOL
 @endverbatim
@@ -284,7 +284,7 @@ OTF-SPEC ::= SYMBOL
 driver.  The name has the following syntax.
 
 @verbatim
-  OTF-SPEC-NAME ::= 'otf:' SCRIPT LANGSYS ? GSUB-FEATURES ? GPOS-FEATURES ?
+  OTF-SPEC-NAME ::= ':otf=' SCRIPT LANGSYS ? GSUB-FEATURES ? GPOS-FEATURES ?
 
   SCRIPT ::= SYMBOL
 
@@ -308,12 +308,16 @@ For @c LANGSYS, @c SYMBOL specifies a Language System tag name.  If @c
 LANGSYS is omitted, the Default Language System
 table is used.
 
-For @c GSUB-FEATURES, each @c SYMBOL in @c FEATURE LIST specifies a GSUB Feature tag name
-to apply.  '*' is allowed as the last item to specify all remaining
-features.  If @c SYMBOL is preceded by '~' and the last item is '*',
-@c SYMBOL is excluded from the features to apply.  If no @c SYMBOL is
-specified, no GSUB feature is applied.  If @c GSUB-FEATURES itself is
-omitted, all GSUB features are applied.
+For @c GSUB-FEATURES, each @c SYMBOL in @c FEATURE-LIST specifies 
+a GSUB Feature tag name to apply.  '*' is allowed as the last item to
+specify all remaining features.  If @c SYMBOL is preceded by '~' and
+the last item is '*', @c SYMBOL is excluded from the features to
+apply.  If no @c SYMBOL is specified, no GSUB feature is applied.  If
+@c GSUB-FEATURES itself is omitted, all GSUB features are applied.
+
+When @c OTF-SPEC appears in a @c FONT-SPEC, @c FEATURE-LIST specifies
+features that the font must have (or must not have if preceded by
+'~'), and the last'*', even if exists, has no meaning.
 
 The specification of @c GPOS-FEATURES is analogous to that of @c
 GSUB-FEATURES.
@@ -327,10 +331,10 @@ See the following page for the OpenType specification.\n
 COMBINING ::= SYMBOL
 @endverbatim
 
-@c COMBINING is a symbol whose name specifies how
-to combine the next glyph with the previous one.  This rule sets the
-default combining-spec to an integer code that is unique to the symbol
-name.  The name has the following syntax.
+@c COMBINING is a symbol whose name specifies how to combine the next
+glyph with the previous one.  This rule sets the default
+combining-spec to an integer code that is unique to the symbol name.
+The name has the following syntax.
 
 @verbatim
   COMBINING-NAME ::= VPOS HPOS OFFSET VPOS HPOS
@@ -368,9 +372,10 @@ as described below.
 
 The left figure shows 12 reference points of a glyph by numbers 0 to
 11.  The rectangle 0-6-8-2 is the bounding box of the glyph, the
-positions 3, 4, and 5 are on the baseline, 9 and 11 are on the center
-of the lines 0-6 and 2-8 respectively, 1, 10, 4, and 7 are on the
-center of the lines 1-2, 3-5, 9-11, and 6-8 respectively.
+positions 3, 4, and 5 are on the baseline, 9-11 are on the vertical
+center of the box, 0-2 and 6-8 are on the top and on the bottom
+respectively.  1, 10, 4, and 7 are on the horizontal center of the
+box.
 
 The right table shows how those reference points are specified by a
 pair of @c VPOS and @c HPOS.
@@ -385,7 +390,7 @@ The next glyph is drawn so that these two reference points align.
 reference points are on the same position.
 
 @c XOFF specifies how much the X position of the reference point of
-the next glyph should be shifted to the right ('<') or left ('>') from
+the next glyph should be shifted to the left ('<') or right ('>') from
 the previous reference point.
 
 @c YOFF specifies how much the Y position of the reference point the
@@ -405,7 +410,7 @@ MACRO-NAME ::= SYMBOL
 @endverbatim
 
 @c MACRO-NAME is a symbol that appears in one of @c MACRO-DEF.  It is
-exapanded to the sequence of the correponding @c RULEs.
+exapanded to the sequence of the corresponding @c RULEs.
 
 @section flt-context-dependent CONTEXT DEPENDENT BEHAVIOR