Exemple #1
0
CGUIFont_Impl::CGUIFont_Impl(CGUI_Impl* pGUI, const char* szFontName, const char* szFontFile, unsigned int uSize, unsigned int uFlags, bool bAutoScale)
{
    // Store the fontmanager and create a font with the given attributes
    m_pFontManager = pGUI->GetFontManager();
    m_pFont = NULL;
    while (!m_pFont)
    {
        try
        {
            m_pFont = m_pFontManager->createFont(szFontName, szFontFile, uSize, uFlags, bAutoScale, 1024, 768);
        }
        catch (CEGUI::RendererException)
        {
            // Reduce size until it can fit into a texture
            if (--uSize == 1)
                throw;
        }
    }

    // Define our glyphs
    m_pFont->setInitialFontGlyphs(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");

    // Set default attributes
    SetNativeResolution(1024, 768);
    SetAutoScalingEnabled(bAutoScale);
}
Exemple #2
0
CGUIFont_Impl::CGUIFont_Impl ( CGUI_Impl* pGUI, const char* szFontName, const char* szFontFile, unsigned int uSize, unsigned int uFlags, unsigned int uExtraGlyphs[], bool bAutoScale )
{
    // Store the fontmanager and create a font with the given attributes
    m_pFontManager = pGUI->GetFontManager ();
    m_pFont = m_pFontManager->createFont ( szFontName, szFontFile, uSize, uFlags );

    // Define our glyphs
	if ( uExtraGlyphs ) {
		m_pFont->defineFontGlyphs( m_pFont->getAvailableGlyphs() + (CEGUI::utf32)*uExtraGlyphs );
	} else
		m_pFont->defineFontGlyphs( (CEGUI::utf8*)" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );

    // Set default attributes
    SetNativeResolution ( 1024, 768 );
    SetAutoScalingEnabled ( bAutoScale );
}