Merge pull request #1547 from stepmania/distance_field_fonts
support for distance field fonts
This commit is contained in:
@@ -414,6 +414,10 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
|
|||||||
m_aVertices[i+j].c.a = (unsigned char)( m_aVertices[i+j].c.a * fAlpha );
|
m_aVertices[i+j].c.a = (unsigned char)( m_aVertices[i+j].c.a * fAlpha );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bDistanceField = m_pFont->IsDistanceField();
|
||||||
|
if( bDistanceField )
|
||||||
|
DISPLAY->SetEffectMode( EffectMode_DistanceField );
|
||||||
|
|
||||||
for( int start = iStartGlyph; start < iEndGlyph; )
|
for( int start = iStartGlyph; start < iEndGlyph; )
|
||||||
{
|
{
|
||||||
@@ -443,6 +447,8 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
|
|||||||
|
|
||||||
start = end;
|
start = end;
|
||||||
}
|
}
|
||||||
|
if( bDistanceField )
|
||||||
|
DISPLAY->SetEffectMode( EffectMode_Normal );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sText is UTF-8. If not all of the characters in sText are available in the
|
/* sText is UTF-8. If not all of the characters in sText are available in the
|
||||||
|
|||||||
+2
-1
@@ -272,7 +272,7 @@ int Font::GetGlyphsThatFit(const wstring& line, int* width) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Font::Font(): m_iRefCount(1), path(""), m_apPages(), m_pDefault(NULL),
|
Font::Font(): m_iRefCount(1), path(""), m_apPages(), m_pDefault(NULL),
|
||||||
m_iCharToGlyph(), m_bRightToLeft(false),
|
m_iCharToGlyph(), m_bRightToLeft(false), m_bDistanceField(false),
|
||||||
// strokes aren't shown by default, hence the Color.
|
// strokes aren't shown by default, hence the Color.
|
||||||
m_DefaultStrokeColor(RageColor(0,0,0,0)), m_sChars("") {}
|
m_DefaultStrokeColor(RageColor(0,0,0,0)), m_sChars("") {}
|
||||||
Font::~Font()
|
Font::~Font()
|
||||||
@@ -785,6 +785,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
|
|||||||
ini.RenameKey("Char Widths", "main"); // backward compat
|
ini.RenameKey("Char Widths", "main"); // backward compat
|
||||||
ini.GetValue( "common", "CapitalsOnly", bCapitalsOnly );
|
ini.GetValue( "common", "CapitalsOnly", bCapitalsOnly );
|
||||||
ini.GetValue( "common", "RightToLeft", m_bRightToLeft );
|
ini.GetValue( "common", "RightToLeft", m_bRightToLeft );
|
||||||
|
ini.GetValue( "common", "DistanceField", m_bDistanceField );
|
||||||
RString s;
|
RString s;
|
||||||
if( ini.GetValue( "common", "DefaultStrokeColor", s ) )
|
if( ini.GetValue( "common", "DefaultStrokeColor", s ) )
|
||||||
m_DefaultStrokeColor.FromString( s );
|
m_DefaultStrokeColor.FromString( s );
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ public:
|
|||||||
void SetDefaultGlyph( FontPage *pPage );
|
void SetDefaultGlyph( FontPage *pPage );
|
||||||
|
|
||||||
bool IsRightToLeft() const { return m_bRightToLeft; };
|
bool IsRightToLeft() const { return m_bRightToLeft; };
|
||||||
|
bool IsDistanceField() const { return m_bDistanceField; };
|
||||||
const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; };
|
const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -198,6 +199,8 @@ private:
|
|||||||
* This will also change the way glyphs from the default FontPage are rendered.
|
* This will also change the way glyphs from the default FontPage are rendered.
|
||||||
* There may be a better way to handle this. */
|
* There may be a better way to handle this. */
|
||||||
bool m_bRightToLeft;
|
bool m_bRightToLeft;
|
||||||
|
|
||||||
|
bool m_bDistanceField;
|
||||||
|
|
||||||
RageColor m_DefaultStrokeColor;
|
RageColor m_DefaultStrokeColor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user