Logo Search packages:      
Sourcecode: yudit version File versions

bool SFontTTF::width ( const SS_Matrix2D m,
SS_UCS4  _uch,
double *  width_ 

Return the advacnce width of the glyphs The value is the value that is multipied with matrix.

m is the transformation matrix.
uch is the unicode character
len is the length of unicode array
used will show how many characters were used in uch
the calibrated advace width, if with_ is passed and true if it exists.

Multiple glyphs draw on top of each other.

Definition at line 847 of file SFontTTF.cpp.

References SBinVector< Type >::array(), findGlyphs(), SBinVector< Type >::size(), widthGlyph(), and SS_Matrix2D::x0.

Referenced by SFontImpl::draw(), and SFontImpl::width().

  if (width_) *width_ = 0.0;
  if (!isOK()) return false;

  /* a cluster can define positions to fine adjust */
  SV_GlyphIndex gi;
  if (!findGlyphs (_uch, &gi)) return false;

  if (_uch > 0x7fffffff)
    const SV_INT* positions = mark2BaseList.get (
          SString((char*) &_uch, sizeof (SS_UCS4)));

    /* do we have fine-grained positions ?*/
    if (positions!= 0 && positions->size() > gi.size())
      const SS_INT* arr = positions->array();
      if (width_)
        int wid = arr[positions->size()-1];
        *width_ =  double (wid) * m.x0;
      return true;
  if (!width_) return true;
   * Multiple glyphs draw on top of each other. 
  double max = 0;
  /* We draw one after the other.*/
  for (unsigned int i=0; i<gi.size(); i++)
    /* do not draw them */
    double nwidth = widthGlyph (m, gi[i]);
    if (nwidth < 0) nwidth = -nwidth;
    max += nwidth;
  *width_ = max;
  return true;

Generated by  Doxygen 1.6.0   Back to index