mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 02:26:29 +03:00
Changed cTTFFont::OutlineMethod to cTTFont::OutlineMethods.
Changed cTTFFont::DefaultOutlineMethod to cTTFFont::OutlineMethod.
This commit is contained in:
@@ -14,14 +14,14 @@ namespace EE { namespace Graphics {
|
||||
/** @brief This class loads True Type Font and then draw strings to the screen. */
|
||||
class EE_API cTTFFont : public cFont {
|
||||
public:
|
||||
enum OutlineMethod
|
||||
enum OutlineMethods
|
||||
{
|
||||
OutlineEntropia, //! Slow, but better for small fonts
|
||||
OutlineFreetype //! Faster, usually better for big fonts
|
||||
};
|
||||
|
||||
//! Let the user select the default method to use for outlining the glyphs
|
||||
static OutlineMethod DefaultOutlineMethod;
|
||||
static OutlineMethods OutlineMethod;
|
||||
|
||||
/** Creates an instance of a true type font */
|
||||
static cTTFFont * New( const std::string FontName );
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 2.8.0, 2013-08-20T15:39:40. -->
|
||||
<!-- Written by QtCreator 2.8.0, 2013-08-21T12:14:00. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
||||
@@ -6,7 +6,7 @@ using namespace HaikuTTF;
|
||||
|
||||
namespace EE { namespace Graphics {
|
||||
|
||||
cTTFFont::OutlineMethod cTTFFont::DefaultOutlineMethod = cTTFFont::OutlineEntropia;
|
||||
cTTFFont::OutlineMethods cTTFFont::OutlineMethod = cTTFFont::OutlineEntropia;
|
||||
|
||||
cTTFFont * cTTFFont::New( const std::string FontName ) {
|
||||
return eeNew( cTTFFont, ( FontName ) );
|
||||
@@ -47,7 +47,7 @@ bool cTTFFont::LoadFromMemory( Uint8* TTFData, const eeUint& TTFDataSize, const
|
||||
|
||||
mFont = hkFontManager::instance()->OpenFromMemory( reinterpret_cast<Uint8*>(&TTFData[0]), TTFDataSize, Size, 0, NumCharsToGen );
|
||||
|
||||
if ( OutlineSize && OutlineFreetype == DefaultOutlineMethod ) {
|
||||
if ( OutlineSize && OutlineFreetype == OutlineMethod ) {
|
||||
mFontOutline = hkFontManager::instance()->OpenFromMemory( reinterpret_cast<Uint8*>(&TTFData[0]), TTFDataSize, Size, 0, NumCharsToGen );
|
||||
mFontOutline->Outline( OutlineSize );
|
||||
}
|
||||
@@ -63,7 +63,7 @@ bool cTTFFont::Load( const std::string& Filepath, const eeUint& Size, EE_TTF_FON
|
||||
|
||||
mFont = hkFontManager::instance()->OpenFromFile( Filepath.c_str(), Size, 0, NumCharsToGen );
|
||||
|
||||
if ( OutlineSize && OutlineFreetype == DefaultOutlineMethod ) {
|
||||
if ( OutlineSize && OutlineFreetype == OutlineMethod ) {
|
||||
mFontOutline = hkFontManager::instance()->OpenFromFile( Filepath.c_str(), Size, 0, NumCharsToGen );
|
||||
mFontOutline->Outline( OutlineSize );
|
||||
}
|
||||
@@ -94,8 +94,8 @@ bool cTTFFont::iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const Uint16&
|
||||
PixelSep = 1;
|
||||
|
||||
Uint32 TexSize;
|
||||
Uint32 OutSize = ( OutlineFreetype == DefaultOutlineMethod ) ? 0 : OutlineSize;
|
||||
Uint32 OutTotal = ( OutlineFreetype == DefaultOutlineMethod ) ? 0 : OutlineSize * 2;
|
||||
Uint32 OutSize = ( OutlineFreetype == OutlineMethod ) ? 0 : OutlineSize;
|
||||
Uint32 OutTotal = ( OutlineFreetype == OutlineMethod ) ? 0 : OutlineSize * 2;
|
||||
|
||||
if ( mFont == NULL ) {
|
||||
cLog::instance()->Write( "Failed to load TTF Font " + mFilepath + "." );
|
||||
@@ -174,7 +174,7 @@ bool cTTFFont::iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const Uint16&
|
||||
GlyphRect.y = mFont->Current()->Pixmap()->rows;
|
||||
|
||||
// Create the outline for the glyph and copy the outline to the texture
|
||||
if ( OutlineSize && OutlineFreetype == DefaultOutlineMethod ) {
|
||||
if ( OutlineSize && OutlineFreetype == OutlineMethod ) {
|
||||
TempOutGlyphSurface = mFontOutline->GlyphRender( i, eeColorA( OutlineColor ).GetValue() );
|
||||
|
||||
mFontOutline->GlyphMetrics( i, &TempGlyph.MinX, &TempGlyph.MaxX, &TempGlyph.MinY, &TempGlyph.MaxY, &TempGlyph.Advance );
|
||||
@@ -244,7 +244,7 @@ bool cTTFFont::iLoad( const eeUint& Size, EE_TTF_FONT_STYLE Style, const Uint16&
|
||||
}
|
||||
|
||||
// Create the outline for the glyph and copy the outline to the texture
|
||||
if ( OutlineSize && OutlineEntropia == DefaultOutlineMethod ) {
|
||||
if ( OutlineSize && OutlineEntropia == OutlineMethod ) {
|
||||
eeRecti nGlyphR(
|
||||
TempGlyph.CurX,
|
||||
TempGlyph.CurY,
|
||||
|
||||
@@ -24,7 +24,7 @@ EE_MAIN_FUNC int main (int argc, char * argv [])
|
||||
TTF->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, 128, eeColor(255,255,255), 3, eeColor(0,0,0), true );
|
||||
|
||||
// Change the default method to use for outlining the font glyphs
|
||||
cTTFFont::DefaultOutlineMethod = cTTFFont::OutlineFreetype;
|
||||
cTTFFont::OutlineMethod = cTTFFont::OutlineFreetype;
|
||||
|
||||
// Create the exact same font than before but using the new outlining method
|
||||
TTFO->Load( AppPath + "assets/fonts/DejaVuSansMono.ttf", 18, TTF_STYLE_NORMAL, 128, eeColor(255,255,255), 3, eeColor(0,0,0), true );
|
||||
|
||||
Reference in New Issue
Block a user