From 13ed4405c558e445b052360f1ed8ee27ecf48e6e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 18 May 2009 02:14:37 -0400 Subject: [PATCH] [HB] A step closer to working ChainContext --- src/hb-ot-layout-gsubgpos-private.h | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos-private.h b/src/hb-ot-layout-gsubgpos-private.h index e82941e..0a7281d 100644 --- a/src/hb-ot-layout-gsubgpos-private.h +++ b/src/hb-ot-layout-gsubgpos-private.h @@ -156,12 +156,14 @@ struct Rule { private: inline bool apply (LOOKUP_ARGS_DEF, ContextLookupContext &context) const { - const LookupRecord *record = (const LookupRecord *) ((const char *) input + sizeof (input[0]) * (inputCount ? inputCount - 1 : 0)); + const LookupRecord *lookupRecord = (const LookupRecord *) + ((const char *) input + + sizeof (input[0]) * (inputCount ? inputCount - 1 : 0)); return context_lookup (LOOKUP_ARGS, inputCount, input, lookupCount, - record, + lookupRecord, context); } @@ -274,7 +276,9 @@ struct ContextFormat3 { private: inline bool apply_coverage (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { - const LookupRecord *record = (const LookupRecord *) ((const char *) coverage + sizeof (coverage[0]) * glyphCount); + const LookupRecord *lookupRecord = (const LookupRecord *) + ((const char *) coverage + + sizeof (coverage[0]) * glyphCount); struct ContextLookupContext context = { {match_coverage, apply_func}, (char *) this @@ -283,7 +287,7 @@ struct ContextFormat3 { glyphCount, (const USHORT *) (coverage + 1), lookupCount, - record, + lookupRecord, context); } @@ -346,14 +350,20 @@ struct ChainRule { private: inline bool apply (LOOKUP_ARGS_DEF, ChainContextLookupContext &context) const { - return false; -// const LookupRecord *record = (const LookupRecord *) ((const char *) input + sizeof (input[0]) * (inputCount ? inputCount - 1 : 0)); + const HeadlessArrayOf &input = * (const HeadlessArrayOf *) + ((const char *) &backtrack + backtrack.get_size ()); + const ArrayOf &lookahead = * (const ArrayOf *) + ((const char *) &input + input.get_size ()); + const LookupRecord &lookupRecord = * (const LookupRecord *) + ((const char *) &lookahead + lookahead.get_size ()); +// XXXXXXXXXXXXXXXXXX // return context_lookup (LOOKUP_ARGS, // inputCount, // input, // lookupCount, // record, // context); + return false; } @@ -482,12 +492,18 @@ struct ChainContextFormat3 { private: inline bool apply_coverage (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { -// const LookupRecord *record = (const LookupRecord *) ((const char *) coverage + sizeof (coverage[0]) * glyphCount); + const OffsetArrayOf &input = * (const OffsetArrayOf *) + ((const char *) &backtrack + backtrack.get_size ()); + const OffsetArrayOf &lookahead = * (const OffsetArrayOf *) + ((const char *) &input + input.get_size ()); + const LookupRecord &lookupRecord = * (const LookupRecord *) + ((const char *) &lookahead + lookahead.get_size ()); struct ChainContextLookupContext context = { {match_coverage, apply_func}, {(char *) this, (char *) this, (char *) this} }; /* + XXXXXXXXXXXXXXXXXXXXX return context_lookup (LOOKUP_ARGS, glyphCount, (const USHORT *) (coverage + 1), @@ -511,15 +527,15 @@ struct ChainContextFormat3 { private: USHORT format; /* Format identifier--format = 3 */ OffsetArrayOf - backtrackCoverage; /* Array of coverage tables + backtrack; /* Array of coverage tables * in backtracking sequence, in glyph * sequence order */ OffsetArrayOf - inputCoverageX ; /* Array of coverage + inputX ; /* Array of coverage * tables in input sequence, in glyph * sequence order */ OffsetArrayOf - lookaheadCoverageX; /* Array of coverage tables + lookaheadX; /* Array of coverage tables * in lookahead sequence, in glyph * sequence order */ ArrayOf -- 2.7.4