コード例 #1
0
ファイル: ttdriver.c プロジェクト: genesi/freetype
  static FT_Error
  tt_size_request( FT_Size          size,
                   FT_Size_Request  req )
  {
    TT_Size   ttsize = (TT_Size)size;
    FT_Error  error  = TT_Err_Ok;


#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS

    if ( FT_HAS_FIXED_SIZES( size->face ) )
    {
      TT_Face       ttface = (TT_Face)size->face;
      SFNT_Service  sfnt   = (SFNT_Service) ttface->sfnt;
      FT_ULong      strike_index;


      error = sfnt->set_sbit_strike( ttface, req, &strike_index );

      if ( error )
        ttsize->strike_index = 0xFFFFFFFFUL;
      else
        return tt_size_select( size, strike_index );
    }

#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */

    FT_Request_Metrics( size->face, req );

    if ( FT_IS_SCALABLE( size->face ) )
      error = tt_size_reset( ttsize );

    return error;
  }
コード例 #2
0
static FT_Error
tt_size_request( FT_Size          size,
                 FT_Size_Request  req )
{
    TT_Size   ttsize = (TT_Size)size;
    FT_Error  error  = FT_Err_Ok;


#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS

    if ( FT_HAS_FIXED_SIZES( size->face ) )
    {
        TT_Face       ttface = (TT_Face)size->face;
        SFNT_Service  sfnt   = (SFNT_Service)ttface->sfnt;
        FT_ULong      strike_index;


        error = sfnt->set_sbit_strike( ttface, req, &strike_index );

        if ( error )
            ttsize->strike_index = 0xFFFFFFFFUL;
        else
            return tt_size_select( size, strike_index );
    }

#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */

    FT_Request_Metrics( size->face, req );

    if ( FT_IS_SCALABLE( size->face ) )
    {
        error = tt_size_reset( ttsize );
        ttsize->root.metrics = ttsize->metrics;

#ifdef TT_USE_BYTECODE_INTERPRETER
        /* for the `MPS' bytecode instruction we need the point size */
        {
            FT_UInt  resolution = ttsize->metrics.x_ppem > ttsize->metrics.y_ppem
                                  ? req->horiResolution
                                  : req->vertResolution;


            /* if we don't have a resolution value, assume 72dpi */
            if ( req->type == FT_SIZE_REQUEST_TYPE_SCALES ||
                    !resolution                              )
                resolution = 72;

            ttsize->point_size = FT_MulDiv( ttsize->ttmetrics.ppem,
                                            64 * 72,
                                            resolution );
        }
#endif
    }

    return error;
}