Logo Search packages:      
Sourcecode: yudit version File versions

bool SFontTTF::getPositions ( int  feature,
const SS_GlyphIndex *  gv,
unsigned int  gvsize,
const char *  _featurelist,
const char *  _script,
int *  xpos,
int *  ypos 
) [protected]

Get the positions

Parameters:
basewidth is used only if advanced is set.

Definition at line 2520 of file SFontOTF.cpp.

References SBinHashtable< Type >::get(), SBinHashtable< Type >::put(), SBinVector< Type >::remove(), SBinVector< Type >::size(), and SVector< BType >::size().

Referenced by getOTFMarkToBase(), getOTFMarkToMark(), and gpos().

{

  GPOS_HEAD* gposh = (GPOS_HEAD*) tables[SS_TB_GPOS];
  if (gposh == 0 || ntohl (gposh->version) != 0x00010000)
  {
    return false;
  }
  /* filtering features */
  bool nonfeature = false;
  SBinHashtable<int> features;
  if (_featurelist != 0 && _featurelist[0] != 0 && _featurelist[1] != 0)
  {
    SString f = SString(_featurelist);
    if (f[0] == '!')
    {
      nonfeature = true;
      f.remove (0);
    }
    SStringVector v(f);
    for (unsigned int i=0; i<v.size(); i++)
    {
      SString s(v[i]);
      if (s.size()==4)
      {
        features.put (s, 1);
      }
    }
  }

  int ofeat = ntohs(gposh->featureList);
  OTF_FeatureList*  featureList = (OTF_FeatureList*) ((SD_BYTE*)gposh + ofeat);
  SD_USHORT fcount = ntohs (featureList->count);
  int olookup = ntohs(gposh->lookupList);
  OTF_LookupList*  lookupList = (OTF_LookupList*) ((SD_BYTE*)gposh + olookup);
  //SD_USHORT lcount = ntohs (lookupList->count);

  if (_script == 0)
  {
    for (unsigned int i=0; i< fcount; i++)
    {
       SString tag (featureList->record[i].tag, 4);
       debugTag = tag;
       SD_USHORT loffset = ntohs (featureList->record[i].offset);
       /* got or not omitted */
       if (_featurelist)
       {
         if (nonfeature)
         {
           if (features.get(tag)) continue;
         }
         else
         {
           if (!features.get(tag)) continue;
         }
       }
       OTF_Feature* feat = (OTF_Feature*) ((char*)featureList+loffset);
       if (processGPOSFeature(name, feat, feature, 
             lookupList, gv, gvsize, xpos, ypos)) return true;
    }
    return false;
  }
  unsigned int next = 0; /* iterator - just in case we have same lang twice */
  SString script (_script);
  OTF_LangSys* lsys = 0;
  /* HACK! getNextOTFLanguageSystem is using GSUB_HEAD* scriptList only
    this is why we can cast our GPOS* to GSUB* */
  while ((lsys = getNextOTFLanguageSystem (name, 
       (GSUB_HEAD*) gposh, script, &next))!=0)
  {
    SD_USHORT fcount = ntohs (lsys->featureCount);
    /* index lookupList through lsys->featureIndex */
    SD_USHORT lorder = ntohs (lsys->lookupOrder);
    if (lorder != 0)
    {
      static bool warned = false;
      if (!warned)
      {
#if PRINT_UNSUPPORTED
        fprintf (stderr, 
          "LanguageSystem lookup order %u not supported",
          (unsigned int) lorder);
        fprintf (stderr, " in %*.*s.\n", SSARGS(name));
#endif
        warned = true;
      }
      continue;
    }
    for (unsigned int i=0; i< fcount; i++)
    {
      unsigned int index = ntohs (lsys->featureIndex[i]) ;
      SString tag (featureList->record[index].tag, 4);
      if (_featurelist)
      {
        if (nonfeature)
        {
          if (features.get(tag)) continue;
        }
        else
        {
          if (!features.get(tag)) continue;
        }
      }
      SD_USHORT loffset = ntohs (featureList->record[index].offset);
      /* tags will have mystic ligature names and stuff like that - 
         don't check */
      OTF_Feature* feat = (OTF_Feature*) ((char*)featureList+loffset);
      if (processGPOSFeature(name, feat, feature,
              lookupList, gv, gvsize, xpos, ypos)) return true;
    }
  }
  return false;
}


Generated by  Doxygen 1.6.0   Back to index