Logo Search packages:      
Sourcecode: yudit version File versions

int SFontTTF::getGlyphWidth ( SS_GlyphIndex  glyph  )  [protected]

Get the unadjusted width of the glyph

Definition at line 744 of file SFontTTF.cpp.

Referenced by getBaseOffsets(), and storeMarkPositions().

{
    TTF_HHEA* hhea_table = (TTF_HHEA*) tables[SS_TB_HHEA];
    LONGHORMETRIC* hmtx_entry = (LONGHORMETRIC*) tables[SS_TB_HTMX];
    int n_hmetrics = ntohs(hhea_table->numberOfHMetrics);
    short _bw;
    /* left side bearing is grossly ignored */
    if (glyph >= n_hmetrics)
    {
      _bw = ntohs (hmtx_entry[n_hmetrics-1].advanceWidth);
    }
    else
    {
      _bw = ntohs(hmtx_entry[glyph].advanceWidth);
    }
    int w = (int) ((_bw>0) ? _bw : -_bw);
    return w;
}


Generated by  Doxygen 1.6.0   Back to index