Michael Hansen
11 years ago
23 changed files with 1626 additions and 1177 deletions
@ -0,0 +1,86 @@ |
|||||||
|
/*==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==*/ |
||||||
|
#ifndef _plFontConverter_h |
||||||
|
#define _plFontConverter_h |
||||||
|
|
||||||
|
#include <QMainWindow> |
||||||
|
|
||||||
|
class plFont; |
||||||
|
class plFileName; |
||||||
|
|
||||||
|
class plFontConverter : public QMainWindow |
||||||
|
{ |
||||||
|
Q_OBJECT |
||||||
|
|
||||||
|
public: |
||||||
|
plFontConverter(); |
||||||
|
virtual ~plFontConverter(); |
||||||
|
|
||||||
|
private slots: |
||||||
|
void OpenFNT(); |
||||||
|
void OpenBDF(); |
||||||
|
void OpenFON(); |
||||||
|
void OpenTTF(); |
||||||
|
void OpenP2F(); |
||||||
|
void ExportP2F(); |
||||||
|
|
||||||
|
protected: |
||||||
|
virtual void dragEnterEvent(QDragEnterEvent *event); |
||||||
|
virtual void dropEvent(QDropEvent *event); |
||||||
|
|
||||||
|
private: |
||||||
|
class Ui_MainDialog *fUI; |
||||||
|
plFont *fFont; |
||||||
|
|
||||||
|
void IMakeFontGoAway(); |
||||||
|
void IMakeNewFont(); |
||||||
|
void IUpdateInfo(); |
||||||
|
|
||||||
|
void IImportFNT(const plFileName &path); |
||||||
|
void IImportBDF(const plFileName &path); |
||||||
|
void IImportFON(const plFileName &path); |
||||||
|
void IBatchFreeType(const plFileName &path, void *init = nullptr); |
||||||
|
void IImportFreeType(const plFileName &path); |
||||||
|
void IOpenP2F(const plFileName &path); |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
@ -1,756 +0,0 @@ |
|||||||
/*==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 "hsWindows.h" |
|
||||||
#include "res/resource.h" |
|
||||||
#include <shlwapi.h> |
|
||||||
#include <shellapi.h> |
|
||||||
#include <shlobj.h> |
|
||||||
#include <commdlg.h> |
|
||||||
#include <commctrl.h> |
|
||||||
#include <ctime> |
|
||||||
|
|
||||||
#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().c_str() ); |
|
||||||
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_t)(r.right - r.left), (int16_t)(r.bottom - r.top) ); |
|
||||||
uint16_t w, h, a, lastX, lastY; |
|
||||||
uint32_t 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_t 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_t 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_t 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_t 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, 0 ); |
|
||||||
else |
|
||||||
{ |
|
||||||
int idx = SendDlgItemMessage( hWnd, IDC_RESLIST, LB_GETCURSEL, 0, 0 ); |
|
||||||
if( idx == LB_ERR ) |
|
||||||
EndDialog( hWnd, 0 ); |
|
||||||
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_t 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_t sNumSizes = 0; |
|
||||||
static uint8_t 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_t 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().c_str(), 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().c_str(), 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, 0 ); |
|
||||||
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 );
|
|
||||||
} |
|
||||||
|
|
@ -0,0 +1,115 @@ |
|||||||
|
/*==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 "plFontPreview.h" |
||||||
|
|
||||||
|
#include "plGImage/plFont.h" |
||||||
|
#include "plGImage/plMipmap.h" |
||||||
|
|
||||||
|
#include <QPainter> |
||||||
|
#include <QPicture> |
||||||
|
|
||||||
|
#include <memory> |
||||||
|
|
||||||
|
void plFontPreview::Update(plFont *font, const QString &text) |
||||||
|
{ |
||||||
|
fFont = font; |
||||||
|
fText = text; |
||||||
|
fPreview = QImage(width(), height(), QImage::Format_ARGB32); |
||||||
|
|
||||||
|
if (fFont == nullptr) { |
||||||
|
QPainter p(&fPreview); |
||||||
|
p.fillRect(0, 0, width(), height(), Qt::white); |
||||||
|
|
||||||
|
update(); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
plString testString = text.toUtf8().constData(); |
||||||
|
|
||||||
|
// Create us a mipmap to render onto, render onto it, then copy that to our DC
|
||||||
|
plMipmap *mip = new plMipmap(width(), height(), plMipmap::kARGB32Config, 1); |
||||||
|
memset(mip->GetImage(), 0xff, mip->GetWidth() * mip->GetHeight() * 4); |
||||||
|
|
||||||
|
fFont->SetRenderColor(0xff000000); |
||||||
|
fFont->SetRenderFlag(plFont::kRenderClip, true); |
||||||
|
fFont->SetRenderClipRect(0, 0, (int16_t)width(), (int16_t)height()); |
||||||
|
uint16_t w, h, a, lastX, lastY; |
||||||
|
uint32_t firstCC; |
||||||
|
fFont->CalcStringExtents(testString, w, h, a, firstCC, lastX, lastY); |
||||||
|
|
||||||
|
int cY = ((height() - h) >> 1) + a; |
||||||
|
|
||||||
|
if (cY < 0) |
||||||
|
cY = 0; |
||||||
|
else if (cY > height() - 1) |
||||||
|
cY = height() - 1; |
||||||
|
|
||||||
|
memset(mip->GetAddr32(8, cY), 0xc0, (width() - 8) * 4); |
||||||
|
|
||||||
|
fFont->RenderString(mip, 8, cY, testString); |
||||||
|
|
||||||
|
int x, y; |
||||||
|
for (y = 0; y < height(); y++) { |
||||||
|
for (x = 0; x < width(); x++) { |
||||||
|
uint32_t color = *mip->GetAddr32(x, y); |
||||||
|
|
||||||
|
if (color != 0xffffffff && color != 0xff000000) |
||||||
|
{ |
||||||
|
int q = 0; |
||||||
|
} |
||||||
|
// One pixel at a time? Surely we can do better...
|
||||||
|
// But for now this is a pure port
|
||||||
|
fPreview.setPixel(x, y, color | 0xff000000); |
||||||
|
} |
||||||
|
} |
||||||
|
delete mip; |
||||||
|
|
||||||
|
update(); |
||||||
|
} |
||||||
|
|
||||||
|
void plFontPreview::paintEvent(QPaintEvent *event) |
||||||
|
{ |
||||||
|
QPainter painter(this); |
||||||
|
painter.drawImage(0, 0, fPreview); |
||||||
|
|
||||||
|
QFrame::paintEvent(event); |
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<ui version="4.0"> |
||||||
|
<class>FonChooser</class> |
||||||
|
<widget class="QDialog" name="FonChooser"> |
||||||
|
<property name="geometry"> |
||||||
|
<rect> |
||||||
|
<x>0</x> |
||||||
|
<y>0</y> |
||||||
|
<width>270</width> |
||||||
|
<height>260</height> |
||||||
|
</rect> |
||||||
|
</property> |
||||||
|
<property name="windowTitle"> |
||||||
|
<string>FON Resource List</string> |
||||||
|
</property> |
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||||
|
<item> |
||||||
|
<layout class="QVBoxLayout" name="verticalLayout"> |
||||||
|
<item> |
||||||
|
<widget class="QLabel" name="label"> |
||||||
|
<property name="text"> |
||||||
|
<string>Choose which resource to import:</string> |
||||||
|
</property> |
||||||
|
<property name="wordWrap"> |
||||||
|
<bool>true</bool> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QListWidget" name="fResourceList"/> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QDialogButtonBox" name="buttonBox"> |
||||||
|
<property name="orientation"> |
||||||
|
<enum>Qt::Vertical</enum> |
||||||
|
</property> |
||||||
|
<property name="standardButtons"> |
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</widget> |
||||||
|
<resources/> |
||||||
|
<connections> |
||||||
|
<connection> |
||||||
|
<sender>buttonBox</sender> |
||||||
|
<signal>accepted()</signal> |
||||||
|
<receiver>FonChooser</receiver> |
||||||
|
<slot>accept()</slot> |
||||||
|
<hints> |
||||||
|
<hint type="sourcelabel"> |
||||||
|
<x>248</x> |
||||||
|
<y>254</y> |
||||||
|
</hint> |
||||||
|
<hint type="destinationlabel"> |
||||||
|
<x>157</x> |
||||||
|
<y>274</y> |
||||||
|
</hint> |
||||||
|
</hints> |
||||||
|
</connection> |
||||||
|
<connection> |
||||||
|
<sender>buttonBox</sender> |
||||||
|
<signal>rejected()</signal> |
||||||
|
<receiver>FonChooser</receiver> |
||||||
|
<slot>reject()</slot> |
||||||
|
<hints> |
||||||
|
<hint type="sourcelabel"> |
||||||
|
<x>316</x> |
||||||
|
<y>260</y> |
||||||
|
</hint> |
||||||
|
<hint type="destinationlabel"> |
||||||
|
<x>286</x> |
||||||
|
<y>274</y> |
||||||
|
</hint> |
||||||
|
</hints> |
||||||
|
</connection> |
||||||
|
</connections> |
||||||
|
</ui> |
@ -0,0 +1,137 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<ui version="4.0"> |
||||||
|
<class>FreeType</class> |
||||||
|
<widget class="QDialog" name="FreeType"> |
||||||
|
<property name="geometry"> |
||||||
|
<rect> |
||||||
|
<x>0</x> |
||||||
|
<y>0</y> |
||||||
|
<width>340</width> |
||||||
|
<height>95</height> |
||||||
|
</rect> |
||||||
|
</property> |
||||||
|
<property name="windowTitle"> |
||||||
|
<string>FreeType Import Options</string> |
||||||
|
</property> |
||||||
|
<layout class="QVBoxLayout" name="verticalLayout"> |
||||||
|
<item> |
||||||
|
<layout class="QGridLayout" name="gridLayout"> |
||||||
|
<item row="0" column="0"> |
||||||
|
<widget class="QLabel" name="label"> |
||||||
|
<property name="text"> |
||||||
|
<string>Render Point &Size:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fPointSize</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="1"> |
||||||
|
<widget class="QSpinBox" name="fPointSize"> |
||||||
|
<property name="maximum"> |
||||||
|
<number>255</number> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="2"> |
||||||
|
<widget class="QLabel" name="label_3"> |
||||||
|
<property name="text"> |
||||||
|
<string>Max &Character:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fMaxChar</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="3"> |
||||||
|
<widget class="QSpinBox" name="fMaxChar"> |
||||||
|
<property name="maximum"> |
||||||
|
<number>1114111</number> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="0"> |
||||||
|
<widget class="QLabel" name="label_2"> |
||||||
|
<property name="text"> |
||||||
|
<string>Screen &Resolution:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fResolution</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="1"> |
||||||
|
<widget class="QSpinBox" name="fResolution"> |
||||||
|
<property name="maximum"> |
||||||
|
<number>65535</number> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="2" colspan="2"> |
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||||
|
<item> |
||||||
|
<widget class="QRadioButton" name="fMonochrome"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Monochrome</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QRadioButton" name="fGrayscale"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Grayscale</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QDialogButtonBox" name="fButtons"> |
||||||
|
<property name="orientation"> |
||||||
|
<enum>Qt::Horizontal</enum> |
||||||
|
</property> |
||||||
|
<property name="standardButtons"> |
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</widget> |
||||||
|
<resources/> |
||||||
|
<connections> |
||||||
|
<connection> |
||||||
|
<sender>fButtons</sender> |
||||||
|
<signal>accepted()</signal> |
||||||
|
<receiver>FreeType</receiver> |
||||||
|
<slot>accept()</slot> |
||||||
|
<hints> |
||||||
|
<hint type="sourcelabel"> |
||||||
|
<x>248</x> |
||||||
|
<y>254</y> |
||||||
|
</hint> |
||||||
|
<hint type="destinationlabel"> |
||||||
|
<x>157</x> |
||||||
|
<y>274</y> |
||||||
|
</hint> |
||||||
|
</hints> |
||||||
|
</connection> |
||||||
|
<connection> |
||||||
|
<sender>fButtons</sender> |
||||||
|
<signal>rejected()</signal> |
||||||
|
<receiver>FreeType</receiver> |
||||||
|
<slot>reject()</slot> |
||||||
|
<hints> |
||||||
|
<hint type="sourcelabel"> |
||||||
|
<x>316</x> |
||||||
|
<y>260</y> |
||||||
|
</hint> |
||||||
|
<hint type="destinationlabel"> |
||||||
|
<x>286</x> |
||||||
|
<y>274</y> |
||||||
|
</hint> |
||||||
|
</hints> |
||||||
|
</connection> |
||||||
|
</connections> |
||||||
|
</ui> |
@ -0,0 +1,159 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<ui version="4.0"> |
||||||
|
<class>FreeTypeBatch</class> |
||||||
|
<widget class="QDialog" name="FreeTypeBatch"> |
||||||
|
<property name="geometry"> |
||||||
|
<rect> |
||||||
|
<x>0</x> |
||||||
|
<y>0</y> |
||||||
|
<width>357</width> |
||||||
|
<height>181</height> |
||||||
|
</rect> |
||||||
|
</property> |
||||||
|
<property name="windowTitle"> |
||||||
|
<string>FreeType Import Options</string> |
||||||
|
</property> |
||||||
|
<layout class="QVBoxLayout" name="verticalLayout"> |
||||||
|
<item> |
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||||
|
<item> |
||||||
|
<widget class="QLabel" name="label"> |
||||||
|
<property name="text"> |
||||||
|
<string>Render Point &Sizes:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fPointSizes</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QLineEdit" name="fPointSizes"/> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QGroupBox" name="groupBox"> |
||||||
|
<property name="title"> |
||||||
|
<string>Common Settings</string> |
||||||
|
</property> |
||||||
|
<layout class="QGridLayout" name="gridLayout"> |
||||||
|
<item row="1" column="2" colspan="2"> |
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
||||||
|
<item> |
||||||
|
<widget class="QRadioButton" name="fMonochrome"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Monochrome</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QRadioButton" name="fGrayscale"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Grayscale</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item row="0" column="0"> |
||||||
|
<widget class="QLabel" name="label_4"> |
||||||
|
<property name="text"> |
||||||
|
<string>Screen &Resolution:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fResolution</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="2"> |
||||||
|
<widget class="QLabel" name="label_3"> |
||||||
|
<property name="text"> |
||||||
|
<string>Max &Character:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fMaxChar</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="3"> |
||||||
|
<widget class="QSpinBox" name="fMaxChar"> |
||||||
|
<property name="maximum"> |
||||||
|
<number>1114111</number> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="1"> |
||||||
|
<widget class="QSpinBox" name="fResolution"> |
||||||
|
<property name="maximum"> |
||||||
|
<number>65535</number> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3"> |
||||||
|
<item> |
||||||
|
<widget class="QLabel" name="label_2"> |
||||||
|
<property name="text"> |
||||||
|
<string>Font &Name:</string> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fFontName</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QLineEdit" name="fFontName"/> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QDialogButtonBox" name="buttonBox"> |
||||||
|
<property name="orientation"> |
||||||
|
<enum>Qt::Horizontal</enum> |
||||||
|
</property> |
||||||
|
<property name="standardButtons"> |
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</widget> |
||||||
|
<resources/> |
||||||
|
<connections> |
||||||
|
<connection> |
||||||
|
<sender>buttonBox</sender> |
||||||
|
<signal>accepted()</signal> |
||||||
|
<receiver>FreeTypeBatch</receiver> |
||||||
|
<slot>accept()</slot> |
||||||
|
<hints> |
||||||
|
<hint type="sourcelabel"> |
||||||
|
<x>248</x> |
||||||
|
<y>254</y> |
||||||
|
</hint> |
||||||
|
<hint type="destinationlabel"> |
||||||
|
<x>157</x> |
||||||
|
<y>274</y> |
||||||
|
</hint> |
||||||
|
</hints> |
||||||
|
</connection> |
||||||
|
<connection> |
||||||
|
<sender>buttonBox</sender> |
||||||
|
<signal>rejected()</signal> |
||||||
|
<receiver>FreeTypeBatch</receiver> |
||||||
|
<slot>reject()</slot> |
||||||
|
<hints> |
||||||
|
<hint type="sourcelabel"> |
||||||
|
<x>316</x> |
||||||
|
<y>260</y> |
||||||
|
</hint> |
||||||
|
<hint type="destinationlabel"> |
||||||
|
<x>286</x> |
||||||
|
<y>274</y> |
||||||
|
</hint> |
||||||
|
</hints> |
||||||
|
</connection> |
||||||
|
</connections> |
||||||
|
</ui> |
@ -0,0 +1,355 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<ui version="4.0"> |
||||||
|
<class>MainDialog</class> |
||||||
|
<widget class="QMainWindow" name="MainDialog"> |
||||||
|
<property name="geometry"> |
||||||
|
<rect> |
||||||
|
<x>0</x> |
||||||
|
<y>0</y> |
||||||
|
<width>384</width> |
||||||
|
<height>316</height> |
||||||
|
</rect> |
||||||
|
</property> |
||||||
|
<property name="windowTitle"> |
||||||
|
<string>plFontConverter</string> |
||||||
|
</property> |
||||||
|
<widget class="QWidget" name="centralwidget"> |
||||||
|
<layout class="QVBoxLayout" name="verticalLayout"> |
||||||
|
<property name="spacing"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<property name="leftMargin"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<property name="topMargin"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<property name="rightMargin"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<property name="bottomMargin"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<item> |
||||||
|
<layout class="QGridLayout" name="gridLayout"> |
||||||
|
<property name="spacing"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<item row="0" column="0"> |
||||||
|
<widget class="QLabel" name="label"> |
||||||
|
<property name="text"> |
||||||
|
<string>F&ace:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fFaceName</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="1"> |
||||||
|
<widget class="QLineEdit" name="fFaceName"/> |
||||||
|
</item> |
||||||
|
<item row="0" column="2"> |
||||||
|
<widget class="QPushButton" name="fExportButton"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>&Export P2F...</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="0"> |
||||||
|
<widget class="QLabel" name="label_2"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Size:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
<property name="buddy"> |
||||||
|
<cstring>fFontSize</cstring> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="1"> |
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||||
|
<item> |
||||||
|
<widget class="QSpinBox" name="fFontSize"> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
<property name="maximum"> |
||||||
|
<number>255</number> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QCheckBox" name="fBold"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Bold</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QCheckBox" name="fItalic"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Italic</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<layout class="QGridLayout" name="gridLayout_2"> |
||||||
|
<property name="spacing"> |
||||||
|
<number>8</number> |
||||||
|
</property> |
||||||
|
<item row="0" column="0"> |
||||||
|
<widget class="QLabel" name="label_3"> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>Starting Glyph:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="1"> |
||||||
|
<widget class="QLineEdit" name="fStartingGlyph"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="2"> |
||||||
|
<widget class="QLabel" name="label_5"> |
||||||
|
<property name="text"> |
||||||
|
<string>Glyph Count:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="0" column="3"> |
||||||
|
<widget class="QLineEdit" name="fGlyphCount"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="0"> |
||||||
|
<widget class="QLabel" name="label_4"> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>Bitmap Width:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="1"> |
||||||
|
<widget class="QLineEdit" name="fBitmapWidth"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="2"> |
||||||
|
<widget class="QLabel" name="label_6"> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>Bitmap Height:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="3"> |
||||||
|
<widget class="QLineEdit" name="fBitmapHeight"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="4"> |
||||||
|
<widget class="QLabel" name="label_7"> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>BPP:</string> |
||||||
|
</property> |
||||||
|
<property name="alignment"> |
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="5"> |
||||||
|
<widget class="QLineEdit" name="fBPP"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="plFontPreview" name="fPreview"> |
||||||
|
<property name="sizePolicy"> |
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> |
||||||
|
<horstretch>0</horstretch> |
||||||
|
<verstretch>0</verstretch> |
||||||
|
</sizepolicy> |
||||||
|
</property> |
||||||
|
<property name="minimumSize"> |
||||||
|
<size> |
||||||
|
<width>0</width> |
||||||
|
<height>32</height> |
||||||
|
</size> |
||||||
|
</property> |
||||||
|
<property name="frameShape"> |
||||||
|
<enum>QFrame::StyledPanel</enum> |
||||||
|
</property> |
||||||
|
<property name="frameShadow"> |
||||||
|
<enum>QFrame::Sunken</enum> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item> |
||||||
|
<widget class="QLineEdit" name="fSampleText"> |
||||||
|
<property name="text"> |
||||||
|
<string>The quick brown fox jumped over the lazy dog! ABCabc012345;,.</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</widget> |
||||||
|
<widget class="QMenuBar" name="menubar"> |
||||||
|
<property name="geometry"> |
||||||
|
<rect> |
||||||
|
<x>0</x> |
||||||
|
<y>0</y> |
||||||
|
<width>384</width> |
||||||
|
<height>21</height> |
||||||
|
</rect> |
||||||
|
</property> |
||||||
|
<widget class="QMenu" name="menu_File"> |
||||||
|
<property name="title"> |
||||||
|
<string>&File</string> |
||||||
|
</property> |
||||||
|
<addaction name="fImportFNTAction"/> |
||||||
|
<addaction name="fImportBDFAction"/> |
||||||
|
<addaction name="fImportFONAction"/> |
||||||
|
<addaction name="fImportTTFAction"/> |
||||||
|
<addaction name="separator"/> |
||||||
|
<addaction name="fOpenAction"/> |
||||||
|
<addaction name="fExportAction"/> |
||||||
|
<addaction name="separator"/> |
||||||
|
<addaction name="fExitAction"/> |
||||||
|
</widget> |
||||||
|
<widget class="QMenu" name="menu_Help"> |
||||||
|
<property name="title"> |
||||||
|
<string>&Help</string> |
||||||
|
</property> |
||||||
|
<addaction name="fAboutAction"/> |
||||||
|
</widget> |
||||||
|
<addaction name="menu_File"/> |
||||||
|
<addaction name="menu_Help"/> |
||||||
|
</widget> |
||||||
|
<action name="fImportFNTAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>Import &FNT...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fImportBDFAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>Import &BDF...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fImportFONAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>Import FO&N...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fOpenAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>&Open P2F...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fImportTTFAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>Import &TrueType...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fExportAction"> |
||||||
|
<property name="enabled"> |
||||||
|
<bool>false</bool> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>&Export P2F...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fExitAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>E&xit</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
<action name="fAboutAction"> |
||||||
|
<property name="text"> |
||||||
|
<string>&About...</string> |
||||||
|
</property> |
||||||
|
</action> |
||||||
|
</widget> |
||||||
|
<customwidgets> |
||||||
|
<customwidget> |
||||||
|
<class>plFontPreview</class> |
||||||
|
<extends>QFrame</extends> |
||||||
|
<header>plFontPreview.h</header> |
||||||
|
<container>1</container> |
||||||
|
</customwidget> |
||||||
|
</customwidgets> |
||||||
|
<resources/> |
||||||
|
<connections/> |
||||||
|
</ui> |
@ -0,0 +1,5 @@ |
|||||||
|
<!DOCTYPE RCC><RCC version="1.0"> |
||||||
|
<qresource> |
||||||
|
<file>icon1.ico</file> |
||||||
|
</qresource> |
||||||
|
</RCC> |
@ -1,52 +0,0 @@ |
|||||||
//{{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 |
|
Loading…
Reference in new issue