mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
CWE Directory Reorganization
Rearrange directory structure of CWE to be loosely equivalent to the H'uru Plasma repository. Part 1: Movement of directories and files.
This commit is contained in:
83
Sources/Tools/plFontConverter/hsCodecManagerStub.cpp
Normal file
83
Sources/Tools/plFontConverter/hsCodecManagerStub.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsCodecManager.h"
|
||||
#include "plMipmap.h"
|
||||
|
||||
|
||||
hsCodecManager& hsCodecManager::Instance()
|
||||
{
|
||||
static hsCodecManager the_instance;
|
||||
static hsBool initialized = false;
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return the_instance;
|
||||
}
|
||||
|
||||
hsCodecManager::hsCodecManager()
|
||||
{
|
||||
}
|
||||
|
||||
plMipmap *hsCodecManager::CreateCompressedMipmap(UInt32 compressionFormat, plMipmap *uncompressed)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
plMipmap *hsCodecManager::CreateUncompressedMipmap(plMipmap *compressed, UInt8 bitDepth)
|
||||
{
|
||||
return nil;
|
||||
|
||||
}
|
||||
|
||||
hsBool hsCodecManager::ColorizeCompMipmap( plMipmap *bMap, const UInt8 *colorMask )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
hsBool hsCodecManager::Register(hsCodec *codec, UInt32 compressionFormat, hsScalar priority)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
91
Sources/Tools/plFontConverter/plFontConverter.cpp
Normal file
91
Sources/Tools/plFontConverter/plFontConverter.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#define CLASSNAME "plFontConverter" // Used in WinInit()
|
||||
#define WINDOWNAME "plFontConverter"
|
||||
|
||||
#include "HeadSpin.h"
|
||||
#include "hsTypes.h"
|
||||
#include <windows.h>
|
||||
#include "res/resource.h"
|
||||
|
||||
#include "pnAllCreatables.h"
|
||||
#include "../plResMgr/plResManager.h"
|
||||
#include "../plResMgr/plResMgrCreatable.h"
|
||||
#include "../plResMgr/plResMgrSettings.h"
|
||||
#include "../plMessage/plResMgrHelperMsg.h"
|
||||
#include "../plUnifiedTime/plUnifiedTimeCreatable.h"
|
||||
REGISTER_CREATABLE(plResMgrHelperMsg);
|
||||
|
||||
#include "../plGImage/plFont.h"
|
||||
REGISTER_CREATABLE(plFont);
|
||||
|
||||
#include "../plGImage/plBitmap.h"
|
||||
#include "../plGImage/plMipmap.h"
|
||||
REGISTER_NONCREATABLE(plBitmap);
|
||||
REGISTER_CREATABLE(plMipmap);
|
||||
|
||||
|
||||
HINSTANCE gInstance;
|
||||
char *gCommandLine = nil;
|
||||
HWND gMainWindow = nil;
|
||||
|
||||
BOOL CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
|
||||
|
||||
|
||||
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
HACCEL accelTable = LoadAccelerators( hInstance, MAKEINTRESOURCE( IDR_ACCELERATOR1 ) );
|
||||
|
||||
|
||||
gCommandLine = (char *)lpCmdLine;
|
||||
|
||||
gInstance = hInstance;
|
||||
|
||||
plResManager *rMgr = new plResManager;
|
||||
hsgResMgr::Init( rMgr );
|
||||
|
||||
DialogBox( gInstance, MAKEINTRESOURCE( IDD_MAINDIALOG ), nil, WndProc );
|
||||
|
||||
hsgResMgr::Shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
755
Sources/Tools/plFontConverter/plFontConverterProc.cpp
Normal file
755
Sources/Tools/plFontConverter/plFontConverterProc.cpp
Normal file
@ -0,0 +1,755 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "HeadSpin.h"
|
||||
#include "hsTypes.h"
|
||||
#include <windows.h>
|
||||
#include "res/resource.h"
|
||||
#include <shlwapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <commctrl.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "hsStream.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "plFontFreeType.h"
|
||||
#include "../plGImage/plFont.h"
|
||||
#include "../plGImage/plMipmap.h"
|
||||
#include "../pnKeyedObject/plUoid.h"
|
||||
#include "../pnKeyedObject/plKeyImp.h"
|
||||
|
||||
|
||||
extern HINSTANCE gInstance;
|
||||
|
||||
// My global font that i'm working on
|
||||
plFont *gFont = nil;
|
||||
|
||||
// Preview bitmap
|
||||
HDC gPreviewHDC = nil;
|
||||
HBITMAP gPreviewBitmap = nil;
|
||||
|
||||
void IMakeFontGoAway( void )
|
||||
{
|
||||
if( gFont != nil )
|
||||
{
|
||||
plKeyImp *imp = (plKeyImp *)(gFont->GetKey());
|
||||
if( imp != nil )
|
||||
imp->SetObjectPtr( nil );
|
||||
gFont = nil;
|
||||
}
|
||||
}
|
||||
|
||||
void IMakeNewFont( void )
|
||||
{
|
||||
IMakeFontGoAway();
|
||||
gFont = new plFont();
|
||||
}
|
||||
|
||||
BOOL CALLBACK AboutDialogProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
if( msg == WM_COMMAND )
|
||||
EndDialog( hWnd, 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool PromptForFile( HWND parent, const char *prompt, const char *filter, char *fileName, int fileNameMax, bool save )
|
||||
{
|
||||
OPENFILENAME openInfo;
|
||||
|
||||
|
||||
memset( &openInfo, 0, sizeof( OPENFILENAME ) );
|
||||
openInfo.hInstance = gInstance;
|
||||
openInfo.hwndOwner = parent;
|
||||
openInfo.lStructSize = sizeof( OPENFILENAME );
|
||||
openInfo.lpstrFile = fileName;
|
||||
openInfo.nMaxFile = fileNameMax;
|
||||
openInfo.lpstrFilter = filter;
|
||||
openInfo.lpstrTitle = prompt;
|
||||
openInfo.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
if( !save )
|
||||
openInfo.Flags |= OFN_READONLY;
|
||||
|
||||
if( save )
|
||||
return GetSaveFileName( &openInfo ) ? true : false;
|
||||
|
||||
return GetOpenFileName( &openInfo ) ? true : false;
|
||||
}
|
||||
|
||||
void IUpdateInfo( HWND hDlg )
|
||||
{
|
||||
const int TEST_STRING_SIZE = 512;
|
||||
static wchar_t testString[ TEST_STRING_SIZE ] = L"The quick brown fox jumped over the lazy dog! ABCabc012345;,.";
|
||||
|
||||
if( gFont == nil )
|
||||
{
|
||||
SetDlgItemText( hDlg, IDC_FACE, "" );
|
||||
SetDlgItemText( hDlg, IDC_FSIZE, "" );
|
||||
SetDlgItemText( hDlg, IDC_STARTG, "" );
|
||||
SetDlgItemText( hDlg, IDC_GCOUNT, "" );
|
||||
|
||||
SetDlgItemText( hDlg, IDC_WIDTH, "" );
|
||||
SetDlgItemText( hDlg, IDC_HEIGHT, "" );
|
||||
SetDlgItemText( hDlg, IDC_BPP, "" );
|
||||
|
||||
CheckDlgButton( hDlg, IDC_BOLD, false );
|
||||
CheckDlgButton( hDlg, IDC_ITALIC, false );
|
||||
return;
|
||||
}
|
||||
|
||||
SetDlgItemText( hDlg, IDC_FACE, gFont->GetFace() );
|
||||
SetDlgItemInt( hDlg, IDC_FSIZE, gFont->GetSize(), false );
|
||||
SetDlgItemInt( hDlg, IDC_STARTG, gFont->GetFirstChar(), false );
|
||||
SetDlgItemInt( hDlg, IDC_GCOUNT, gFont->GetNumChars(), false );
|
||||
|
||||
SetDlgItemInt( hDlg, IDC_WIDTH, gFont->GetBitmapWidth(), false );
|
||||
SetDlgItemInt( hDlg, IDC_HEIGHT, gFont->GetBitmapHeight(), false );
|
||||
SetDlgItemInt( hDlg, IDC_BPP, gFont->GetBitmapBPP(), false );
|
||||
|
||||
CheckDlgButton( hDlg, IDC_BOLD, gFont->IsFlagSet( plFont::kFlagBold ) );
|
||||
CheckDlgButton( hDlg, IDC_ITALIC, gFont->IsFlagSet( plFont::kFlagItalic ) );
|
||||
|
||||
if( gPreviewHDC != nil )
|
||||
{
|
||||
DeleteObject( gPreviewHDC );
|
||||
DeleteObject( gPreviewBitmap );
|
||||
gPreviewHDC = nil;
|
||||
gPreviewBitmap = nil;
|
||||
}
|
||||
|
||||
// Get the size of our preview
|
||||
RECT r;
|
||||
GetClientRect( GetDlgItem( hDlg, IDC_PREVIEW ), &r );
|
||||
MapWindowPoints( GetDlgItem( hDlg, IDC_PREVIEW ), hDlg, (POINT *)&r, 2 );
|
||||
|
||||
InvalidateRect( hDlg, &r, false );
|
||||
|
||||
if( gFont->GetNumChars() == 0 )
|
||||
return;
|
||||
|
||||
// Our preview bitmap
|
||||
HDC deskDC = GetDC( nil );
|
||||
gPreviewHDC = CreateCompatibleDC( deskDC );
|
||||
gPreviewBitmap = CreateCompatibleBitmap( deskDC, r.right - r.left, r.bottom - r.top );
|
||||
SelectObject( gPreviewHDC, gPreviewBitmap );
|
||||
ReleaseDC( nil, deskDC );
|
||||
|
||||
::GetDlgItemTextW( hDlg, IDC_PREVTEXT, testString, TEST_STRING_SIZE );
|
||||
|
||||
// Create us a mipmap to render onto, render onto it, then copy that to our DC
|
||||
plMipmap *mip = new plMipmap( r.right - r.left, r.bottom - r.top, plMipmap::kARGB32Config, 1 );
|
||||
memset( mip->GetImage(), 0xff, mip->GetWidth() * mip->GetHeight() * 4 );
|
||||
|
||||
gFont->SetRenderColor( 0xff000000 );
|
||||
gFont->SetRenderFlag( plFont::kRenderClip, true );
|
||||
gFont->SetRenderClipRect( 0, 0, (Int16)(r.right - r.left), (Int16)(r.bottom - r.top) );
|
||||
UInt16 w, h, a, lastX, lastY;
|
||||
UInt32 firstCC;
|
||||
gFont->CalcStringExtents( testString, w, h, a, firstCC, lastX, lastY );
|
||||
|
||||
int cY = ( ( ( r.bottom - r.top ) - h ) >> 1 ) + a;
|
||||
|
||||
if( cY < 0 )
|
||||
cY = 0;
|
||||
else if( cY > r.bottom - r.top - 1 )
|
||||
cY = r.bottom - r.top - 1;
|
||||
|
||||
memset( mip->GetAddr32( 8, cY ), 0xc0, ( r.right - r.left - 8 ) * 4 );
|
||||
|
||||
gFont->RenderString( mip, 8, cY, testString );
|
||||
|
||||
int x, y;
|
||||
for( y = 0; y < r.bottom - r.top; y++ )
|
||||
{
|
||||
for( x = 0; x < r.right - r.left; x++ )
|
||||
{
|
||||
UInt32 color = *mip->GetAddr32( x, y );
|
||||
hsColorRGBA rgba;
|
||||
rgba.FromARGB32( color );
|
||||
|
||||
if( color != 0xffffffff && color != 0xff000000 )
|
||||
{
|
||||
int q = 0;
|
||||
}
|
||||
SetPixel( gPreviewHDC, x, y, RGB( rgba.r * 255.f, rgba.g * 255.f, rgba.b * 255.f) );
|
||||
}
|
||||
}
|
||||
|
||||
delete mip;
|
||||
}
|
||||
|
||||
class plSetKeyObj : public hsKeyedObject
|
||||
{
|
||||
public:
|
||||
void SetMyKey( const plKey &key )
|
||||
{
|
||||
SetKey( key );
|
||||
}
|
||||
};
|
||||
|
||||
class plMyBDFCallback : public plBDFConvertCallback
|
||||
{
|
||||
protected:
|
||||
HWND fDlg;
|
||||
clock_t fLastTime;
|
||||
UInt16 fPoint;
|
||||
|
||||
void IPumpMessageQueue( void )
|
||||
{
|
||||
MSG msg;
|
||||
while( PeekMessage( &msg, fDlg, 0, 0, PM_REMOVE ) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
plMyBDFCallback( HWND dlg ) : fDlg( dlg ) {}
|
||||
|
||||
virtual void NumChars( UInt16 chars )
|
||||
{
|
||||
::SendDlgItemMessage( fDlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM( 0, chars ) );
|
||||
IPumpMessageQueue();
|
||||
fLastTime = clock();
|
||||
fPoint = 0;
|
||||
}
|
||||
|
||||
virtual void CharDone( void )
|
||||
{
|
||||
fPoint++;
|
||||
if( clock() - fLastTime > CLOCKS_PER_SEC / 16 )
|
||||
{
|
||||
::SendDlgItemMessage( fDlg, IDC_PROGRESS, PBM_SETPOS, fPoint, 0 );
|
||||
IPumpMessageQueue();
|
||||
fLastTime = clock();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BOOL CALLBACK ProgressWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IImportFNT( HWND hWnd, const char *path )
|
||||
{
|
||||
IMakeNewFont();
|
||||
if( !gFont->LoadFromFNT( path ) )
|
||||
MessageBox( hWnd, "Failure converting FNT file", "ERROR", MB_OK | MB_ICONEXCLAMATION );
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
|
||||
void IImportBDF( HWND hWnd, const char *path )
|
||||
{
|
||||
IMakeNewFont();
|
||||
HWND dialog = CreateDialog( gInstance, MAKEINTRESOURCE( IDD_PROGRESS ), hWnd, ProgressWndProc );
|
||||
ShowWindow( dialog, SW_SHOW );
|
||||
EnableWindow( hWnd, false );
|
||||
plMyBDFCallback callback( dialog );
|
||||
|
||||
if( !gFont->LoadFromBDF( path, &callback ) )
|
||||
MessageBox( hWnd, "Failure converting BDF file", "ERROR", MB_OK | MB_ICONEXCLAMATION );
|
||||
|
||||
DestroyWindow( dialog );
|
||||
EnableWindow( hWnd, true );
|
||||
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
|
||||
void IOpenP2F( HWND hWnd, const char *path )
|
||||
{
|
||||
IMakeNewFont();
|
||||
if( !gFont->LoadFromP2FFile( path ) )
|
||||
MessageBox( hWnd, "Failure opening P2F file", "ERROR", MB_OK | MB_ICONEXCLAMATION );
|
||||
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
|
||||
struct ResRecord
|
||||
{
|
||||
HRSRC fHandle;
|
||||
char fName[ 512 ];
|
||||
|
||||
ResRecord() { fHandle = nil; fName[ 0 ] = 0; }
|
||||
ResRecord( HRSRC h, const char *n ) { fHandle = h; strncpy( fName, n, sizeof( fName ) ); }
|
||||
};
|
||||
|
||||
BOOL CALLBACK ResEnumProc( HMODULE module, LPCTSTR type, LPTSTR name, LONG_PTR lParam )
|
||||
{
|
||||
HRSRC res = FindResource( module, name, type );
|
||||
if( res != nil )
|
||||
{
|
||||
hsTArray<ResRecord *> *array = (hsTArray<ResRecord *> *)lParam;
|
||||
array->Append( new ResRecord( res, name ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CALLBACK ResListWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch( message )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
SendDlgItemMessage( hWnd, IDC_RESLIST, LB_RESETCONTENT, 0, 0 );
|
||||
hsTArray<ResRecord *> *array = (hsTArray<ResRecord *> *)lParam;
|
||||
for( UInt32 i = 0; i < array->GetCount(); i++ )
|
||||
{
|
||||
ResRecord *rec = array->Get( i );
|
||||
int idx = SendDlgItemMessage( hWnd, IDC_RESLIST, LB_ADDSTRING, 0, (LPARAM)rec->fName );
|
||||
SendDlgItemMessage( hWnd, IDC_RESLIST, LB_SETITEMDATA, idx, (LPARAM)rec );
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
if( wParam == IDCANCEL )
|
||||
EndDialog( hWnd, nil );
|
||||
else
|
||||
{
|
||||
int idx = SendDlgItemMessage( hWnd, IDC_RESLIST, LB_GETCURSEL, 0, 0 );
|
||||
if( idx == LB_ERR )
|
||||
EndDialog( hWnd, nil );
|
||||
else
|
||||
{
|
||||
ResRecord *rec = (ResRecord *)SendDlgItemMessage( hWnd, IDC_RESLIST, LB_GETITEMDATA, idx, 0 );
|
||||
EndDialog( hWnd, (int)rec );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IImportFON( HWND hWnd, const char *path )
|
||||
{
|
||||
// FON files are really just resource modules
|
||||
IMakeNewFont();
|
||||
HMODULE file = LoadLibraryEx( path, nil, LOAD_LIBRARY_AS_DATAFILE | DONT_RESOLVE_DLL_REFERENCES );
|
||||
if( file == nil )
|
||||
{
|
||||
char msg[ 512 ], msg2[ 1024 ];
|
||||
|
||||
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nil, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)msg, sizeof( msg ), nil );
|
||||
|
||||
sprintf( msg2, "Failure importing FON file: can't open as resource library (%s)", msg );
|
||||
MessageBox( hWnd, msg2, "Error", MB_OK | MB_ICONEXCLAMATION );
|
||||
}
|
||||
else
|
||||
{
|
||||
hsTArray<ResRecord *> resList;
|
||||
|
||||
if( EnumResourceNames( file, "Font", ResEnumProc, (LPARAM)&resList ) )
|
||||
{
|
||||
// Put up a list of the resources so the user can choose which one
|
||||
ResRecord *res = (ResRecord *)DialogBoxParam( gInstance, MAKEINTRESOURCE( IDD_FONCHOOSER ), hWnd,
|
||||
ResListWndProc, (LPARAM)&resList );
|
||||
if( res != nil )
|
||||
{
|
||||
// Load the resource into a ram stream
|
||||
hsRAMStream stream;
|
||||
|
||||
HGLOBAL glob = LoadResource( file, res->fHandle );
|
||||
if( glob != nil )
|
||||
{
|
||||
void *data = LockResource( glob );
|
||||
if( data != nil )
|
||||
{
|
||||
stream.Write( SizeofResource( file, res->fHandle ), data );
|
||||
stream.Rewind();
|
||||
|
||||
if( !gFont->LoadFromFNTStream( &stream ) )
|
||||
MessageBox( hWnd, "Failure importing FON file: can't parse resource as FNT",
|
||||
"Error", MB_OK | MB_ICONEXCLAMATION );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char msg[ 512 ], msg2[ 1024 ];
|
||||
|
||||
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nil, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)msg, sizeof( msg ), nil );
|
||||
|
||||
sprintf( msg2, "Failure importing FON file: can't enumerate resources (%s)", msg );
|
||||
MessageBox( hWnd, msg2, "Error", MB_OK | MB_ICONEXCLAMATION );
|
||||
}
|
||||
|
||||
UInt32 i;
|
||||
for( i = 0; i < resList.GetCount(); i++ )
|
||||
delete resList[ i ];
|
||||
resList.Reset();
|
||||
|
||||
FreeLibrary( file );
|
||||
}
|
||||
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
|
||||
BOOL CALLBACK FreeTypeDlgProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
static plFontFreeType::Options *info;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
info = (plFontFreeType::Options *)lParam;
|
||||
SetDlgItemInt( hWnd, IDC_PSIZE, info->fSize, false );
|
||||
SetDlgItemInt( hWnd, IDC_RES, info->fScreenRes, false );
|
||||
SetDlgItemInt( hWnd, IDC_MAXCHAR, info->fMaxCharLimit, false );
|
||||
CheckRadioButton( hWnd, IDC_BITDEPTH, IDC_BITDEPTH2, info->fBitDepth == 1 ? IDC_BITDEPTH : IDC_BITDEPTH2 );
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
if( wParam == IDOK || wParam == IDCANCEL || wParam == IDC_BATCH )
|
||||
{
|
||||
info->fSize = GetDlgItemInt( hWnd, IDC_PSIZE, nil, false );
|
||||
info->fScreenRes = GetDlgItemInt( hWnd, IDC_RES, nil, false );
|
||||
info->fMaxCharLimit = GetDlgItemInt( hWnd, IDC_MAXCHAR, nil, false );
|
||||
|
||||
if( IsDlgButtonChecked( hWnd, IDC_BITDEPTH ) )
|
||||
info->fBitDepth = 1;
|
||||
else
|
||||
info->fBitDepth = 8;
|
||||
|
||||
EndDialog( hWnd, wParam );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IBatchFreeType( HWND hWnd, const char *path );
|
||||
|
||||
void IImportFreeType( HWND hWnd, const char *path )
|
||||
{
|
||||
static plFontFreeType::Options info;
|
||||
|
||||
int ret = DialogBoxParam( gInstance, MAKEINTRESOURCE( IDD_FREETYPE ), hWnd, FreeTypeDlgProc, (LPARAM)&info );
|
||||
if( ret == IDCANCEL )
|
||||
return;
|
||||
else if( ret == IDC_BATCH )
|
||||
{
|
||||
IBatchFreeType( hWnd, path );
|
||||
return;
|
||||
}
|
||||
|
||||
IMakeNewFont();
|
||||
HWND dialog = CreateDialog( gInstance, MAKEINTRESOURCE( IDD_PROGRESS ), hWnd, ProgressWndProc );
|
||||
ShowWindow( dialog, SW_SHOW );
|
||||
EnableWindow( hWnd, false );
|
||||
plMyBDFCallback callback( dialog );
|
||||
|
||||
plFontFreeType *ft2Convert = (plFontFreeType *)gFont;
|
||||
if( !ft2Convert->ImportFreeType( path, &info, &callback ) )
|
||||
MessageBox( hWnd, "Failure converting TrueType file", "ERROR", MB_OK | MB_ICONEXCLAMATION );
|
||||
|
||||
DestroyWindow( dialog );
|
||||
EnableWindow( hWnd, true );
|
||||
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
|
||||
static UInt8 sNumSizes = 0;
|
||||
static UInt8 sSizeArray[ 256 ];
|
||||
static char sFontName[ 256 ]; // desired font name for FreeType conversions
|
||||
|
||||
BOOL CALLBACK FreeTypeBatchDlgProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
static plFontFreeType::Options *info;
|
||||
|
||||
switch( message )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
info = (plFontFreeType::Options *)lParam;
|
||||
SetDlgItemText( hWnd, IDC_PSIZE, "12" );
|
||||
SetDlgItemText( hWnd, IDC_FONTNAME, "Untitled" );
|
||||
SetDlgItemInt( hWnd, IDC_RES, info->fScreenRes, false );
|
||||
SetDlgItemInt( hWnd, IDC_MAXCHAR, info->fMaxCharLimit, false );
|
||||
CheckRadioButton( hWnd, IDC_BITDEPTH, IDC_BITDEPTH2, info->fBitDepth == 1 ? IDC_BITDEPTH : IDC_BITDEPTH2 );
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
if( wParam == IDOK || wParam == IDCANCEL )
|
||||
{
|
||||
sNumSizes = 0;
|
||||
|
||||
char *c, *lastC, str[ 1024 ];
|
||||
GetDlgItemText( hWnd, IDC_PSIZE, str, sizeof( str ) );
|
||||
lastC = str;
|
||||
while( ( c = strchr( lastC, ',' ) ) != nil && sNumSizes < 255 )
|
||||
{
|
||||
*c = 0;
|
||||
sSizeArray[ sNumSizes++ ] = atoi( lastC );
|
||||
lastC = c + 1;
|
||||
}
|
||||
|
||||
sSizeArray[ sNumSizes++ ] = atoi( lastC );
|
||||
|
||||
info->fScreenRes = GetDlgItemInt( hWnd, IDC_RES, nil, false );
|
||||
info->fMaxCharLimit = GetDlgItemInt( hWnd, IDC_MAXCHAR, nil, false );
|
||||
|
||||
if( IsDlgButtonChecked( hWnd, IDC_BITDEPTH ) )
|
||||
info->fBitDepth = 1;
|
||||
else
|
||||
info->fBitDepth = 8;
|
||||
|
||||
GetDlgItemText( hWnd, IDC_FONTNAME, sFontName, sizeof(sFontName) );
|
||||
|
||||
EndDialog( hWnd, wParam );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IBatchFreeType( HWND hWnd, const char *path )
|
||||
{
|
||||
static plFontFreeType::Options info;
|
||||
|
||||
if( DialogBoxParam( gInstance, MAKEINTRESOURCE( IDD_FREETYPEBATCH ), hWnd, FreeTypeBatchDlgProc, (LPARAM)&info ) == IDCANCEL )
|
||||
return;
|
||||
|
||||
BROWSEINFO bInfo;
|
||||
LPITEMIDLIST itemList;
|
||||
LPMALLOC shMalloc;
|
||||
static char destPath[ MAX_PATH ] = "";
|
||||
|
||||
memset( &bInfo, 0, sizeof( bInfo ) );
|
||||
bInfo.hwndOwner = hWnd;
|
||||
bInfo.pidlRoot = NULL;
|
||||
bInfo.pszDisplayName = destPath;
|
||||
bInfo.lpszTitle = "Select a path to write the P2F fonts to:";
|
||||
bInfo.ulFlags = BIF_EDITBOX;
|
||||
|
||||
itemList = SHBrowseForFolder( &bInfo );
|
||||
if( itemList != NULL )
|
||||
{
|
||||
SHGetPathFromIDList( itemList, destPath );
|
||||
SHGetMalloc( &shMalloc );
|
||||
shMalloc->Free( itemList );
|
||||
shMalloc->Release();
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
HWND dialog = CreateDialog( gInstance, MAKEINTRESOURCE( IDD_PROGRESS ), hWnd, ProgressWndProc );
|
||||
ShowWindow( dialog, SW_SHOW );
|
||||
EnableWindow( hWnd, false );
|
||||
plMyBDFCallback callback( dialog );
|
||||
|
||||
callback.NumChars( sNumSizes );
|
||||
UInt8 i;
|
||||
for( i = 0; i < sNumSizes; i++ )
|
||||
{
|
||||
IMakeNewFont();
|
||||
plFontFreeType *ft2Convert = (plFontFreeType *)gFont;
|
||||
|
||||
info.fSize = sSizeArray[ i ];
|
||||
if( !ft2Convert->ImportFreeType( path, &info, nil ) )
|
||||
{
|
||||
MessageBox( hWnd, "Failure converting TrueType file", "ERROR", MB_OK | MB_ICONEXCLAMATION );
|
||||
continue;
|
||||
}
|
||||
|
||||
gFont->SetFace(sFontName);
|
||||
char fileName[ MAX_PATH ];
|
||||
sprintf( fileName, "%s\\%s-%d.p2f", destPath, gFont->GetFace(), gFont->GetSize() );
|
||||
hsUNIXStream stream;
|
||||
if( !stream.Open( fileName, "wb" ) )
|
||||
MessageBox( hWnd, "Can't open file for writing", "Error", MB_OK | MB_ICONEXCLAMATION );
|
||||
else
|
||||
{
|
||||
gFont->WriteRaw( &stream );
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
callback.CharDone();
|
||||
}
|
||||
|
||||
DestroyWindow( dialog );
|
||||
EnableWindow( hWnd, true );
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
|
||||
BOOL CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
char fileName[ MAX_PATH ];
|
||||
PAINTSTRUCT paintInfo;
|
||||
HDC myDC;
|
||||
RECT r;
|
||||
|
||||
|
||||
switch( message )
|
||||
{
|
||||
case WM_PAINT:
|
||||
myDC = BeginPaint( hWnd, &paintInfo );
|
||||
|
||||
GetClientRect( GetDlgItem( hWnd, IDC_PREVIEW ), &r );
|
||||
MapWindowPoints( GetDlgItem( hWnd, IDC_PREVIEW ), hWnd, (POINT *)&r, 2 );
|
||||
|
||||
if( gPreviewHDC != nil )
|
||||
BitBlt( myDC, r.left, r.top, r.right - r.left, r.bottom - r.top, gPreviewHDC, 0, 0, SRCCOPY );
|
||||
else
|
||||
FillRect( myDC, &r, GetSysColorBrush( COLOR_3DFACE ) );
|
||||
|
||||
DrawEdge( myDC, &r, EDGE_SUNKEN, BF_RECT );
|
||||
|
||||
EndPaint( hWnd, &paintInfo );
|
||||
return 0;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
SendMessage( hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon( gInstance, MAKEINTRESOURCE( IDI_APPICON ) ) );
|
||||
SetDlgItemTextW( hWnd, IDC_PREVTEXT, L"The quick brown fox jumped over the lazy dog! ABCabc012345;,." );
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
if( wParam == ID_FILE_ABOUT )
|
||||
{
|
||||
DialogBox( gInstance, MAKEINTRESOURCE( IDD_ABOUT ), hWnd, AboutDialogProc );
|
||||
}
|
||||
else if( wParam == ID_FILE_EXIT )
|
||||
PostQuitMessage( 0 );
|
||||
else if( wParam == ID_FILE_FNT )
|
||||
{
|
||||
fileName[ 0 ] = 0;
|
||||
if( PromptForFile( hWnd, "Choose a FNT file to convert", "Windows FNT files\0*.fnt\0All files\0*.*\0", fileName, sizeof( fileName ), false ) )
|
||||
IImportFNT( hWnd, fileName );
|
||||
}
|
||||
else if( wParam == ID_FILE_P2F )
|
||||
{
|
||||
fileName[ 0 ] = 0;
|
||||
if( PromptForFile( hWnd, "Choose a P2F file to open", "Plasma 2 font files\0*.p2f\0All files\0*.*\0", fileName, sizeof( fileName ), false ) )
|
||||
IOpenP2F( hWnd, fileName );
|
||||
}
|
||||
else if( wParam == ID_FILE_FON )
|
||||
{
|
||||
fileName[ 0 ] = 0;
|
||||
if( PromptForFile( hWnd, "Choose a FON file to convert", "Windows FON files\0*.fon\0All files\0*.*\0", fileName, sizeof( fileName ), false ) )
|
||||
IImportFON( hWnd, fileName );
|
||||
}
|
||||
else if( wParam == ID_FILE_TRUETYPE )
|
||||
{
|
||||
fileName[ 0 ] = 0;
|
||||
if( PromptForFile( hWnd, "Choose a TrueType font to convert", "TrueType files\0*.ttf\0TrueType Collections\0*.ttc\0All files\0*.*\0", fileName, sizeof( fileName ), false ) )
|
||||
IBatchFreeType( hWnd, fileName );
|
||||
}
|
||||
else if( wParam == ID_FILE_EXPORT )
|
||||
{
|
||||
// Grab updated values for the font
|
||||
GetDlgItemText( hWnd, IDC_FACE, fileName, sizeof( fileName ) );
|
||||
gFont->SetFace( fileName );
|
||||
gFont->SetSize( GetDlgItemInt( hWnd, IDC_FSIZE, nil, false ) );
|
||||
gFont->SetFlag( plFont::kFlagBold, IsDlgButtonChecked( hWnd, IDC_BOLD ) == BST_CHECKED );
|
||||
gFont->SetFlag( plFont::kFlagItalic, IsDlgButtonChecked( hWnd, IDC_ITALIC ) == BST_CHECKED );
|
||||
|
||||
// Write out
|
||||
sprintf( fileName, "%s-%d.p2f", gFont->GetFace(), gFont->GetSize() );
|
||||
if( PromptForFile( hWnd, "Specify a file to export to", "Plasma 2 font files\0*.p2f\0", fileName, sizeof( fileName ), true ) )
|
||||
{
|
||||
hsUNIXStream stream;
|
||||
if( !stream.Open( fileName, "wb" ) )
|
||||
MessageBox( hWnd, "Can't open file for writing", "Error", MB_OK | MB_ICONEXCLAMATION );
|
||||
else
|
||||
{
|
||||
/* sprintf( fileName, "%s-%d", gFont->GetFace(), gFont->GetSize() );
|
||||
|
||||
if( gFont->GetKey() == nil )
|
||||
hsgResMgr::ResMgr()->NewKey( fileName, gFont, plLocation::kGlobalFixedLoc );
|
||||
|
||||
*/
|
||||
gFont->WriteRaw( &stream );
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( LOWORD( wParam ) == IDC_PREVTEXT && HIWORD( wParam ) == EN_CHANGE )
|
||||
{
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
return true;
|
||||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage( 0 );
|
||||
return true;
|
||||
|
||||
case WM_DROPFILES:
|
||||
{
|
||||
int i, fileCount = DragQueryFile( (HDROP)wParam, -1, nil, nil );
|
||||
char path[ MAX_PATH ];
|
||||
|
||||
|
||||
for( i = 0; i < fileCount; i++ )
|
||||
{
|
||||
if( DragQueryFile( (HDROP)wParam, i, path, sizeof( path ) ) > 0 )
|
||||
{
|
||||
char *ext = PathFindExtension( path );
|
||||
if( stricmp( ext, ".fnt" ) == 0 )
|
||||
IImportFNT( hWnd, path );
|
||||
else if( stricmp( ext, ".bdf" ) == 0 )
|
||||
IImportBDF( hWnd, path );
|
||||
else if( stricmp( ext, ".fon" ) == 0 )
|
||||
IImportFON( hWnd, path );
|
||||
else if( stricmp( ext, ".exe" ) == 0 )
|
||||
IImportFON( hWnd, path );
|
||||
else if(( stricmp( ext, ".ttf" ) == 0 ) || ( stricmp( ext, ".ttc" ) == 0 ))
|
||||
IImportFreeType( hWnd, path );
|
||||
else if( stricmp( ext, ".p2f" ) == 0 )
|
||||
IOpenP2F( hWnd, path );
|
||||
else
|
||||
// Try using our freeType converter
|
||||
IImportFreeType( hWnd, path );
|
||||
}
|
||||
}
|
||||
|
||||
IUpdateInfo( hWnd );
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;//DefWindowProc( hWnd, message, wParam, lParam );
|
||||
}
|
||||
|
265
Sources/Tools/plFontConverter/plFontFreeType.cpp
Normal file
265
Sources/Tools/plFontConverter/plFontFreeType.cpp
Normal file
@ -0,0 +1,265 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// plFontFreeType Functions //
|
||||
// Basically our cheat to allow importing fonts via FreeType2 into our //
|
||||
// plFont system without having to make plFont.cpp reliant on FreeType2. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "plFontFreeType.h"
|
||||
|
||||
#include "ft2build.h"
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_GLYPH_H
|
||||
#include FT_TYPES_H
|
||||
|
||||
#define kMaxGlyphs 65536
|
||||
|
||||
|
||||
|
||||
hsBool plFontFreeType::ImportFreeType( const char *fontPath, Options *options, plBDFConvertCallback *callback )
|
||||
{
|
||||
FT_Library ftLibrary;
|
||||
|
||||
|
||||
IClear();
|
||||
|
||||
// Init FreeType2
|
||||
FT_Error error = FT_Init_FreeType( &ftLibrary );
|
||||
if( error )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// Load our font that we're converting
|
||||
FT_Face ftFace;
|
||||
error = FT_New_Face( ftLibrary, fontPath, 0, &ftFace );
|
||||
if( error == FT_Err_Unknown_File_Format )
|
||||
{
|
||||
// Unsupported inport format
|
||||
throw false;
|
||||
}
|
||||
else if( error )
|
||||
{
|
||||
// Some other error
|
||||
throw false;
|
||||
}
|
||||
|
||||
// Set our point size to convert to
|
||||
error = FT_Set_Char_Size( ftFace, 0, options->fSize * 64, options->fScreenRes, options->fScreenRes ); // Size is in 1/64ths of a point
|
||||
if( error )
|
||||
{
|
||||
throw false;
|
||||
}
|
||||
|
||||
// Run through our glyphs, loading them into a temp array and calcing bounding boxes for them
|
||||
FT_GlyphSlot ftSlot = ftFace->glyph;
|
||||
FT_ULong ftChar;
|
||||
FT_UInt ftIndex;
|
||||
UInt32 numGlyphs = 0, totalHeight = 0, maxChar = 0, i;
|
||||
FT_Glyph ftGlyphs[ kMaxGlyphs ];
|
||||
UInt16 glyphChars[ kMaxGlyphs ];
|
||||
FT_Vector ftAdvances[ kMaxGlyphs ];
|
||||
FT_BBox ftGlyphBox, ftFontBox;
|
||||
FT_UInt previous = 0;
|
||||
hsBool useKerning = false;
|
||||
|
||||
|
||||
if( options->fUseKerning )
|
||||
useKerning = FT_HAS_KERNING( ftFace );
|
||||
|
||||
ftFontBox.xMin = ftFontBox.yMin = 32000;
|
||||
ftFontBox.xMax = ftFontBox.yMax = -32000;
|
||||
|
||||
// Hack for now: if we don't have a charmap active already, just choose the first one
|
||||
if( ftFace->charmap == nil )
|
||||
{
|
||||
if( ftFace->num_charmaps == 0 )
|
||||
throw false;
|
||||
|
||||
FT_Set_Charmap( ftFace, ftFace->charmaps[ 0 ] );
|
||||
}
|
||||
|
||||
ftChar = FT_Get_First_Char( ftFace, &ftIndex );
|
||||
while( ftIndex != 0 && numGlyphs < kMaxGlyphs )
|
||||
{
|
||||
error = FT_Load_Glyph( ftFace, ftIndex, FT_LOAD_DEFAULT );
|
||||
if( !error && ftChar <= options->fMaxCharLimit )
|
||||
{
|
||||
|
||||
// Got this glyph, store it and update our bounding box
|
||||
error = FT_Get_Glyph( ftFace->glyph, &ftGlyphs[ numGlyphs ] );
|
||||
if( error )
|
||||
throw false;
|
||||
|
||||
// Don't know why this isn't valid per actual glyph...
|
||||
ftAdvances[ numGlyphs ] = ftSlot->advance;
|
||||
|
||||
FT_Glyph_Get_CBox( ftGlyphs[ numGlyphs ], ft_glyph_bbox_pixels, &ftGlyphBox );
|
||||
if( ftGlyphBox.xMin < ftFontBox.xMin )
|
||||
ftFontBox.xMin = ftGlyphBox.xMin;
|
||||
if( ftGlyphBox.yMin < ftFontBox.yMin )
|
||||
ftFontBox.yMin = ftGlyphBox.yMin;
|
||||
if( ftGlyphBox.xMax > ftFontBox.xMax )
|
||||
ftFontBox.xMax = ftGlyphBox.xMax;
|
||||
if( ftGlyphBox.yMax > ftFontBox.yMax )
|
||||
ftFontBox.yMax = ftGlyphBox.yMax;
|
||||
|
||||
totalHeight += ftGlyphBox.yMax - ftGlyphBox.yMin + 1;
|
||||
|
||||
if( maxChar < ftChar )
|
||||
maxChar = ftChar;
|
||||
glyphChars[ numGlyphs ] = (UInt16)ftChar;
|
||||
|
||||
numGlyphs++;
|
||||
}
|
||||
|
||||
ftChar = FT_Get_Next_Char( ftFace, ftChar, &ftIndex );
|
||||
}
|
||||
|
||||
// Init some of our font properties
|
||||
fBPP = options->fBitDepth;
|
||||
fWidth = ( ftFontBox.xMax - ftFontBox.xMin + 1 );
|
||||
if( fBPP == 1 )
|
||||
fWidth = ( ( fWidth + 7 ) >> 3 ) << 3;
|
||||
fHeight = totalHeight;
|
||||
fBMapData = new UInt8[ ( fWidth * fHeight * fBPP ) >> 3 ];
|
||||
memset( fBMapData, 0, ( fWidth * fHeight * fBPP ) >> 3 );
|
||||
|
||||
// Set the name and size of our font
|
||||
fSize = options->fSize;
|
||||
char str[ 512 ];
|
||||
|
||||
if( ftFace->style_flags & FT_STYLE_FLAG_ITALIC )
|
||||
SetFlag( kFlagItalic, true );
|
||||
if( ftFace->style_flags & FT_STYLE_FLAG_BOLD )
|
||||
SetFlag( kFlagBold, true );
|
||||
|
||||
if( IsFlagSet( kFlagItalic | kFlagBold ) )
|
||||
sprintf( str, "%s %s", ftFace->family_name, ftFace->style_name );
|
||||
else
|
||||
strcpy( str, ftFace->family_name );
|
||||
SetFace( str );
|
||||
|
||||
// # of bytes per row
|
||||
UInt32 stride = ( fBPP == 1 ) ? ( fWidth >> 3 ) : fWidth;
|
||||
|
||||
// Pre-expand our char list
|
||||
fCharacters.ExpandAndZero( maxChar + 1 );
|
||||
fCharacters.SetCount( 0 );
|
||||
if( callback != nil )
|
||||
callback->NumChars( (UInt16)(maxChar + 1) );
|
||||
|
||||
// Now re-run through our stored list of glyphs, converting them to bitmaps
|
||||
for( i = 0; i < numGlyphs; i++ )
|
||||
{
|
||||
if( ftGlyphs[ i ]->format != ft_glyph_format_bitmap )
|
||||
{
|
||||
FT_Vector origin;
|
||||
origin.x = 32; // Half a pixel over
|
||||
origin.y = 0;
|
||||
|
||||
error = FT_Glyph_To_Bitmap( &ftGlyphs[ i ], ( fBPP == 1 ) ? ft_render_mode_mono : ft_render_mode_normal, &origin, 0 );
|
||||
if( error )
|
||||
throw false;
|
||||
}
|
||||
|
||||
if( fCharacters.GetCount() < glyphChars[ i ] + 1 )
|
||||
fCharacters.SetCount( glyphChars[ i ] + 1 );
|
||||
|
||||
FT_BitmapGlyph ftBitmap = (FT_BitmapGlyph)ftGlyphs[ i ];
|
||||
plCharacter *ch = &fCharacters[ glyphChars[ i ] ];
|
||||
|
||||
UInt8 *ourBitmap = IGetFreeCharData( ch->fBitmapOff );
|
||||
if( ourBitmap == nil )
|
||||
throw false;
|
||||
|
||||
if( ch->fBitmapOff > ( ( fWidth * ( fHeight - ftBitmap->bitmap.rows ) * fBPP ) >> 3 ) )
|
||||
{
|
||||
hsAssert( false, "Invalid position found in IGetFreeCharData()" );
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Set these now, since setting them before would've changed the IGetFreeCharData results
|
||||
ch->fLeftKern = (hsScalar)ftBitmap->left;
|
||||
ch->fRightKern = (hsScalar)ftAdvances[ i ].x / 64.f - (hsScalar)fWidth - ch->fLeftKern;//ftBitmap->bitmap.width;
|
||||
ch->fBaseline = ftBitmap->top;
|
||||
ch->fHeight = ftBitmap->bitmap.rows;
|
||||
|
||||
// Copy data straight through to our bitmap
|
||||
int y;
|
||||
UInt8 *srcData = (UInt8 *)ftBitmap->bitmap.buffer;
|
||||
|
||||
UInt32 bytesWide = ( fBPP == 1 ) ? ( ( ftBitmap->bitmap.width + 7 ) >> 3 ) : ftBitmap->bitmap.width;
|
||||
|
||||
for( y = 0; y < ch->fHeight; y++ )
|
||||
{
|
||||
memcpy( ourBitmap, srcData, bytesWide );
|
||||
srcData += ftBitmap->bitmap.pitch;
|
||||
ourBitmap += stride;
|
||||
}
|
||||
|
||||
FT_Done_Glyph( ftGlyphs[ i ] );
|
||||
|
||||
if( callback != nil )
|
||||
callback->CharDone();
|
||||
}
|
||||
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// Shut down FreeType2
|
||||
FT_Done_FreeType( ftLibrary );
|
||||
return false;
|
||||
}
|
||||
|
||||
ICalcFontAscent();
|
||||
|
||||
// Shut down FreeType2
|
||||
FT_Done_FreeType( ftLibrary );
|
||||
return true;
|
||||
}
|
68
Sources/Tools/plFontConverter/plFontFreeType.h
Normal file
68
Sources/Tools/plFontConverter/plFontFreeType.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// plFontFreeType Functions //
|
||||
// Basically our cheat to allow importing fonts via FreeType2 into our //
|
||||
// plFont system without having to make plFont.cpp reliant on FreeType2. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "plFont.h"
|
||||
|
||||
class plFontFreeType : public plFont
|
||||
{
|
||||
public:
|
||||
|
||||
struct Options
|
||||
{
|
||||
UInt8 fSize;
|
||||
hsBool fUseKerning;
|
||||
UInt8 fBitDepth;
|
||||
UInt32 fScreenRes;
|
||||
UInt32 fMaxCharLimit;
|
||||
|
||||
Options() { fSize = 12; fUseKerning = false; fBitDepth = 1; fScreenRes = 96; fMaxCharLimit = 255; }
|
||||
};
|
||||
|
||||
hsBool ImportFreeType( const char *fontPath, Options *options, plBDFConvertCallback *callback );
|
||||
};
|
BIN
Sources/Tools/plFontConverter/res/icon1.ico
Normal file
BIN
Sources/Tools/plFontConverter/res/icon1.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
277
Sources/Tools/plFontConverter/res/plFontConverter.rc
Normal file
277
Sources/Tools/plFontConverter/res/plFontConverter.rc
Normal file
@ -0,0 +1,277 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_APPICON ICON DISCARDABLE "icon1.ico"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 247, 57
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About plFontConverter"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,190,7,50,14
|
||||
ICON IDI_APPICON,IDC_STATIC,11,8,20,20
|
||||
LTEXT "plFontConverter\n\nA simple Plasma 2.0 utility for converting public font formats into our own bitmap font format",
|
||||
IDC_STATIC,40,7,140,43
|
||||
END
|
||||
|
||||
IDD_MAINDIALOG DIALOGEX 100, 100, 241, 170
|
||||
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "plFontConverter"
|
||||
MENU IDR_APPMENU
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
PUSHBUTTON "Export P2F...",ID_FILE_EXPORT,184,7,50,14
|
||||
LTEXT "Face:",IDC_STATIC,7,9,19,8
|
||||
LTEXT "Size:",IDC_STATIC,10,26,16,8
|
||||
EDITTEXT IDC_FACE,27,7,148,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_FSIZE,27,24,30,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "Starting glyph:",IDC_STATIC,10,43,46,8
|
||||
LTEXT "Glyph count:",IDC_STATIC,87,43,41,8
|
||||
LTEXT "0",IDC_STARTG,58,42,22,12,SS_SUNKEN
|
||||
LTEXT "0",IDC_GCOUNT,130,42,22,12,SS_SUNKEN
|
||||
LTEXT "Bitmap width:",IDC_STATIC,13,58,43,8
|
||||
LTEXT "0",IDC_WIDTH,58,57,22,12,SS_SUNKEN
|
||||
LTEXT "Bitmap height:",IDC_STATIC,83,58,46,8
|
||||
LTEXT "0",IDC_HEIGHT,130,57,22,12,SS_SUNKEN
|
||||
LTEXT "BPP:",IDC_STATIC,160,57,17,8
|
||||
LTEXT "0",IDC_BPP,179,56,22,12,SS_SUNKEN
|
||||
CONTROL "",IDC_PREVIEW,"Static",SS_WHITEFRAME | SS_SUNKEN | NOT
|
||||
WS_VISIBLE,7,73,227,73
|
||||
CONTROL "Bold",IDC_BOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,
|
||||
26,30,10
|
||||
CONTROL "Italic",IDC_ITALIC,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,97,26,31,10
|
||||
EDITTEXT IDC_PREVTEXT,7,149,227,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
IDD_FONCHOOSER DIALOG DISCARDABLE 0, 0, 166, 161
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "FON Resource List"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,109,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,109,24,50,14
|
||||
LTEXT "Choose which resource to import:",IDC_STATIC,7,7,93,18
|
||||
LISTBOX IDC_RESLIST,7,27,97,127,LBS_SORT | LBS_NOINTEGRALHEIGHT |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_PROGRESS DIALOG DISCARDABLE 0, 0, 230, 25
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
|
||||
CAPTION "Importing font..."
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH |
|
||||
WS_BORDER,7,7,216,11
|
||||
END
|
||||
|
||||
IDD_FREETYPE DIALOG DISCARDABLE 0, 0, 234, 68
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "FreeType Import Options"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,177,47,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,115,47,50,14
|
||||
LTEXT "Render Point Size:",IDC_STATIC,7,10,60,8
|
||||
EDITTEXT IDC_PSIZE,70,8,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "Monochrome",IDC_BITDEPTH,"Button",BS_AUTORADIOBUTTON,
|
||||
120,27,57,10
|
||||
CONTROL "Grayscale",IDC_BITDEPTH2,"Button",BS_AUTORADIOBUTTON,
|
||||
180,27,47,10
|
||||
LTEXT "Screen Resolution:",IDC_STATIC,7,28,61,8
|
||||
EDITTEXT IDC_RES,70,26,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "Max Character:",IDC_STATIC,132,10,49,8
|
||||
EDITTEXT IDC_MAXCHAR,183,8,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
PUSHBUTTON "Batch...",IDC_BATCH,7,47,50,14
|
||||
END
|
||||
|
||||
IDD_FREETYPEBATCH DIALOG DISCARDABLE 0, 0, 234, 114
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "FreeType Import Options"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,177,93,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,115,93,50,14
|
||||
LTEXT "Render Point Sizes:",IDC_STATIC,7,10,63,8
|
||||
EDITTEXT IDC_PSIZE,71,8,156,14,ES_AUTOHSCROLL
|
||||
CONTROL "Monochrome",IDC_BITDEPTH,"Button",BS_AUTORADIOBUTTON,58,
|
||||
58,57,10
|
||||
CONTROL "Grayscale",IDC_BITDEPTH2,"Button",BS_AUTORADIOBUTTON,
|
||||
118,58,47,10
|
||||
LTEXT "Screen Resolution:",IDC_STATIC,117,41,61,8
|
||||
EDITTEXT IDC_RES,180,39,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
LTEXT "Max Character:",IDC_STATIC,15,41,49,8
|
||||
EDITTEXT IDC_MAXCHAR,67,39,40,14,ES_AUTOHSCROLL | ES_NUMBER
|
||||
GROUPBOX "Common Settings",IDC_STATIC,7,27,220,45
|
||||
LTEXT "Font name:",IDC_STATIC,7,77,36,8
|
||||
EDITTEXT IDC_FONTNAME,49,75,178,14,ES_AUTOHSCROLL
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 240
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 50
|
||||
END
|
||||
|
||||
IDD_MAINDIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 234
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 163
|
||||
END
|
||||
|
||||
IDD_FONCHOOSER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 159
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 154
|
||||
END
|
||||
|
||||
IDD_PROGRESS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 223
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 18
|
||||
END
|
||||
|
||||
IDD_FREETYPE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 227
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 61
|
||||
END
|
||||
|
||||
IDD_FREETYPEBATCH, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 227
|
||||
TOPMARGIN, 8
|
||||
BOTTOMMARGIN, 107
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_APPMENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "Import FNT...", ID_FILE_FNT
|
||||
MENUITEM "Import BDF...", ID_FILE_BDF
|
||||
MENUITEM "Import FON...", ID_FILE_FON
|
||||
MENUITEM "Open P2F...", ID_FILE_P2F
|
||||
MENUITEM "Batch Convert TrueType...", ID_FILE_TRUETYPE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Export P2F...", ID_FILE_EXPORT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "About...", ID_FILE_ABOUT
|
||||
MENUITEM "Exit", ID_FILE_EXIT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE
|
||||
BEGIN
|
||||
"A", ID_FILE_ABOUT, VIRTKEY, CONTROL, NOINVERT
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
52
Sources/Tools/plFontConverter/res/resource.h
Normal file
52
Sources/Tools/plFontConverter/res/resource.h
Normal file
@ -0,0 +1,52 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by plFontConverter.rc
|
||||
//
|
||||
#define IDI_APPICON 101
|
||||
#define IDR_APPMENU 102
|
||||
#define IDD_MAINDIALOG 103
|
||||
#define IDD_ABOUT 104
|
||||
#define IDD_FONCHOOSER 105
|
||||
#define IDR_ACCELERATOR1 106
|
||||
#define IDD_PROGRESS 106
|
||||
#define IDD_FREETYPE 107
|
||||
#define IDD_FREETYPEBATCH 108
|
||||
#define IDC_FACE 1002
|
||||
#define IDC_FSIZE 1003
|
||||
#define IDC_STARTG 1004
|
||||
#define IDC_GCOUNT 1005
|
||||
#define IDC_WIDTH 1006
|
||||
#define IDC_HEIGHT 1007
|
||||
#define IDC_BPP 1008
|
||||
#define IDC_PREVIEW 1010
|
||||
#define IDC_RESLIST 1011
|
||||
#define IDC_BOLD 1012
|
||||
#define IDC_ITALIC 1013
|
||||
#define IDC_PROGRESS 1014
|
||||
#define IDC_PREVTEXT 1015
|
||||
#define IDC_PSIZE 1016
|
||||
#define IDC_BITDEPTH 1017
|
||||
#define IDC_BITDEPTH2 1018
|
||||
#define IDC_RES 1019
|
||||
#define IDC_MAXCHAR 1020
|
||||
#define IDC_BATCH 1021
|
||||
#define IDC_FONTNAME 1022
|
||||
#define ID_FILE_FNT 40000
|
||||
#define ID_FILE_EXPORT 40001
|
||||
#define ID_FILE_EXIT 40002
|
||||
#define ID_FILE_BDF 40003
|
||||
#define ID_FILE_ABOUT 40004
|
||||
#define ID_FILE_P2F 40005
|
||||
#define ID_FILE_FON 40006
|
||||
#define ID_FILE_TRUETYPE 40007
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 108
|
||||
#define _APS_NEXT_COMMAND_VALUE 40008
|
||||
#define _APS_NEXT_CONTROL_VALUE 1023
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Reference in New Issue
Block a user