Logo Search packages:      
Sourcecode: yudit version File versions

bool SFontTTF::doContextSubstitutions ( SS_GlyphIndex *  ino,
unsigned int  inlen,
unsigned int *  olen,
const char *  script,
const char *  feature 
) [protected]

Chaining Context Substitution may not change the length of the input.

Parameters:
ino is the input/output array.
inlen is the length of the ino array.
olen is the new length of the ino array.
script is the OTF script code - or null.
feature is the OTF feature code - or null.
Returns:
true if at least one substitution has been made.

Definition at line 2104 of file SFontTTF.cpp.

References getOTFLigature().

Referenced by findGlyphs().

{
  unsigned int i;
  unsigned int len = inlen;
  *olen = len;
  for (i=0; i<len; i++)
  {
    if (ino[i] == 0) return false;
  }
  unsigned int curin=0;

  // We have our limitattions: it can not increase the glyphs.
  SS_GlyphIndex* lig = new SS_GlyphIndex[len];
  bool isok = false;
  while (curin < len)
  {
    if (len-curin < 2) break;

    // Substitute from curin till the end of the input array. 
    unsigned int nind = 
      getOTFLigature (script, feature, &ino[curin], len-curin, lig, 6);
    if (nind == 0)
    {
      curin++;
      continue;
    }
    /* copy output */
    isok = true;
    for (i=0; i<nind; i++)
    {
      ino[i+curin] = lig[i];
    }
    len = nind + curin;
    curin++;
  }
  delete [] lig;
  *olen = len;
  return isok;
}


Generated by  Doxygen 1.6.0   Back to index