Merge pull request #1547 from stepmania/distance_field_fonts

support for distance field fonts
This commit is contained in:
Flameshadowxeroshin
2017-10-02 17:03:36 -05:00
committed by GitHub
3 changed files with 11 additions and 1 deletions
+6
View File
@@ -414,6 +414,10 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
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; )
{
@@ -443,6 +447,8 @@ void BitmapText::DrawChars( bool bUseStrokeTexture )
start = end;
}
if( bDistanceField )
DISPLAY->SetEffectMode( EffectMode_Normal );
}
/* sText is UTF-8. If not all of the characters in sText are available in the
+2 -1
View File
@@ -272,7 +272,7 @@ int Font::GetGlyphsThatFit(const wstring& line, int* width) const
}
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.
m_DefaultStrokeColor(RageColor(0,0,0,0)), m_sChars("") {}
Font::~Font()
@@ -785,6 +785,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
ini.RenameKey("Char Widths", "main"); // backward compat
ini.GetValue( "common", "CapitalsOnly", bCapitalsOnly );
ini.GetValue( "common", "RightToLeft", m_bRightToLeft );
ini.GetValue( "common", "DistanceField", m_bDistanceField );
RString s;
if( ini.GetValue( "common", "DefaultStrokeColor", s ) )
m_DefaultStrokeColor.FromString( s );
+3
View File
@@ -174,6 +174,7 @@ public:
void SetDefaultGlyph( FontPage *pPage );
bool IsRightToLeft() const { return m_bRightToLeft; };
bool IsDistanceField() const { return m_bDistanceField; };
const RageColor &GetDefaultStrokeColor() const { return m_DefaultStrokeColor; };
private:
@@ -198,6 +199,8 @@ private:
* This will also change the way glyphs from the default FontPage are rendered.
* There may be a better way to handle this. */
bool m_bRightToLeft;
bool m_bDistanceField;
RageColor m_DefaultStrokeColor;