示例#1
0
    GLCharacter * operator[ ]( char const xCharacter )
    {
        GLCharacter * ret = NULL;

        if ( mCharacters.find( xCharacter ) == mCharacters.end( ) )
        {
//#ifdef ANDROID
#if 1
            mFont.loadGlyph( xCharacter, 0.0f );

            PNGImage output( { mFont.getGlyphWidth( ), mFont.getGlyphHeight( ) } );

            mFont.printSpans( output, mOutlineColor, mFillColor );

            mCharacters[ xCharacter ] = ret = new GLCharacter( xCharacter
                    , output.toGLTextureBuffer( )
                    , mFont.getGlyphWidth( )
                    , mFont.getGlyphHeight( ) );
#else
            while ( !fileExists( filename.str( ).c_str( ) ) ) {
                _makePNG( xCharacter );
            }
            mCharacters[ xCharacter ] = ret = new GLCharacter( xCharacter, filename.str( ).c_str( ) );
#endif

        }
        else
        {
            ret = mCharacters[ xCharacter ];
        }

        return ret;
    }
示例#2
0
    std::vector<uint8_t> _makePNG( char const xC )
    {
        mFont.loadGlyph( xC, 0.0f );

        PNGImage output( { mFont.getGlyphWidth( ), mFont.getGlyphHeight( ) } );

        mFont.printSpans( output, mOutlineColor, mFillColor );

#if 0
        SISULOG("Creating filename.");
        std::stringstream filename;

        _makeFilename( filename, xC );
#endif

        SISULOG("Blitting.");
        output.blit( );

        uint8_t *    data = output.getData( );
        size_t const size = output.getDataSize( );

        SISULOG("Writing to file for posterity.");

        std::cout << "Output data size was: " << size << std::endl;

#if 0
        memoryToFile( filename.str( ).c_str( ), data, size );
#endif

        std::vector<uint8_t> buffer;

        buffer.assign( data, data + size );

        SISULOG("_makePNG OUT");

        return buffer;
    }