fix -stroke pages showing up in .ini
This commit is contained in:
@@ -172,22 +172,6 @@ void CTextureFontGeneratorDlg::UpdateFont( bool bSavingDoubleRes )
|
||||
g_pTextureFont->m_PagesToGenerate.push_back( desc );
|
||||
|
||||
|
||||
//
|
||||
// Save duplicate imnages of each page with "-stroke" appended to the page name.
|
||||
//
|
||||
bool bExportStrokeTemplates = !!( pMenu->GetMenuState(ID_OPTIONS_EXPORTSTROKETEMPLATES, 0) & MF_CHECKED );
|
||||
if( bExportStrokeTemplates )
|
||||
{
|
||||
int iNumPages = (int)g_pTextureFont->m_PagesToGenerate.size();
|
||||
for( int i=0; i<iNumPages; i++ )
|
||||
{
|
||||
FontPageDescription desc = g_pTextureFont->m_PagesToGenerate[i];
|
||||
desc.name += "-stroke";
|
||||
g_pTextureFont->m_PagesToGenerate.push_back( desc );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Go: */
|
||||
g_pTextureFont->FormatFontPages();
|
||||
|
||||
@@ -609,12 +593,13 @@ void CTextureFontGeneratorDlg::OnFileSave()
|
||||
*/
|
||||
|
||||
CMenu *pMenu = GetMenu();
|
||||
bool bExportStrokeTemplates = !!( pMenu->GetMenuState(ID_OPTIONS_EXPORTSTROKETEMPLATES, 0) & MF_CHECKED );
|
||||
bool bDoubleRes = !!( pMenu->GetMenuState(ID_OPTIONS_DOUBLERES, 0) & MF_CHECKED );
|
||||
if( bDoubleRes )
|
||||
{
|
||||
g_pTextureFont->Save( szFile, "", true, false ); // save metrics
|
||||
g_pTextureFont->Save( szFile, "", true, false, bExportStrokeTemplates ); // save metrics
|
||||
UpdateFont( true ); // generate DoubleRes bitmaps
|
||||
g_pTextureFont->Save( szFile, " (doubleres)", false, true ); // save bitmaps
|
||||
g_pTextureFont->Save( szFile, " (doubleres)", false, true, bExportStrokeTemplates ); // save bitmaps
|
||||
// reset to normal, non-DoubleRes font
|
||||
m_bUpdateFontNeeded = true;
|
||||
Invalidate( FALSE );
|
||||
@@ -622,7 +607,7 @@ void CTextureFontGeneratorDlg::OnFileSave()
|
||||
}
|
||||
else // normal res
|
||||
{
|
||||
g_pTextureFont->Save( szFile, "", true, true ); // save metrics and bitmaps
|
||||
g_pTextureFont->Save( szFile, "", true, true, bExportStrokeTemplates ); // save metrics and bitmaps
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ void wchar_to_utf8( wchar_t ch, string &out )
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps )
|
||||
void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps, bool bExportStrokeTemplates )
|
||||
{
|
||||
if( m_sError != "" )
|
||||
return;
|
||||
@@ -447,18 +447,35 @@ void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension,
|
||||
|
||||
GrayScaleToAlpha( &surf );
|
||||
|
||||
CString sFile;
|
||||
sFile.Format( "%s [%s] %ix%i%s.png",
|
||||
sBasePath.GetString(),
|
||||
m_PagesToGenerate[i].name.GetString(),
|
||||
m_apPages[i]->m_iNumFramesX,
|
||||
m_apPages[i]->m_iNumFramesY,
|
||||
sBitmapAppendBeforeExtension.GetString() );
|
||||
for( int j=0; j<2; j++ )
|
||||
{
|
||||
CString sPageName = m_PagesToGenerate[i].name.GetString();
|
||||
switch( j )
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if( !bExportStrokeTemplates )
|
||||
continue;
|
||||
sPageName += "-stroke";
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
FILE *f = fopen( sFile, "w+b" );
|
||||
char szErrorbuf[1024];
|
||||
SavePNG( f, szErrorbuf, &surf );
|
||||
fclose( f );
|
||||
CString sFile;
|
||||
sFile.Format( "%s [%s] %ix%i%s.png",
|
||||
sBasePath.GetString(),
|
||||
sPageName.GetString(),
|
||||
m_apPages[i]->m_iNumFramesX,
|
||||
m_apPages[i]->m_iNumFramesY,
|
||||
sBitmapAppendBeforeExtension.GetString() );
|
||||
|
||||
FILE *f = fopen( sFile, "w+b" );
|
||||
char szErrorbuf[1024];
|
||||
SavePNG( f, szErrorbuf, &surf );
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
vector<FontPageDescription> m_PagesToGenerate;
|
||||
void FormatFontPage( int iPage, HDC hDC );
|
||||
void FormatFontPages();
|
||||
void Save( CString sPath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps );
|
||||
void Save( CString sPath, CString sBitmapAppendBeforeExtension, bool bSaveMetrics, bool bSaveBitmaps, bool bExportStrokeTemplates );
|
||||
|
||||
map<wchar_t, HBITMAP> m_Characters;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user