/[freetype]/freetype2/src/truetype/ttgload.c
ViewVC logotype

Diff of /freetype2/src/truetype/ttgload.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.138 by wl, Wed Apr 6 14:48:55 2005 UTC revision 1.139 by wl, Thu Jun 16 19:07:08 2005 UTC
# Line 1765  Line 1765 
1765        if ( face->vertical_info &&        if ( face->vertical_info &&
1766             face->vertical.number_Of_VMetrics > 0 )             face->vertical.number_Of_VMetrics > 0 )
1767        {        {
1768          advance_height = (FT_UShort)( loader->pp4.y - loader->pp3.y );          top_bearing = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
1769          top_bearing    = (FT_Short)( loader->pp3.y - bbox.yMax );                                             y_scale );
1770    
1771            if ( loader->pp3.y <= loader->pp4.y )
1772              advance_height = 0;
1773            else
1774              advance_height = (FT_UShort)FT_DivFix( loader->pp3.y - loader->pp4.y,
1775                                                     y_scale );
1776        }        }
1777        else        else
1778        {        {
1779          /* Make up the distances from the horizontal header.   */          FT_Short  max_height, height;
1780    
1781    
1782            /* XXX Compute top side bearing and advance height in  */
1783            /*     Get_VMetrics instead of here.                   */
1784    
1785          /* NOTE: The OS/2 values are the only `portable' ones, */          /* NOTE: The OS/2 values are the only `portable' ones, */
1786          /*       which is why we use them, if there is an OS/2 */          /*       which is why we use them, if there is an OS/2 */
1787          /*       table in the font.  Otherwise, we use the     */          /*       table in the font.  Otherwise, we use the     */
1788          /*       values defined in the horizontal header.      */          /*       values defined in the horizontal header.      */
1789          /*                                                     */  
1790          /* NOTE2: The sTypoDescender is negative, which is why */          height = FT_DivFix( bbox.yMax - bbox.yMin, y_scale );
         /*        we compute the baseline-to-baseline distance */  
         /*        here with:                                   */  
         /*             ascender - descender + linegap          */  
         /*                                                     */  
         /* NOTE3: This is different from what MS's rasterizer  */  
         /*        appears to do when getting default values    */  
         /*        for the vertical phantom points.  We leave   */  
         /*        the old code untouched, but relying on       */  
         /*        phantom points alone might be reasonable     */  
         /*        (i.e., removing the `if' above).             */  
1791          if ( face->os2.version != 0xFFFFU )          if ( face->os2.version != 0xFFFFU )
1792          {          {
1793            top_bearing    = (FT_Short)( face->os2.sTypoLineGap / 2 );            /* sTypoDescender is negative */
1794            advance_height = (FT_UShort)( face->os2.sTypoAscender -            max_height = face->os2.sTypoAscender - face->os2.sTypoDescender;
1795                                          face->os2.sTypoDescender +  
1796                                          face->os2.sTypoLineGap );            top_bearing    = (FT_Short)( ( max_height - height ) / 2 );
1797              advance_height = (FT_UShort)( max_height + face->os2.sTypoLineGap );
1798          }          }
1799          else          else
1800          {          {
1801            top_bearing    = (FT_Short)( face->horizontal.Line_Gap / 2 );            max_height = face->horizontal.Ascender + face->horizontal.Descender;
1802            advance_height = (FT_UShort)( face->horizontal.Ascender  +  
1803                                          face->horizontal.Descender +            top_bearing    = (FT_Short)( ( max_height - height ) / 2 );
1804              advance_height = (FT_UShort)( max_height +
1805                                          face->horizontal.Line_Gap );                                          face->horizontal.Line_Gap );
1806          }          }
1807        }        }
# Line 1817  Line 1819 
1819    
1820          metrics.bearing_x = 0;          metrics.bearing_x = 0;
1821          metrics.bearing_y = top_bearing;          metrics.bearing_y = top_bearing;
1822          metrics.advance = advance_height;          metrics.advance   = advance_height;
1823          error =          error =
1824            face->root.internal->incremental_interface->funcs->get_glyph_metrics(            face->root.internal->incremental_interface->funcs->get_glyph_metrics(
1825              face->root.internal->incremental_interface->object,              face->root.internal->incremental_interface->object,
# Line 1834  Line 1836 
1836    
1837  #endif /* FT_CONFIG_OPTION_INCREMENTAL */  #endif /* FT_CONFIG_OPTION_INCREMENTAL */
1838    
       /* We must adjust the top_bearing value from the bounding box given */  
       /* in the glyph header to the bounding box calculated with          */  
       /* FT_Get_Outline_CBox().                                           */  
   
1839        /* scale the metrics */        /* scale the metrics */
1840        if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )        if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
1841        {        {
1842          top     = FT_MulFix( top_bearing + loader->bbox.yMax, y_scale )          top     = FT_MulFix( top_bearing, y_scale );
                     - bbox.yMax;  
1843          advance = FT_MulFix( advance_height, y_scale );          advance = FT_MulFix( advance_height, y_scale );
1844        }        }
1845        else        else
1846        {        {
1847          top     = top_bearing + loader->bbox.yMax - bbox.yMax;          top     = top_bearing;
1848          advance = advance_height;          advance = advance_height;
1849        }        }
1850    
# Line 1864  Line 1861 
1861        if ( IS_HINTED( loader->load_flags ) )        if ( IS_HINTED( loader->load_flags ) )
1862        {        {
1863          left    = FT_PIX_FLOOR( left );          left    = FT_PIX_FLOOR( left );
1864          top     = FT_PIX_CEIL( top );          /* top should be floor'ed */
1865            top     = FT_PIX_FLOOR( top );
1866          advance = FT_PIX_ROUND( advance );          advance = FT_PIX_ROUND( advance );
1867        }        }
1868    

Legend:
Removed from v.1.138  
changed lines
  Added in v.1.139

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26