#include "mtext.h"
#include "symbol.h"
#include "plist.h"
+#include "internal-flt.h"
#include "internal-gui.h"
#include "font.h"
#include "face.h"
*/
-static int mdebug_mask = MDEBUG_FONT_FLT;
+static int mdebug_flag = MDEBUG_FONT_FLT;
MSymbol Mlayouter;
if (i < len)
return 0;
to = from + len;
- MDEBUG_PRINT3 ("\n [FLT] %*s(SEQ 0x%X", depth, "",
- rule->src.seq.codes[0]);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT3 ("\n [FLT] %*s(SEQ 0x%X", depth, "",
+ rule->src.seq.codes[0]);
}
else if (rule->src_type == SRC_RANGE)
{
return 0;
ctx->code_offset = head - rule->src.range.from;
to = from + 1;
- MDEBUG_PRINT4 ("\n [FLT] %*s(RANGE 0x%X-0x%X", depth, "",
- rule->src.range.from, rule->src.range.to);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT4 ("\n [FLT] %*s(RANGE 0x%X-0x%X", depth, "",
+ rule->src.range.from, rule->src.range.to);
}
else if (rule->src_type == SRC_REGEX)
{
NMATCH, pmatch, 0);
if (result == 0 && pmatch[0].rm_so == 0)
{
- MDEBUG_PRINT5 ("\n [FLT] %*s(REGEX \"%s\" \"%s\" %d", depth, "",
- rule->src.re.pattern,
- ctx->encoded + from - ctx->encoded_offset,
- pmatch[0].rm_eo);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT5 ("\n [FLT] %*s(REGEX \"%s\" \"%s\" %d", depth, "",
+ rule->src.re.pattern,
+ ctx->encoded + from - ctx->encoded_offset,
+ pmatch[0].rm_eo);
ctx->encoded[to - ctx->encoded_offset] = saved_code;
for (i = 0; i < NMATCH; i++)
{
if (from < 0)
return 0;
to = ctx->match_indices[rule->src.match_idx * 2 + 1];
- MDEBUG_PRINT3 ("\n [FLT] %*s(INDEX %d", depth, "", rule->src.match_idx);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT3 ("\n [FLT] %*s(INDEX %d", depth, "", rule->src.match_idx);
}
consumed = 0;
}
ctx->match_indices = saved_match_indices;
- MDEBUG_PRINT (")");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT (")");
return (rule->src_type == SRC_INDEX ? orig_from : to);
}
{
int i, pos = 0;
- MDEBUG_PRINT2 ("\n [FLT] %*s(COND", depth, "");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT2 ("\n [FLT] %*s(COND", depth, "");
depth++;
for (i = 0; i < cond->n_cmds; i++)
{
}
if (pos < 0)
MERROR (MERROR_DRAW, -1);
- MDEBUG_PRINT (")");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT (")");
return (pos);
}
#ifdef HAVE_OTF
int from_idx = gstring->used;
- MDEBUG_PRINT4 ("\n [FLT] %*s(OTF %s,%s)", depth, "",
- (! otf_cmd->features[MFONT_OTT_GSUB].str ? ""
- : otf_cmd->features[MFONT_OTT_GSUB].str),
- (! otf_cmd->features[MFONT_OTT_GPOS].str ? ""
- : otf_cmd->features[MFONT_OTT_GPOS].str));
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT4 ("\n [FLT] %*s(OTF %s,%s)", depth, "",
+ (! otf_cmd->features[MFONT_OTT_GSUB].str ? ""
+ : otf_cmd->features[MFONT_OTT_GSUB].str),
+ (! otf_cmd->features[MFONT_OTT_GPOS].str ? ""
+ : otf_cmd->features[MFONT_OTT_GPOS].str));
to = mfont__ft_drive_otf (gstring, from, to, otf_cmd);
if (ctx->cluster_begin_idx)
for (; from_idx < gstring->used; from_idx++)
g = *(MGLYPH (from - 1));
g.type = GLYPH_CHAR;
g.code = ctx->code_offset + id;
- MDEBUG_PRINT3 ("\n [FLT] %*s(DIRECT 0x%X", depth, "", g.code);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT3 ("\n [FLT] %*s(DIRECT 0x%X", depth, "", g.code);
if (ctx->combining_code)
g.combining_code = ctx->combining_code;
if (ctx->left_padding)
APPEND_GLYPH (gstring, g);
UPDATE_CLUSTER_RANGE (ctx, g);
ctx->code_offset = ctx->combining_code = ctx->left_padding = 0;
- MDEBUG_PRINT (")");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT (")");
return (from);
}
if (id <= CMD_ID_OFFSET_COMBINING)
{
ctx->combining_code = CMD_ID_TO_COMBINING_CODE (id);
- MDEBUG_PRINT3 ("\n [FLT] %*s(CMB %s)", depth, "",
- dump_combining_code (ctx->combining_code));
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT3 ("\n [FLT] %*s(CMB %s)", depth, "",
+ dump_combining_code (ctx->combining_code));
return from;
}
g.left_padding = ctx->left_padding;
APPEND_GLYPH (gstring, g);
UPDATE_CLUSTER_RANGE (ctx, g);
- MDEBUG_PRINT3 ("\n [FLT] %*s(COPY 0x%X)", depth, "", g.code);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT3 ("\n [FLT] %*s(COPY 0x%X)", depth, "", g.code);
ctx->code_offset = ctx->combining_code = ctx->left_padding = 0;
return (from + 1);
}
case CMD_ID_CLUSTER_BEGIN:
if (! ctx->cluster_begin_idx)
{
- MDEBUG_PRINT3 ("\n [FLT] %*s<%d", depth, "", MGLYPH (from)->pos);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT3 ("\n [FLT] %*s<%d", depth, "", MGLYPH (from)->pos);
ctx->cluster_begin_idx = gstring->used;
ctx->cluster_begin_pos = MGLYPH (from)->pos;
ctx->cluster_end_pos = MGLYPH (from)->to;
{
int i;
- MDEBUG_PRINT1 (" %d>", ctx->cluster_end_pos);
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT1 (" %d>", ctx->cluster_end_pos);
for (i = ctx->cluster_begin_idx; i < gstring->used; i++)
{
MGLYPH (i)->pos = ctx->cluster_begin_pos;
}
case CMD_ID_LEFT_PADDING:
- MDEBUG_PRINT2 ("\n [FLT] %*s[", depth, "");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT2 ("\n [FLT] %*s[", depth, "");
ctx->left_padding = 1;
return from;
case CMD_ID_RIGHT_PADDING:
if (gstring->used > 0)
{
- MDEBUG_PRINT2 ("\n [FLT] %*s]", depth, "");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT2 ("\n [FLT] %*s]", depth, "");
gstring->glyphs[gstring->used - 1].right_padding = 1;
}
return from;
from_pos = MGLYPH (from)->pos;
to_pos = MGLYPH (to)->pos;
+ if (MDEBUG_FLAG ())
+ {
+ MDEBUG_PRINT ("\n [FLT] (SOURCE");
+ for (i = from; i < to; i++)
+ MDEBUG_PRINT1 (" %04X", MGLYPH (i)->c);
+ MDEBUG_PRINT (")");
+ }
+
for (stage_idx = 0; 1; stage_idx++)
{
int len = to - from;
int result;
ctx.code_offset = ctx.combining_code = ctx.left_padding = 0;
- MDEBUG_PRINT2 ("\n [FLT] (STAGE %d \"%s\"", stage_idx, ctx.encoded);
- if (mdebug__flag & mdebug_mask
- && ctx.encoded_offset < to)
+ if (MDEBUG_FLAG () > 2)
{
- if (gstring->glyphs[ctx.encoded_offset].type == GLYPH_PAD)
- fprintf (stderr, " (|");
- else
- fprintf (stderr, " (%X", gstring->glyphs[ctx.encoded_offset].code);
- for (i = ctx.encoded_offset + 1; i < to; i++)
+ MDEBUG_PRINT2 ("\n [FLT] (STAGE %d \"%s\"", stage_idx, ctx.encoded);
+ if (ctx.encoded_offset < to)
{
- if (gstring->glyphs[i].type == GLYPH_PAD)
- fprintf (stderr, " |");
+ if (gstring->glyphs[ctx.encoded_offset].type == GLYPH_PAD)
+ fprintf (stderr, " (|");
else
- fprintf (stderr, " %X", gstring->glyphs[i].code);
+ fprintf (stderr, " (%X", gstring->glyphs[ctx.encoded_offset].code);
+ for (i = ctx.encoded_offset + 1; i < to; i++)
+ {
+ if (gstring->glyphs[i].type == GLYPH_PAD)
+ fprintf (stderr, " |");
+ else
+ fprintf (stderr, " %X", gstring->glyphs[i].code);
+ }
+ fprintf (stderr, ")");
}
- fprintf (stderr, ")");
}
gidx = gstring->used;
result = run_command (4, INDEX_TO_CMD_ID (0), gstring,
ctx.encoded_offset, to, &ctx);
- MDEBUG_PRINT (")");
+ if (MDEBUG_FLAG () > 2)
+ MDEBUG_PRINT (")");
if (result < 0)
return -1;
to = from + (gstring->used - gidx);
latest = glyphs[i];
}
}
- MDEBUG_PRINT ("\n [FLT] (RESULT (");
- if (mdebug__flag & mdebug_mask
- && ctx.encoded_offset < to)
+ if (MDEBUG_FLAG ())
{
- if (gstring->glyphs[from].type == GLYPH_PAD)
- fprintf (stderr, "|");
+ MDEBUG_PRINT ("\n [FLT] (RESULT");
+ if (MDEBUG_FLAG () > 1)
+ for (i = 0; from < to; from++, i++)
+ {
+ MGlyph *g;
+
+ if (i > 0 && i % 4 == 0)
+ MDEBUG_PRINT ("\n [FLT] ");
+ g = MGLYPH (from);
+ MDEBUG_PRINT4 (" (%04X %d %d %d)",
+ g->code, g->width, g->xoff, g->yoff);
+ }
else
- fprintf (stderr, "%X", gstring->glyphs[from].code);
- for (from++; from < to; from++)
- {
- if (gstring->glyphs[from].type == GLYPH_PAD)
- fprintf (stderr, " |");
- else
- fprintf (stderr, " %X", gstring->glyphs[from].code);
- }
- fprintf (stderr, "))");
+ for (; from < to; from++)
+ MDEBUG_PRINT1 (" %04X", MGLYPH (from)->code);
+ MDEBUG_PRINT ("))\n");
}
- MDEBUG_PRINT (")\n");
return to;
}