Ignore:
Timestamp:
06/14/15 14:31:00 (10 years ago)
Author:
epyon
Message:
  • got rid of exceptions
  • assert enhancements
  • lots of minor cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gfx/texture_font.cc

    r399 r403  
    1111
    1212using namespace nv;
     13
     14#define NV_CHECK_FREETYPE_ERROR( error, ... ) \
     15if ( error != 0 ) { \
     16        NV_LOG_CRITICAL( "freetype : ", __VA_ARGS__ ); \
     17        NV_ABORT( "freetype : freetype library error!" ); \
     18}
    1319
    1420texture_glyph::texture_glyph()
     
    4551         
    4652        error = FT_Init_FreeType( (FT_Library*)(&m_rlibrary) );
    47         if ( error ) NV_THROW( std::runtime_error, "FT_Error" );
     53        NV_CHECK_FREETYPE_ERROR( error, "error on FT_Init_FreeType, code - ", error );
    4854
    4955        error = FT_New_Face( (FT_Library)(m_rlibrary), filename, 0, (FT_Face*)(&m_rface) );
    50         if ( error ) NV_THROW( std::runtime_error, "FT_Error" );
     56        NV_CHECK_FREETYPE_ERROR( error, "error on FT_New_Face, code - ", error );
    5157
    5258        error = FT_Set_Char_Size( (FT_Face)(m_rface), (int)(size*64), 0, 72*64, 72 );
    53         if ( error ) NV_THROW( std::runtime_error, "FT_Error" );
     59        NV_CHECK_FREETYPE_ERROR( error, "error on FT_Set_Char_Size, code - ", error );
    5460
    5561    FT_Set_Transform( (FT_Face)(m_rface), &matrix, NULL );
     
    123129                FT_UInt glyph_index = FT_Get_Char_Index( face, c );
    124130                FT_Error error = FT_Load_Glyph( face, glyph_index, flags );
    125                 if ( error )
    126                 {
    127                         NV_LOG_ERROR( "FT_Error while loading glyphs, error: ", error, " code: ", c );
    128                         NV_THROW( std::runtime_error, "FT_Error while loading glyphs" );
    129                 }
     131                NV_CHECK_FREETYPE_ERROR( error, "error on FT_Load_Glyph, gylph '", c ,"' code - ", error );
    130132
    131133                FT_GlyphSlot slot   = face->glyph;
     
    141143                if ( r.pos.x < 0 )
    142144                {
    143                         NV_LOG_ERROR( "Atlas full while loading glyphs, r.pos.x: ", r.pos.x, " code: ", c );
    144                         NV_THROW( std::runtime_error, "Atlas full while loading glyphs" );
     145                        NV_LOG_CRITICAL( "texture_font : atlas full while loading glyphs, gylph '", c, "' r.pos.x = ", r.pos.x );
     146                        NV_ABORT( "texture_font : atlas full while loading gylphs!" );
    145147                }
    146148                if (depth == 4)
Note: See TracChangeset for help on using the changeset viewer.