Add TextureHints font metric.
By default, load fonts as 4-bit grayscale, 4-bit alpha (I4A4) maps. This halves font texture memory usage.
This commit is contained in:
@@ -39,7 +39,14 @@ void FontPage::Load( FontPageSettings cfg )
|
|||||||
|
|
||||||
// load texture
|
// load texture
|
||||||
RageTextureID ID(m_sTexturePath);
|
RageTextureID ID(m_sTexturePath);
|
||||||
ID.iColorDepth = 16;
|
if( cfg.TextureHints != "default" )
|
||||||
|
ID.AdditionalTextureHints = cfg.TextureHints;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Using grayscale and 16bpp together means to use a 16bpp image if a grayscale
|
||||||
|
* image couldn't be loaded. */
|
||||||
|
ID.AdditionalTextureHints = "grayscale 16bpp";
|
||||||
|
}
|
||||||
|
|
||||||
m_pTexture = TEXTUREMAN->LoadTexture( ID );
|
m_pTexture = TEXTUREMAN->LoadTexture( ID );
|
||||||
ASSERT( m_pTexture != NULL );
|
ASSERT( m_pTexture != NULL );
|
||||||
@@ -484,6 +491,7 @@ void Font::LoadFontPageSettings(FontPageSettings &cfg, IniFile &ini, const CStri
|
|||||||
ini.GetValue( PageName, "Baseline", cfg.Baseline );
|
ini.GetValue( PageName, "Baseline", cfg.Baseline );
|
||||||
ini.GetValue( PageName, "DefaultWidth", cfg.DefaultWidth );
|
ini.GetValue( PageName, "DefaultWidth", cfg.DefaultWidth );
|
||||||
ini.GetValue( PageName, "AdvanceExtraPixels", cfg.AdvanceExtraPixels );
|
ini.GetValue( PageName, "AdvanceExtraPixels", cfg.AdvanceExtraPixels );
|
||||||
|
ini.GetValue( PageName, "TextureHints", cfg.TextureHints );
|
||||||
|
|
||||||
/* Iterate over all keys. */
|
/* Iterate over all keys. */
|
||||||
const IniFile::key *k = ini.GetKey(PageName);
|
const IniFile::key *k = ini.GetKey(PageName);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ struct FontPageSettings
|
|||||||
DefaultWidth,
|
DefaultWidth,
|
||||||
AdvanceExtraPixels;
|
AdvanceExtraPixels;
|
||||||
float ScaleAllWidthsBy;
|
float ScaleAllWidthsBy;
|
||||||
|
CString TextureHints;
|
||||||
|
|
||||||
map<longchar,int> CharToGlyphNo;
|
map<longchar,int> CharToGlyphNo;
|
||||||
/* If a value is missing, the width of the texture frame is used. */
|
/* If a value is missing, the width of the texture frame is used. */
|
||||||
@@ -61,7 +62,8 @@ struct FontPageSettings
|
|||||||
Baseline(-1),
|
Baseline(-1),
|
||||||
DefaultWidth(-1),
|
DefaultWidth(-1),
|
||||||
AdvanceExtraPixels(1),
|
AdvanceExtraPixels(1),
|
||||||
ScaleAllWidthsBy(1)
|
ScaleAllWidthsBy(1),
|
||||||
|
TextureHints("default")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
/* Map a range from a character map to glyphs. If cnt is -1, map the
|
/* Map a range from a character map to glyphs. If cnt is -1, map the
|
||||||
|
|||||||
Reference in New Issue
Block a user