@brief FLT support for a window system.
This section defines the m17n FLT API concerning character
- layouting facility using FLT (Font Layout Table). FLT
-
-
-*/
+ layouting facility using FLT (Font Layout Table). */
/*=*/
static int mdebug_flag = MDEBUG_FONT_FLT;
-MSymbol Mfont, Mlayouter;
+MSymbol Mfont, Mlayouter, Mcombining;
static MSymbol Mgenerator, Mend;
#define CMD_ID_TO_INDEX(id) (CMD_ID_OFFSET_INDEX - (id))
#define INDEX_TO_CMD_ID(idx) (CMD_ID_OFFSET_INDEX - (idx))
-static MSymbol Mcond, Mrange, Mfont_has;
+static MSymbol Mcond, Mrange, Mfont_facility;
#define GLYPH_CODE_P(code) \
((code) >= GLYPH_CODE_MIN && (code) <= GLYPH_CODE_MAX)
SRC_INDEX,
SRC_SEQ,
SRC_RANGE,
- SRC_EXIST
+ SRC_HAS_GLYPH,
+ SRC_OTF_SPEC
};
typedef struct
struct {
int from, to;
} range;
- struct {
- int c;
- } exist;
+ int supported_glyph;
+ MFLTOtfSpec otf_spec;
} src;
int n_cmds;
/* PLIST ::= ( cond ... ) | ( STRING ... ) | ( INTEGER ... )
| ( ( INTEGER INTEGER ) ... )
| ( ( range INTEGER INTEGER ) ... )
- | ( ( exist INTEGER ) ... ) */
+ | ( ( font-facilty [ INTEGER ] ) ... )
+ | ( ( font-facilty OTF-SPEC ) ... ) */
MPlist *elt = MPLIST_PLIST (plist);
int len = MPLIST_LENGTH (elt) - 1;
FontLayoutCmd *cmd;
}
else if (MPLIST_SYMBOL_P (pl) && size <= 2)
{
- if (MPLIST_SYMBOL (pl) != Mfont_has)
+ if (MPLIST_SYMBOL (pl) != Mfont_facility)
MERROR (MERROR_FLT, INVALID_CMD_ID);
- cmd->body.rule.src_type = SRC_EXIST;
- if (size == 1)
- cmd->body.rule.src.exist.c = -1;
+ pl = MPLIST_NEXT (pl);
+ if (MPLIST_SYMBOL_P (pl))
+ {
+ MSymbol sym = MPLIST_SYMBOL (pl);
+ char *otf_spec = MSYMBOL_NAME (sym);
+
+ if (otf_spec[0] == ':' && otf_spec[1] == 'o'
+ && otf_spec[2] == 't' && otf_spec[3] == 'f')
+ parse_otf_command (sym, &cmd->body.rule.src.otf_spec);
+ else
+ MERROR (MERROR_FLT, INVALID_CMD_ID);
+ cmd->body.rule.src_type = SRC_OTF_SPEC;
+ }
else
{
- pl = MPLIST_NEXT (pl);
- if (! MPLIST_INTEGER_P (pl))
- MERROR (MERROR_DRAW, INVALID_CMD_ID);
- cmd->body.rule.src.exist.c = MPLIST_INTEGER (pl);
+ cmd->body.rule.src_type = SRC_HAS_GLYPH;
+ if (MPLIST_INTEGER_P (pl))
+ cmd->body.rule.src.supported_glyph
+ = MPLIST_INTEGER (pl);
+ else
+ cmd->body.rule.src.supported_glyph = -1;
}
}
else
if (MDEBUG_FLAG () > 2)
MDEBUG_PRINT3 ("\n [FLT] %*s(INDEX %d", depth, "", rule->src.match_idx);
}
- else if (rule->src_type == SRC_EXIST)
+ else if (rule->src_type == SRC_HAS_GLYPH)
{
int encoded;
unsigned code;
- if (rule->src.exist.c < 0)
+ if (rule->src.supported_glyph < 0)
{
if (from >= to)
return 0;
}
else
{
- code = rule->src.exist.c;
+ code = rule->src.supported_glyph;
to = from;
encoded = 0;
}
return 0;
}
}
+ else if (rule->src_type == SRC_OTF_SPEC)
+ {
+ MFLTOtfSpec *spec = &rule->src.otf_spec;
+
+ if (! ctx->font->check_otf)
+ {
+ if ((spec->features[0] && spec->features[0][0] != 0xFFFFFFFF)
+ || (spec->features[1] && spec->features[1][0] != 0xFFFFFFFF))
+ return 0;
+ }
+ else if (! ctx->font->check_otf (ctx->font, spec))
+ return 0;
+ }
consumed = 0;
depth++;
return to;
}
-static int
-combining_code_from_class (int class)
-{
- int code;
-
- if (class < 200)
- code = MAKE_COMBINING_CODE (3, 1, 3, 1, 128, 128);
- else if (class == 200) /* below left attached */
- code = MAKE_COMBINING_CODE (2, 0, 0, 1, 128, 128);
- else if (class == 202) /* below attached*/
- code = MAKE_COMBINING_CODE (2, 1, 0, 1, 128, 128);
- else if (class == 204) /* below right attached */
- code = MAKE_COMBINING_CODE (2, 2, 0, 1, 128, 128);
- else if (class == 208) /* left attached */
- code = MAKE_COMBINING_CODE (3, 0, 3, 2, 128, 128);
- else if (class == 210) /* right attached */
- code = MAKE_COMBINING_CODE (3, 2, 3, 0, 128, 128);
- else if (class == 212) /* above left attached */
- code = MAKE_COMBINING_CODE (0, 0, 2, 1, 128, 128);
- else if (class == 214) /* above attached */
- code = MAKE_COMBINING_CODE (0, 1, 2, 1, 128, 128);
- else if (class == 216) /* above right attached */
- code = MAKE_COMBINING_CODE (0, 2, 2, 1, 128, 128);
- else if (class == 218) /* below left */
- code = MAKE_COMBINING_CODE (2, 0, 0, 1, 122, 128);
- else if (class == 220) /* below */
- code = MAKE_COMBINING_CODE (2, 1, 0, 1, 122, 128);
- else if (class == 222) /* below right */
- code = MAKE_COMBINING_CODE (2, 2, 0, 1, 122, 128);
- else if (class == 224) /* left */
- code = MAKE_COMBINING_CODE (3, 0, 3, 2, 128, 122);
- else if (class == 226) /* right */
- code = MAKE_COMBINING_CODE (3, 2, 3, 0, 128, 133);
- else if (class == 228) /* above left */
- code = MAKE_COMBINING_CODE (0, 0, 2, 1, 133, 128);
- else if (class == 230) /* above */
- code = MAKE_COMBINING_CODE (0, 1, 2, 1, 133, 128);
- else if (class == 232) /* above right */
- code = MAKE_COMBINING_CODE (0, 2, 2, 1, 133, 128);
- else if (class == 233) /* double below */
- code = MAKE_COMBINING_CODE (2, 2, 0, 2, 122, 128);
- else if (class == 234) /* double above */
- code = MAKE_COMBINING_CODE (0, 2, 2, 2, 133, 128);
- else if (class == 240) /* iota subscript */
- code = MAKE_COMBINING_CODE (2, 1, 0, 1, 122, 128);
- else /* unknown */
- code = MAKE_COMBINING_CODE (3, 1, 3, 1, 128, 128);
- return code;
-}
-
static void
setup_combining_coverage (int from, int to, void *val, void *arg)
{
Mrange = msymbol ("range");
Mfont = msymbol ("font");
Mlayouter = msymbol ("layouter");
- Mfont_has = msymbol ("font-has");
+ Mcombining = msymbol ("combining");
+ Mfont_facility = msymbol ("font-facility");
Mgenerator = msymbol ("generator");
Mend = msymbol ("end");
flt = mplist_get (flt_list, name);
if (! flt || ! CHECK_FLT_STAGES (flt))
return NULL;
- if (flt->name == Mt
+ if (flt->name == Mcombining
&& ! mchartable_lookup (flt->coverage, 0))
setup_combining_flt (flt);
|| (spec->features[1] && spec->features[1][0] != 0xFFFFFFFF))
continue;
}
- else if (! font->check_otf (font, &flt->otf))
+ else if (! font->check_otf (font, spec))
continue;
return flt;
}