[HB] A step closer to working ChainContext

This commit is contained in:
Behdad Esfahbod 2009-05-18 02:14:37 -04:00
parent e8cbaaf6d5
commit 13ed4405c5
1 changed files with 26 additions and 10 deletions

View File

@ -156,12 +156,14 @@ struct Rule {
private: private:
inline bool apply (LOOKUP_ARGS_DEF, ContextLookupContext &context) const { 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, return context_lookup (LOOKUP_ARGS,
inputCount, inputCount,
input, input,
lookupCount, lookupCount,
record, lookupRecord,
context); context);
} }
@ -274,7 +276,9 @@ struct ContextFormat3 {
private: private:
inline bool apply_coverage (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { 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 = { struct ContextLookupContext context = {
{match_coverage, apply_func}, {match_coverage, apply_func},
(char *) this (char *) this
@ -283,7 +287,7 @@ struct ContextFormat3 {
glyphCount, glyphCount,
(const USHORT *) (coverage + 1), (const USHORT *) (coverage + 1),
lookupCount, lookupCount,
record, lookupRecord,
context); context);
} }
@ -346,14 +350,20 @@ struct ChainRule {
private: private:
inline bool apply (LOOKUP_ARGS_DEF, ChainContextLookupContext &context) const { inline bool apply (LOOKUP_ARGS_DEF, ChainContextLookupContext &context) const {
return false; const HeadlessArrayOf<USHORT> &input = * (const HeadlessArrayOf<USHORT> *)
// const LookupRecord *record = (const LookupRecord *) ((const char *) input + sizeof (input[0]) * (inputCount ? inputCount - 1 : 0)); ((const char *) &backtrack + backtrack.get_size ());
const ArrayOf<USHORT> &lookahead = * (const ArrayOf<USHORT> *)
((const char *) &input + input.get_size ());
const LookupRecord &lookupRecord = * (const LookupRecord *)
((const char *) &lookahead + lookahead.get_size ());
// XXXXXXXXXXXXXXXXXX
// return context_lookup (LOOKUP_ARGS, // return context_lookup (LOOKUP_ARGS,
// inputCount, // inputCount,
// input, // input,
// lookupCount, // lookupCount,
// record, // record,
// context); // context);
return false;
} }
@ -482,12 +492,18 @@ struct ChainContextFormat3 {
private: private:
inline bool apply_coverage (LOOKUP_ARGS_DEF, apply_lookup_func_t apply_func) const { 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<Coverage> &input = * (const OffsetArrayOf<Coverage> *)
((const char *) &backtrack + backtrack.get_size ());
const OffsetArrayOf<Coverage> &lookahead = * (const OffsetArrayOf<Coverage> *)
((const char *) &input + input.get_size ());
const LookupRecord &lookupRecord = * (const LookupRecord *)
((const char *) &lookahead + lookahead.get_size ());
struct ChainContextLookupContext context = { struct ChainContextLookupContext context = {
{match_coverage, apply_func}, {match_coverage, apply_func},
{(char *) this, (char *) this, (char *) this} {(char *) this, (char *) this, (char *) this}
}; };
/* /*
XXXXXXXXXXXXXXXXXXXXX
return context_lookup (LOOKUP_ARGS, return context_lookup (LOOKUP_ARGS,
glyphCount, glyphCount,
(const USHORT *) (coverage + 1), (const USHORT *) (coverage + 1),
@ -511,15 +527,15 @@ struct ChainContextFormat3 {
private: private:
USHORT format; /* Format identifier--format = 3 */ USHORT format; /* Format identifier--format = 3 */
OffsetArrayOf<Coverage> OffsetArrayOf<Coverage>
backtrackCoverage; /* Array of coverage tables backtrack; /* Array of coverage tables
* in backtracking sequence, in glyph * in backtracking sequence, in glyph
* sequence order */ * sequence order */
OffsetArrayOf<Coverage> OffsetArrayOf<Coverage>
inputCoverageX ; /* Array of coverage inputX ; /* Array of coverage
* tables in input sequence, in glyph * tables in input sequence, in glyph
* sequence order */ * sequence order */
OffsetArrayOf<Coverage> OffsetArrayOf<Coverage>
lookaheadCoverageX; /* Array of coverage tables lookaheadX; /* Array of coverage tables
* in lookahead sequence, in glyph * in lookahead sequence, in glyph
* sequence order */ * sequence order */
ArrayOf<LookupRecord> ArrayOf<LookupRecord>