Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
@@ -0,0 +1,70 @@
// acwidths.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "acwidths.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ACWidths dialog
ACWidths::ACWidths(CWnd* pParent /*=NULL*/)
: CDialog(ACWidths::IDD, pParent)
{
//{{AFX_DATA_INIT(ACWidths)
m_AWidth = _T("");
m_CWidth = _T("");
//}}AFX_DATA_INIT
}
void ACWidths::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ACWidths)
DDX_Text(pDX, IDC_AWIDTH, m_AWidth);
DDX_Text(pDX, IDC_CWIDTH, m_CWidth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ACWidths, CDialog)
//{{AFX_MSG_MAP(ACWidths)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ACWidths message handlers
void ACWidths::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
nAWidth = atoi(m_AWidth);
nCWidth = atoi(m_CWidth);
CDialog::OnOK();
}
void ACWidths::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL ACWidths::OnInitDialog()
{
CDialog::OnInitDialog();
m_AWidth.Format("%d",nAWidth);
m_CWidth.Format("%d",nCWidth);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -0,0 +1,39 @@
// acwidths.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// ACWidths dialog
class ACWidths : public CDialog
{
// Construction
public:
ACWidths(CWnd* pParent = NULL); // standard constructor
int nAWidth;
int nCWidth;
// Dialog Data
//{{AFX_DATA(ACWidths)
enum { IDD = IDD_ACWIDTH };
CString m_AWidth;
CString m_CWidth;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ACWidths)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ACWidths)
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@@ -0,0 +1,322 @@
#define DEF_CHAR 128
Char cmap_clubs[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
0,0,0,0,0, // 032 space
0,0,0,0,0, // 033 !
0,0,0,0,0, // 034 "
0,0,0,0,0, // 035 #
0,0,0,0,0, // 036 $
0,0,0,0,0, // 037 %
0,0,0,0,0, // 038 &
0,0,0,0,0, // 039 '
0,0,0,0,0, // 040 (
0,0,0,0,0, // 041 )
0,0,0,0,0, // 042 *
0,0,0,0,0, // 043 +
0,0,0,0,0, // 044 ,
0,0,0,0,0, // 045 -
0,0,0,0,0, // 046 .
0,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
0,0,0,0,0, // 058 :
0,0,0,0,0, // 059 ;
0,0,0,0,0, // 060 <
0,0,0,0,0, // 061 =
0,0,0,0,0, // 062 >
0,0,0,0,0, // 063 ?
0,0,0,0,0, // 064 @
0,0,0,0,0, // 065 A
0,0,0,0,0, // 066 B
0,0,0,0,0, // 067 C
0,0,0,0,0, // 068 D
0,0,0,0,0, // 069 E
0,0,0,0,0, // 070 F
0,0,0,0,0, // 071 G
0,0,0,0,0, // 072 H
0,0,0,0,0, // 073 I
0,0,0,0,0, // 074 J
0,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
0,0,0,0,0, // 077 M
0,0,0,0,0, // 078 N
0,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
0,0,0,0,0, // 081 Q
0,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
0,0,0,0,0, // 084 T
0,0,0,0,0, // 085 U
0,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
0,0,0,0,0, // 088 X
0,0,0,0,0, // 089 Y
0,0,0,0,0, // 090 Z
0,0,0,0,0, // 091 [
0,0,0,0,0, // 092 "\"
0,0,0,0,0, // 093 ]
0,0,0,0,0, // 094 ^
0,0,0,0,0, // 095 _
0,0,0,0,0, // 096 `
0,0,0,0,0, // 097 a
0,0,0,0,0, // 098 b
0,0,0,0,0, // 099 c
0,0,0,0,0, // 100 d
0,0,0,0,0, // 101 e
0,0,0,0,0, // 102 f
0,0,0,0,0, // 103 g
0,0,0,0,0, // 104 h
0,0,0,0,0, // 105 i
0,0,0,0,0, // 106 j
0,0,0,0,0, // 107 k
0,0,0,0,0, // 108 l
0,0,0,0,0, // 109 m
0,0,0,0,0, // 100 n
0,0,0,0,0, // 111 o
0,0,0,0,0, // 112 p
0,0,0,0,0, // 113 q
0,0,0,0,0, // 114 r
0,0,0,0,0, // 115 s
0,0,0,0,0, // 116 t
0,0,0,0,0, // 117 u
0,0,0,0,0, // 118 v
0,0,0,0,0, // 119 w
0,0,0,0,0, // 110 x
0,0,0,0,0, // 121 y
0,0,0,0,0, // 122 z
0,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
0,0,0,0,0, // 125 }
0,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
0,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
0,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
0,0,0,0,0, // 145
0,0,0,0,0, // 146
0,0,0,0,0, // 147 “
0,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
0,0,0,0,0, // 154 š
0,0,0,0,0, // 155
0,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
0,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
0,0,0,0,0, // 161 ¡
0,0,0,0,0, // 162 ¢
0,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
0,0,0,0,0, // 165 ¥
0,0,0,0,0, // 166 ¦
0,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
0,0,0,0,0, // 169 ©
0,0,0,0,0, // 170 ª
0,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
0,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
0,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
0,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
0,0,0,0,0, // 186 º
0,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
0,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
0,0,0,0,0, // 191 µ
0,0,0,0,0, // 192 À
0,0,0,0,0, // 193 Á
0,0,0,0,0, // 194 Â
0,0,0,0,0, // 195 Ã
0,0,0,0,0, // 196 Ä
0,0,0,0,0, // 197 Å
0,0,0,0,0, // 198 Æ
0,0,0,0,0, // 199 Ç
0,0,0,0,0, // 200 È
0,0,0,0,0, // 201 É
0,0,0,0,0, // 202 Ê
0,0,0,0,0, // 203 Ë
0,0,0,0,0, // 204 Ì
0,0,0,0,0, // 205 Í
0,0,0,0,0, // 206 Î
0,0,0,0,0, // 207 Ï
0,0,0,0,0, // 208 Ð
0,0,0,0,0, // 209 Ñ
0,0,0,0,0, // 210 Ò
0,0,0,0,0, // 211 Ó
0,0,0,0,0, // 212 Ô
0,0,0,0,0, // 213 Õ
0,0,0,0,0, // 214 Ö
0,0,0,0,0, // 215 ×
0,0,0,0,0, // 216 Ø
0,0,0,0,0, // 217 Ù
0,0,0,0,0, // 218 Ú
0,0,0,0,0, // 219 Û
0,0,0,0,0, // 220 Ü
0,0,0,0,0, // 221 Ý
0,0,0,0,0, // 222 Þ
0,0,0,0,0, // 223 ß
0,0,0,0,0, // 224 à
0,0,0,0,0, // 225 á
0,0,0,0,0, // 226 â
0,0,0,0,0, // 227 ã
0,0,0,0,0, // 228 ä
0,0,0,0,0, // 229 å
0,0,0,0,0, // 230 æ
0,0,0,0,0, // 231 ç
0,0,0,0,0, // 232 è
0,0,0,0,0, // 233 é
0,0,0,0,0, // 234 ê
0,0,0,0,0, // 235 ë
0,0,0,0,0, // 236 ì
0,0,0,0,0, // 237 í
0,0,0,0,0, // 238 î
0,0,0,0,0, // 239 ï
0,0,0,0,0, // 240 ð
0,0,0,0,0, // 241 ñ
0,0,0,0,0, // 242 ò
0,0,0,0,0, // 243 ó
0,0,0,0,0, // 244 ô
0,0,0,0,0, // 245 õ
0,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
0,0,0,0,0, // 248 ø
0,0,0,0,0, // 249 ù
0,0,0,0,0, // 250 ú
0,0,0,0,0, // 251 û
0,0,0,0,0, // 252 ü
0,0,0,0,0, // 253 ý
0,0,0,0,0, // 254 þ
0,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,251 @@
// ChooseDir.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "ChooseDir.h"
#include "direct.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChooseDir dialog
CChooseDir::CChooseDir(CWnd* pParent /*=NULL*/)
: CDialog(CChooseDir::IDD, pParent)
{
//{{AFX_DATA_INIT(CChooseDir)
m_Dir = _T("");
//}}AFX_DATA_INIT
szCurrDir[0] = 0;
szTitle[0] = 0;
}
void CChooseDir::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChooseDir)
DDX_Control(pDX, IDC_FILELIST, m_FileList);
DDX_Control(pDX, IDC_DRIVES, m_Drives);
DDX_Control(pDX, IDC_DIRPATH, m_DirPath);
DDX_Control(pDX, IDC_DIRLIST, m_DirList);
DDX_Text(pDX, IDC_DIRPATH, m_Dir);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChooseDir, CDialog)
//{{AFX_MSG_MAP(CChooseDir)
ON_LBN_DBLCLK(IDC_DIRLIST, OnDblclkDirlist)
ON_CBN_SELCHANGE(IDC_DRIVES, OnSelchangeDrives)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChooseDir message handlers
BOOL CChooseDir::OnInitDialog()
{
CDialog::OnInitDialog();
// fill drive list
if (szTitle[0])
SetWindowText(szTitle);
if (!szCurrDir[0]) // if no directory has been set then choose the current drive and directory
_getcwd(szCurrDir,sizeof(szCurrDir));
char szDrive[]="A:\\";
nCurrDrive = _getdrive()-1;
for (int nDrive=0; nDrive<26; nDrive++)
{
szDrive[0] = 'A' + nDrive;
char szDescription[260];
DWORD dwType = GetDriveType(szDrive);
sprintf(szDescription,"[%c:]",nDrive+'A');
switch(dwType)
{
case 0:
case 1:
continue; // invalid drives
case DRIVE_REMOVABLE:
strcat(szDescription," - removable");
break;
case DRIVE_FIXED:
case DRIVE_REMOTE:
{
char szName[260];
char szFileSystemName[260];
DWORD dwJunk;
GetVolumeInformation(szDrive,szName,sizeof(szName),&dwJunk,&dwJunk,&dwJunk,szFileSystemName,sizeof(szFileSystemName));
strcat(szDescription," - ");
strcat(szDescription,szName);
}
break;
break;
case DRIVE_CDROM:
strcat(szDescription," - CDROM");
break;
case DRIVE_RAMDISK:
strcat(szDescription," - RAMDISK");
break;
}
int nIndex = m_Drives.AddString(szDescription);
m_Drives.SetItemData(nIndex,nDrive);
if (nDrive == nCurrDrive)
m_Drives.SetCurSel(nIndex);
}
// fill in directory list
FillDirList();
m_Dir = szCurrDir;
m_DirPath.SetWindowText(szCurrDir);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CChooseDir::FillDirList()
{
WIN32_FIND_DATA find;
char szFind[260];
strcpy(szFind,szCurrDir);
int nLen = strlen(szFind);
if (szFind[nLen-1] != '\\')
strcat(szFind,"\\");
strcat(szFind,"*.*");
HANDLE hFind = FindFirstFile(szFind,&find);
BOOL bContinue=hFind!=INVALID_HANDLE_VALUE;
m_DirList.ResetContent();
m_FileList.ResetContent();
while (bContinue)
{
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (find.cFileName[0] == '.' && find.cFileName[1]==NULL)
; // don't show the single dot
else
m_DirList.AddString(find.cFileName);
}
else
{
m_FileList.AddString(find.cFileName);
}
bContinue = FindNextFile(hFind,&find);
}
FindClose(hFind);
}
void CChooseDir::OnDblclkDirlist()
{
int nItem = m_DirList.GetCurSel();
char szDirName[260];
m_DirList.GetText(nItem,szDirName);
if (szDirName[0] == '.')
{ // back up one directory
int nLastSlash = -1;
int nChar=0;
while (szCurrDir[nChar])
{
if (szCurrDir[nChar] == '\\')
nLastSlash = nChar;
nChar++;
}
if (nLastSlash >=0)
szCurrDir[nLastSlash] = 0;
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
}
else
{ // go into the next directory
int nLen = strlen(szCurrDir);
if (szCurrDir[nLen-1] != '\\')
strcat(szCurrDir,"\\");
strcat(szCurrDir,szDirName);
}
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
}
void CChooseDir::OnSelchangeDrives()
{
int nItem = m_Drives.GetCurSel();
int nDrive = m_Drives.GetItemData(nItem);
sprintf(szCurrDir,"%c:\\",nDrive+'A');
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
}
void CChooseDir::OnOK()
{
char szTemp[260];
m_DirPath.GetWindowText(szTemp,sizeof(szTemp));
if (!strcmp(szTemp,".."))
{ // back up one dir
int nLastSlash = -1;
int nChar=0;
while (szCurrDir[nChar])
{
if (szCurrDir[nChar] == '\\')
nLastSlash = nChar;
nChar++;
}
if (nLastSlash >=0)
szCurrDir[nLastSlash] = 0;
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
return;
}
if (strcmp(szTemp,szCurrDir))
{ // the user has typed in the entry. try to set to the directory they typed
if (_chdir(szTemp)==0) // success
{
strcpy(szCurrDir,szTemp);
FillDirList();
return;
}
else
{
// do a little file name validation
if (!isalpha(szTemp[0]) || szTemp[1] != ':' || szTemp[2] != '\\')
{
m_DirPath.SetWindowText(szCurrDir);
return;
}
int nResult = MessageBox("The selected directory does not exist. Would you like to create it?","Question",MB_YESNO);
if (nResult == IDNO)
return;
else
{
int nChar=0;
int nSlashCount=-1;
strcpy(szCurrDir,szTemp);
while (szCurrDir[nChar])
{
if (szCurrDir[nChar] == '\\')
{
nSlashCount++;
if (nSlashCount > 0)
{
szCurrDir[nChar] = 0;
CreateDirectory(szCurrDir,NULL);
szCurrDir[nChar] = '\\';
}
}
nChar++;
}
CreateDirectory(szCurrDir,NULL);
}
}
}
CDialog::OnOK();
}
void CChooseDir::OnCancel()
{
CDialog::OnCancel();
}
@@ -0,0 +1,45 @@
// ChooseDir.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CChooseDir dialog
class CChooseDir : public CDialog
{
// Construction
public:
CChooseDir(CWnd* pParent = NULL); // standard constructor
char szCurrDir[260];
char szTitle[260];
// Dialog Data
//{{AFX_DATA(CChooseDir)
enum { IDD = IDD_CHOOSEDIR };
CListBox m_FileList;
CComboBox m_Drives;
CEdit m_DirPath;
CListBox m_DirList;
CString m_Dir;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChooseDir)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void FillDirList();
int nCurrDrive;
// Generated message map functions
//{{AFX_MSG(CChooseDir)
virtual BOOL OnInitDialog();
afx_msg void OnDblclkDirlist();
afx_msg void OnSelchangeDrives();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@@ -0,0 +1,76 @@
// DeltaSpace.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "DeltaSpace.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDeltaSpace dialog
CDeltaSpace::CDeltaSpace(CWnd* pParent /*=NULL*/)
: CDialog(CDeltaSpace::IDD, pParent)
{
//{{AFX_DATA_INIT(CDeltaSpace)
m_A = _T("");
m_C = _T("");
//}}AFX_DATA_INIT
}
void CDeltaSpace::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDeltaSpace)
DDX_Text(pDX, IDC_DELTA_A, m_A);
DDX_Text(pDX, IDC_DELTA_C, m_C);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDeltaSpace, CDialog)
//{{AFX_MSG_MAP(CDeltaSpace)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDeltaSpace message handlers
BOOL CDeltaSpace::OnInitDialog()
{
m_DeltaA = 0;
m_DeltaC = 0;
m_A = "0";
m_C = "0";
UpdateData(FALSE);
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDeltaSpace::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
m_DeltaA = atoi(m_A);
m_DeltaC = atoi(m_C);
CDialog::OnOK();
}
void CDeltaSpace::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
@@ -0,0 +1,40 @@
// DeltaSpace.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDeltaSpace dialog
class CDeltaSpace : public CDialog
{
// Construction
public:
CDeltaSpace(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDeltaSpace)
enum { IDD = IDD_DELTASPACE };
int m_DeltaA;
int m_DeltaC;
CString m_A;
CString m_C;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDeltaSpace)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDeltaSpace)
virtual BOOL OnInitDialog();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@@ -0,0 +1,322 @@
#define DEF_CHAR 128
Char cmap_english[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
0,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
0,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
1,0,0,0,0, // 145
0,0,0,0,0, // 146
1,0,0,0,0, // 147 “
1,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
0,0,0,0,0, // 154 š
0,0,0,0,0, // 155
0,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
0,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
1,0,0,0,0, // 161 ¡
1,0,0,0,0, // 162 ¢
1,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
0,0,0,0,0, // 165 ¥
1,0,0,0,0, // 166 ¦
0,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
1,0,0,0,0, // 169 ©
0,0,0,0,0, // 170 ª
0,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
1,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
1,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
0,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
0,0,0,0,0, // 186 º
0,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
0,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
0,0,0,0,0, // 191 µ
0,0,0,0,0, // 192 À
0,0,0,0,0, // 193 Á
0,0,0,0,0, // 194 Â
0,0,0,0,0, // 195 Ã
0,0,0,0,0, // 196 Ä
0,0,0,0,0, // 197 Å
0,0,0,0,0, // 198 Æ
0,0,0,0,0, // 199 Ç
0,0,0,0,0, // 200 È
0,0,0,0,0, // 201 É
0,0,0,0,0, // 202 Ê
0,0,0,0,0, // 203 Ë
0,0,0,0,0, // 204 Ì
0,0,0,0,0, // 205 Í
0,0,0,0,0, // 206 Î
0,0,0,0,0, // 207 Ï
0,0,0,0,0, // 208 Ð
0,0,0,0,0, // 209 Ñ
0,0,0,0,0, // 210 Ò
0,0,0,0,0, // 211 Ó
0,0,0,0,0, // 212 Ô
0,0,0,0,0, // 213 Õ
0,0,0,0,0, // 214 Ö
1,0,0,0,0, // 215 ×
0,0,0,0,0, // 216 Ø
0,0,0,0,0, // 217 Ù
0,0,0,0,0, // 218 Ú
0,0,0,0,0, // 219 Û
0,0,0,0,0, // 220 Ü
0,0,0,0,0, // 221 Ý
0,0,0,0,0, // 222 Þ
0,0,0,0,0, // 223 ß
0,0,0,0,0, // 224 à
0,0,0,0,0, // 225 á
0,0,0,0,0, // 226 â
0,0,0,0,0, // 227 ã
0,0,0,0,0, // 228 ä
0,0,0,0,0, // 229 å
0,0,0,0,0, // 230 æ
0,0,0,0,0, // 231 ç
0,0,0,0,0, // 232 è
0,0,0,0,0, // 233 é
0,0,0,0,0, // 234 ê
0,0,0,0,0, // 235 ë
0,0,0,0,0, // 236 ì
0,0,0,0,0, // 237 í
0,0,0,0,0, // 238 î
0,0,0,0,0, // 239 ï
0,0,0,0,0, // 240 ð
0,0,0,0,0, // 241 ñ
0,0,0,0,0, // 242 ò
0,0,0,0,0, // 243 ó
0,0,0,0,0, // 244 ô
0,0,0,0,0, // 245 õ
0,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
0,0,0,0,0, // 248 ø
0,0,0,0,0, // 249 ù
0,0,0,0,0, // 250 ú
0,0,0,0,0, // 251 û
0,0,0,0,0, // 252 ü
0,0,0,0,0, // 253 ý
0,0,0,0,0, // 254 þ
0,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,74 @@
// ExportTextures.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "ExportTextures.h"
#include "choosedir.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExportTextures dialog
CExportTextures::CExportTextures(CWnd* pParent /*=NULL*/)
: CDialog(CExportTextures::IDD, pParent)
{
//{{AFX_DATA_INIT(CExportTextures)
m_FileTag = _T("");
m_OutputDir = _T("");
//}}AFX_DATA_INIT
}
void CExportTextures::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExportTextures)
DDX_Text(pDX, IDC_FILETAG, m_FileTag);
DDX_Text(pDX, IDC_OUPUTDIR, m_OutputDir);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExportTextures, CDialog)
//{{AFX_MSG_MAP(CExportTextures)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExportTextures message handlers
void CExportTextures::OnOK()
{
UpdateData(true);
if (m_FileTag.GetLength() < 1)
{
MessageBox("You must enter a tag.","Hello!",MB_OK);
return;
}
if (m_OutputDir.GetLength() < 1)
{
MessageBox("You must enter a directory to write the exported files into.","Hello!",MB_OK);
return;
}
CDialog::OnOK();
}
void CExportTextures::OnCancel()
{
CDialog::OnCancel();
}
void CExportTextures::OnBrowse()
{
CChooseDir dlg;
dlg.DoModal();
}
@@ -0,0 +1,49 @@
#if !defined(AFX_EXPORTTEXTURES_H__BED90C97_31F1_472F_8511_78AC695DF83D__INCLUDED_)
#define AFX_EXPORTTEXTURES_H__BED90C97_31F1_472F_8511_78AC695DF83D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ExportTextures.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CExportTextures dialog
class CExportTextures : public CDialog
{
// Construction
public:
CExportTextures(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CExportTextures)
enum { IDD = IDD_EXPORT };
CString m_FileTag;
CString m_OutputDir;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExportTextures)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CExportTextures)
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnBrowse();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXPORTTEXTURES_H__BED90C97_31F1_472F_8511_78AC695DF83D__INCLUDED_)
@@ -0,0 +1,114 @@
#define MAX_FONT_TEXTURES 128
class FontTexture
{
DWORD dwSize;
int iFontHeight;
int iNumRows;
DWORD *dwSpaceAvailableOnEachRow;
BYTE *pTexture;
DWORD *p32BitTexture;
bool b32Bit;
void AddCharToTexture(BYTE *pData,DWORD dwWidth,DWORD dwX,DWORD dwY);
public:
FontTexture(DWORD dwSize,int iFontHeight);
FontTexture(HFILE hFile,int iFontHeight,bool b32Bit);
~FontTexture();
bool AddChar(BYTE *pData,DWORD dwWidth,DWORD &dwXPos,DWORD &dwYPos);
bool Save(HFILE hFile);
bool Load(HFILE hFile);
BYTE *GetCharMap(int iX, int iY, int iW);
void SetCharMap(BYTE *pData,int iX, int iY, int iW) {AddCharToTexture(pData,(DWORD)iW,(DWORD)iX,(DWORD)iY);}
BYTE *GetTexture() {return pTexture;}
BYTE *Get32BitTexture() {return (BYTE *)p32BitTexture;}
void ChangeFontHeight(int iNewHeight) {iFontHeight = iNewHeight;}
DWORD Size() {return dwSize;}
bool ExportTGA(const char *szFullPath);
bool ImportTGA(const char *szFullPath);
};
typedef struct
{
BYTE *pData;
BYTE bWidth;
signed char aWidth;
signed char cWidth;
bool bUsed;
} CharData;
// structures for file format
#define D3DFONTSIG '4F3D'
#define D3D32BITFONTSIG 'TF3D'
#pragma warning( disable : 4200 )
typedef struct
{
DWORD dwSig;
char szFaceName[64];
int iSize; // point size of font used to create this font
bool bItalic; // italic on or off when this font was created
int iWeight; // weight of font created
int iTextureCount;
DWORD dwFontHeight; // height in pixels of the resulatant font
BYTE bTexture[256]; // indicate which texture each character is on
BYTE bX[256]; // indicates x position of each character on it's texture
BYTE bY[256]; // indicates y position of each character on it's texture
BYTE bW[256]; // indicates width of each character in the texture
signed char cA[256]; // indicates amount of space to add before each character (may be -)
signed char cC[256]; // indicates amount of space to add after each character (may be -)
//DWORD dwTextureOffsets[0]; // offsets to textures
} D3DFont;
typedef struct
{
DWORD dwSize;
BYTE bPixels[0];
} D3DFontTexture;
class Font
{
protected:
// temp data (used while building font, but not needed after font is built)
CharData data[256];
bool bMinimizeTextureCount;
bool b32Bit;
// intermediate data
D3DFont header;
int iNumTextures;
int iTextureSize;
FontTexture *pTextures[MAX_FONT_TEXTURES];
void CalcAlphaAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c);
void CalcAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c);
void AddChar(BYTE *pAAPix,int w, int h,int nChar,int a, int c);
bool BuildTextures();
void CleanTextures();
void CleanTempData();
public:
Font(char *szFaceName,int iHeight,bool bItalic,int iWeight,bool bAntiAlias,bool bMinimizeTextureSize=false);
Font(const char *szFullPath,bool &bSuccess);
~Font();
bool Save(HFILE hFile);
void Shorten(); // removes a single row of pixels at the top of each character
void ShortenFromBottom(); // removes a single row of pixels at the top of each character
int GetTextureCount() { return iNumTextures;}
void DrawTexture(HDC hDC, int iTexture, int x, int y);
BYTE *GetCharMap(int iChar);
void SetCharMap(int iChar,BYTE *pData);
char *FaceName() {return header.szFaceName;}
int PointSize() {return header.iSize;}
bool IsItalic() {return header.bItalic;}
bool IsBold() {return header.iWeight > 400;}
int GetCharHeight(int iChar) {return (int)header.dwFontHeight;}
int GetCharWidth(int iChar) {return header.bW[iChar];}
int GetCharAWidth(int iChar) {return header.cA[iChar];}
void SetCharAWidth(int iChar,int iVal) {header.cA[iChar] = (signed char)iVal;}
int GetCharCWidth(int iChar) {return header.cC[iChar];}
void SetCharCWidth(int iChar,int iVal) {header.cC[iChar] = (signed char)iVal;}
void ExportTGAS(const char *szTag,const char *szOutputDir);
void ImportTGAS(const char *szFirstFile);
};
@@ -0,0 +1,131 @@
// fontedit.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#define __GLOBALS__
#include "globals.h"
#include "fontedit.h"
#include "mainfrm.h"
#include "fontedoc.h"
#include "fontevw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp
BEGIN_MESSAGE_MAP(CFonteditApp, CWinApp)
//{{AFX_MSG_MAP(CFonteditApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp construction
CFonteditApp::CFonteditApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CFonteditApp object
CFonteditApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp initialization
BOOL CFonteditApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
Enable3dControls();
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CFonteditDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CFonteditView));
AddDocTemplate(pDocTemplate);
// create a new (empty) document
OnFileNew();
if (m_lpCmdLine[0] != '\0')
{
// TODO: add command line processing here
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// Implementation
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CFonteditApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp commands
@@ -0,0 +1,38 @@
// fontedit.h : main header file for the FONTEDIT application
//
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp:
// See fontedit.cpp for the implementation of this class
//
class CFonteditApp : public CWinApp
{
public:
CFonteditApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFonteditApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CFonteditApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,322 @@
#define DEF_CHAR 128
Char cmap_foreign[256] =
{
1,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
1,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
1,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
1,0,0,0,0, // 145
0,0,0,0,0, // 146
0,0,0,0,0, // 147 “
0,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
1,0,0,0,0, // 154 š
0,0,0,0,0, // 155
1,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
1,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
1,0,0,0,0, // 161 ¡
1,0,0,0,0, // 162 ¢
1,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
1,0,0,0,0, // 165 ¥
1,0,0,0,0, // 166 ¦
1,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
1,0,0,0,0, // 169 ©
1,0,0,0,0, // 170 ª
1,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
1,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
1,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
1,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
1,0,0,0,0, // 186 º
1,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
1,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
1,0,0,0,0, // 191 µ
1,0,0,0,0, // 192 À
1,0,0,0,0, // 193 Á
1,0,0,0,0, // 194 Â
1,0,0,0,0, // 195 Ã
1,0,0,0,0, // 196 Ä
1,0,0,0,0, // 197 Å
1,0,0,0,0, // 198 Æ
1,0,0,0,0, // 199 Ç
1,0,0,0,0, // 200 È
1,0,0,0,0, // 201 É
1,0,0,0,0, // 202 Ê
1,0,0,0,0, // 203 Ë
1,0,0,0,0, // 204 Ì
1,0,0,0,0, // 205 Í
1,0,0,0,0, // 206 Î
1,0,0,0,0, // 207 Ï
1,0,0,0,0, // 208 Ð
1,0,0,0,0, // 209 Ñ
1,0,0,0,0, // 210 Ò
1,0,0,0,0, // 211 Ó
1,0,0,0,0, // 212 Ô
1,0,0,0,0, // 213 Õ
1,0,0,0,0, // 214 Ö
1,0,0,0,0, // 215 ×
1,0,0,0,0, // 216 Ø
1,0,0,0,0, // 217 Ù
1,0,0,0,0, // 218 Ú
1,0,0,0,0, // 219 Û
1,0,0,0,0, // 220 Ü
1,0,0,0,0, // 221 Ý
1,0,0,0,0, // 222 Þ
1,0,0,0,0, // 223 ß
1,0,0,0,0, // 224 à
1,0,0,0,0, // 225 á
1,0,0,0,0, // 226 â
1,0,0,0,0, // 227 ã
1,0,0,0,0, // 228 ä
1,0,0,0,0, // 229 å
1,0,0,0,0, // 230 æ
1,0,0,0,0, // 231 ç
1,0,0,0,0, // 232 è
1,0,0,0,0, // 233 é
1,0,0,0,0, // 234 ê
1,0,0,0,0, // 235 ë
1,0,0,0,0, // 236 ì
1,0,0,0,0, // 237 í
1,0,0,0,0, // 238 î
1,0,0,0,0, // 239 ï
1,0,0,0,0, // 240 ð
1,0,0,0,0, // 241 ñ
1,0,0,0,0, // 242 ò
1,0,0,0,0, // 243 ó
1,0,0,0,0, // 244 ô
1,0,0,0,0, // 245 õ
1,0,0,0,0, // 246 ö
1,0,0,0,0, // 247 ÷
1,0,0,0,0, // 248 ø
1,0,0,0,0, // 249 ù
1,0,0,0,0, // 250 ú
1,0,0,0,0, // 251 û
1,0,0,0,0, // 252 ü
1,0,0,0,0, // 253 ý
1,0,0,0,0, // 254 þ
1,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,869 @@
#include "stdafx.h"
#include "globals.h"
#include "fontevw.h"
#include "english.h"
#include "alphaonly.h"
#include "mac.h"
#include "clubs.h"
#include "foreign.h"
#include "all.h"
#include "font.h"
#include "assert.h"
#include "targa.h"
static BOOL bBackOpaque=FALSE;
static BYTE frRed=0xFF,frGreen=0xFF,frBlue=0xFF;
static BYTE bkRed=0x00,bkGreen=0x00,bkBlue=0x00;
static BYTE *pfWorkspace=0;
static int wsWidth=0;
static int wsHeight=0;
BOOL DrawGrayscaleBmp(HDC hDC,int x,int y,int w,int h,BYTE *pPixels)
{
LPBITMAPINFO lplocalbmi=NULL;
BYTE *lplocalpixels=NULL;
lplocalbmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
lplocalpixels = new BYTE[w*h];
int nBmpWidth = w + ((w&0x3)?(4-(w&3)):0); // figure out 4 byte aligned width (make windows happy)
lplocalbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lplocalbmi->bmiHeader.biWidth = nBmpWidth;
lplocalbmi->bmiHeader.biHeight = -h;
lplocalbmi->bmiHeader.biPlanes = 1;
lplocalbmi->bmiHeader.biBitCount = 8;
lplocalbmi->bmiHeader.biCompression = BI_RGB;
lplocalbmi->bmiHeader.biSizeImage = 0;
lplocalbmi->bmiHeader.biClrUsed = 0;
lplocalbmi->bmiHeader.biClrImportant = 0;
BYTE *pOut = lplocalpixels;
BYTE *pIn = pPixels;
int n;
for (n=0; n<h; n++)
{
memcpy(pOut,pIn,w);
pOut += nBmpWidth;
pIn += w;
}
for (n=0; n<256; n++)
{
lplocalbmi->bmiColors[n].rgbRed = n;
lplocalbmi->bmiColors[n].rgbGreen = n;
lplocalbmi->bmiColors[n].rgbBlue = n;
}
int nResult = SetDIBitsToDevice(hDC,
x,y,
w,h,
0,0,
0,h,
lplocalpixels,
lplocalbmi,
DIB_RGB_COLORS);
delete lplocalbmi;
delete lplocalpixels;
return (nResult > 0);
}
BOOL Draw32BitBmp(HDC hDC,int x,int y,int w,int h,BYTE *pPixels)
{
LPBITMAPINFO lplocalbmi=NULL;
DWORD *lplocalpixels=NULL;
lplocalbmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO)];
lplocalpixels = new DWORD[(w+4)*h];
int nBmpWidth = w + ((w&0x3)?(4-(w&3)):0); // figure out 4 byte aligned width (make windows happy)
lplocalbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lplocalbmi->bmiHeader.biWidth = nBmpWidth;
lplocalbmi->bmiHeader.biHeight = h;
lplocalbmi->bmiHeader.biPlanes = 1;
lplocalbmi->bmiHeader.biBitCount = 32;
lplocalbmi->bmiHeader.biCompression = BI_RGB;
lplocalbmi->bmiHeader.biSizeImage = 0;
lplocalbmi->bmiHeader.biClrUsed = 0;
lplocalbmi->bmiHeader.biClrImportant = 0;
DWORD *pOut = lplocalpixels + w*(h-1);
DWORD *pIn = (DWORD *)pPixels;
int n;
for (n=0; n<h; n++)
{
memcpy(pOut,pIn,w*sizeof(DWORD));
pOut -= nBmpWidth;
pIn += w;
}
int nResult = SetDIBitsToDevice(hDC,
x,y,
w,h,
0,0,
0,h,
(BYTE *)lplocalpixels,
lplocalbmi,
DIB_RGB_COLORS);
delete lplocalbmi;
delete lplocalpixels;
return (nResult > 0);
}
Font::Font(char *szFaceName,int iHeight,bool bItalic,int iWeight,bool bAntiAlias,bool bMinimizeTextureCount)
{ // convert a TT font to our anti-aliased format
this->bMinimizeTextureCount = bMinimizeTextureCount;
b32Bit = false;
strcpy(header.szFaceName,szFaceName);
header.iWeight = iWeight;
header.bItalic = bItalic;
header.iSize = iHeight;
memset(data,0,sizeof(data));
Char *cmap_char;
int n;
CFont font;
CDC dc;
CSize sz;
BYTE *pPixels;
char szChar[2] = " ";
CBitmap bmp;
TEXTMETRIC tm;
ABC abc;
if (nLanguage == 100)
cmap_char = cmap_alphaonly;
else
cmap_char = cmap_foreign;
CDC *pDC = view->GetDC();
dc.CreateCompatibleDC(pDC);
view->ReleaseDC(pDC);
dc.SetTextColor(0xFFFFFF);
dc.SetBkColor(0);
int iSize = iHeight;
if (bAntiAlias)
iSize *= 8;
font.CreateFont(iSize,
0,
0,
0,
iWeight,
bItalic,
0,
0,
DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,DEFAULT_PITCH|FF_DONTCARE,
szFaceName);
CFont *oldfont = dc.SelectObject(&font);
CBitmap *oldbmp;
dc.GetTextMetrics(&tm);
for (n=0; n<256; n++)
{
if (cmap_char[n].nOffset) // add char if it's listed in this array as one to include
{
int a,c;
szChar[0] = (char)n;
// figure out how wide the character is
sz = dc.GetTextExtent(szChar,1);
GetCharABCWidths(dc.m_hDC,(BYTE)*szChar,(BYTE)*szChar,&abc);
sz.cx = abc.abcB;
if (bAntiAlias)
{
sz.cx += 8;
// create a monochrom bitmap with 8x8 pixels per resultant alpha value
pPixels = (BYTE *)malloc(((sz.cx+16) * (sz.cy+8)));
memset(pPixels,0,((sz.cx+16) * (sz.cy+8)));
bmp.CreateBitmap(sz.cx,sz.cy ,1,1,pPixels);
oldbmp = dc.SelectObject(&bmp);
dc.PatBlt(0,0,sz.cx,sz.cy,BLACKNESS);
dc.TextOut(-abc.abcA,0,szChar,1);
a = abc.abcA;
c = abc.abcC;
c-=8; // BECAUSE WE ADDED 8 TO sz.cx above
if (a<0)
a-=4;
else
a+=4;
if (c<0)
c-=4;
else
c+=4;
a/=8;
c/=8;
bmp.GetBitmapBits(((sz.cx+16) * sz.cy)/8,pPixels);
// do the work of converting the monochrome bitmap to an alpha bimap and add it to the font
CalcAlphaAndAddChar(pPixels,sz.cx,sz.cy,n,a,c);
free(pPixels);
dc.SelectObject(oldbmp);
bmp.DeleteObject();
}
else
{ // non-antialiased
// create a monochrom bitmap with 8x8 pixels per resultant alpha value
pPixels = (BYTE *)malloc(((sz.cx+16) * (sz.cy+8)));
memset(pPixels,0,((sz.cx+16) * (sz.cy+8)));
bmp.CreateBitmap(sz.cx,sz.cy ,1,1,pPixels);
oldbmp = dc.SelectObject(&bmp);
dc.PatBlt(0,0,sz.cx,sz.cy,BLACKNESS);
dc.TextOut(-abc.abcA,0,szChar,1);
a = abc.abcA;
c = abc.abcC;
bmp.GetBitmapBits(((sz.cx+16) * sz.cy)/8,pPixels);
// do the work of converting the monochrome bitmap to an alpha bimap and add it to the font
CalcAndAddChar(pPixels,sz.cx,sz.cy,n,a,c);
free(pPixels);
dc.SelectObject(oldbmp);
bmp.DeleteObject();
}
}
else
data[n].bUsed = false;
}
dc.DeleteDC();
BuildTextures();
CleanTempData();
}
Font::Font(const char *szFileName,bool &bSuccess)
{ // load a font from a file
bSuccess = false;
OFSTRUCT of;
HFILE hFile = OpenFile(szFileName,&of,OF_READ);
if (hFile == HFILE_ERROR)
return;
_lread(hFile,&header,sizeof(header));
if (header.dwSig == D3DFONTSIG)
{
b32Bit = false;
}
else if (header.dwSig == D3D32BITFONTSIG)
{
b32Bit = true;
}
else
{
_lclose(hFile);
return;
}
for (int i=0; i<header.iTextureCount; i++)
{
pTextures[i] = new FontTexture(hFile,(int)header.dwFontHeight,b32Bit);
}
iNumTextures = header.iTextureCount;
bSuccess = true;
}
Font::~Font()
{
CleanTextures();
}
void Font::CalcAlphaAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c)
{
int bmpw,bmph,rbmpw;
BYTE *pAAPix;
BYTE *pCur;
int x,y,n;
int val;
bmpw = (width)/8 ;
if (width%8)
bmpw++;
rbmpw = bmpw;
bmph = (height/8)+1;
if (bmpw & 1)
rbmpw++;
pAAPix = (BYTE *)malloc(bmpw * bmph * 2);
for (y=0; y<bmph; y++)
{
for (x=0; x<bmpw; x++)
{
pCur = pPixels + (y*rbmpw*8) + x;
val = 0;
for (n=0; n<8; n++)
{
val += (*pCur & 0x01)?1:0;
val += (*pCur & 0x02)?1:0;
val += (*pCur & 0x04)?1:0;
val += (*pCur & 0x08)?1:0;
val += (*pCur & 0x10)?1:0;
val += (*pCur & 0x20)?1:0;
val += (*pCur & 0x40)?1:0;
val += (*pCur & 0x80)?1:0;
pCur += rbmpw;
}
val<<=2;
if (val)
val-=1;
//if (val > 8)
// val += 40;
if (val > 255)
val = 255;
// adjust for gama
pAAPix[y*bmpw + x] = ((BYTE)(val & ALIAS_MASK))>>ALIAS_SHIFT;
}
}
// check to see if this char is the same as the default char
// there is no good way to determine if a given character actually exists in a font
// so we're just going to compare the resulatant bitmap with the character zero
// if it's exactly the same we're not going to add it to the font
if (num)
{
BYTE *pData = data[0].pData;
if (bmpw == data[0].bWidth)
{
int iSize = bmpw * bmph;
if (!memcmp(pData,pAAPix,iSize))
{
data[num].bUsed = false;
return; // don't add the char because it's the same as the default char
}
}
}
AddChar(pAAPix,bmpw,bmph,num,a,c);
}
void Font::CalcAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c)
{
int bmpw,bmph,rbmpw;
BYTE *pAAPix;
BYTE *pCur;
int x,y;
int val;
bmpw = width;
rbmpw = bmpw/8;
if (bmpw & 0x7)
rbmpw ++;
bmph = height;
if (rbmpw & 1)
rbmpw++;
bmpw += 1; // add one pixel between each letter
pAAPix = (BYTE *)malloc(bmpw * bmph * 2);
for (y=0; y<bmph; y++)
{
for (x=0; x<bmpw; x++)
{
pCur = pPixels + (y*rbmpw) + x/8;
int mask = 1 << (7-(x%8));
val = 0;
if (*pCur & mask)
val = 255;
pAAPix[y*bmpw + x] = ((BYTE)(val & ALIAS_MASK))>>ALIAS_SHIFT;
}
}
// check to see if this char is the same as the default char
// there is no good way to determine if a given character actually exists in a font
// so we're just going to compare the resulatant bitmap with the character zero
// if it's exactly the same we're not going to add it to the font
if (num)
{
BYTE *pData = data[0].pData;
if (bmpw == data[0].bWidth)
{
int iSize = bmpw * bmph;
if (!memcmp(pData,pAAPix,iSize))
{
data[num].bUsed = false;
return; // don't add the char because it's the same as the default char
}
}
}
AddChar(pAAPix,bmpw,bmph,num,a,c);
}
void Font::AddChar(BYTE *pAAPix,int w, int h,int nChar,int a, int c)
{
data[nChar].pData = pAAPix;
data[nChar].bWidth = w;
data[nChar].aWidth = a;
data[nChar].cWidth = c;
data[nChar].bUsed = true;
header.dwFontHeight = (DWORD)h; // all chars are same height;
}
void Font::CleanTempData()
{
for (int iChar = 0; iChar < 256; iChar++)
{
if (data[iChar].bUsed)
{
delete data[iChar].pData;
data[iChar].bUsed = false;
}
}
}
void Font::CleanTextures()
{
for (int iTexture = 0; iTexture < iNumTextures; iTexture++)
{
delete pTextures[iTexture];
}
iNumTextures = 0;
}
bool Font::BuildTextures()
{ // this function starts by trying to build 128x128 textures, if it ends up with more than 3 of them then it
// tries for 1 256x256 texture and suppliments with 128x128 textures, if it still ends up with more than 3 128x128 textures
// it tries for 2 256x256 textures, and so on and so on
int iMaxLargeTextures = 0;
int iNumSmallTextures = 0;
iNumTextures = 0;
retry:
CleanTextures();
iNumSmallTextures = 0;
if (iNumTextures >= iMaxLargeTextures)
{
pTextures[0] = new FontTexture((DWORD)128,header.dwFontHeight);
iNumSmallTextures = 1;
}
else
{
pTextures[0] = new FontTexture((DWORD)256,header.dwFontHeight);
}
iNumTextures = 1;
header.dwSig = D3DFONTSIG;
for (int nChar=0; nChar<256; nChar++)
{
if (!nChar || data[nChar].bUsed)
{
bool bSuccess = false;
for (int iTexture=0; iTexture<iNumTextures; iTexture++)
{
DWORD dwXPos,dwYPos;
if (pTextures[iTexture]->AddChar(data[nChar].pData,data[nChar].bWidth,dwXPos,dwYPos))
{ // the character fit in this texture, so note it and continue on to the next character
header.bTexture[nChar] = (BYTE)iTexture;
header.bX[nChar] = (BYTE)dwXPos;
header.bY[nChar] = (BYTE)dwYPos;
header.bW[nChar] = (BYTE)data[nChar].bWidth;
header.cA[nChar] = (BYTE)data[nChar].aWidth;
header.cC[nChar] = (BYTE)data[nChar].cWidth;
bSuccess = true;
break;
}
}
if (!bSuccess)
{ // we are out of space in the old texture(s) so
// we need to create a new texture
if (iNumTextures >= MAX_FONT_TEXTURES)
{ // we've exceeded our maximum number of textures
MessageBox(NULL,"Font too big","Error",MB_OK);
CleanTextures();
break;
}
// we need to create a new texture
if (iNumTextures >= iMaxLargeTextures)
{ // we've already created as many 256x256 textures as we determined, so now start creating 128x128 textures
pTextures[iNumTextures] = new FontTexture((DWORD)128,header.dwFontHeight);
iNumSmallTextures++;
if(iNumSmallTextures > 3)
{ // we've exceeded 3 128x128 textures, so increment the number of large textures and try another iteration
iMaxLargeTextures++;
goto retry;
}
if (bMinimizeTextureCount && iNumSmallTextures)
{
iMaxLargeTextures++;
goto retry;
}
}
else
{ // we haven't used the number of 256x256 textures we determined to use, so create another
pTextures[iNumTextures] = new FontTexture((DWORD)256,header.dwFontHeight);
}
iTexture = iNumTextures;
iNumTextures++;
DWORD dwXPos,dwYPos;
// try to add the current character to the new texture
if (pTextures[iTexture]->AddChar(data[nChar].pData,data[nChar].bWidth,dwXPos,dwYPos))
{ // it worked, so note it and continue to the next char
header.bTexture[nChar] = (BYTE)iTexture;
header.bX[nChar] = (BYTE)dwXPos;
header.bY[nChar] = (BYTE)dwYPos;
header.bW[nChar] = (BYTE)data[nChar].bWidth;
header.cA[nChar] = (BYTE)data[nChar].aWidth;
header.cC[nChar] = (BYTE)data[nChar].cWidth;
bSuccess = true;
}
else
{ // we couldn't even fit the character on a new texture so bail
CleanTextures();
MessageBox(NULL,"Font too big","Error",MB_OK);
break;
}
}
}
else
{ // this character was either not in the font or was not in the list of characters to include
// so just make it point to the same spot as character zero
header.bTexture[nChar] = header.bTexture[0];
header.bX[nChar] = header.bX[0];
header.bY[nChar] = header.bY[0];
header.bW[nChar] = header.bW[0];
header.cA[nChar] = header.cA[0];
header.cC[nChar] = header.cC[0];
}
}
header.iTextureCount = iNumTextures;
return true;
}
BYTE *Font::GetCharMap(int iChar)
{ // return a copy the bitmap for the specified character
if (iChar < 0 || iChar > 255)
return 0;
return pTextures[header.bTexture[iChar]]->GetCharMap(header.bX[iChar],header.bY[iChar],header.bW[iChar]);
}
void Font::SetCharMap(int iChar,BYTE *pData)
{ // copy the data specified into the data for the specified char
if (iChar < 0 || iChar > 255)
return;
pTextures[header.bTexture[iChar]]->SetCharMap(pData,header.bX[iChar],header.bY[iChar],header.bW[iChar]);
}
bool Font::Save(HFILE hFile)
{
if (b32Bit)
header.dwSig = D3D32BITFONTSIG;
else
header.dwSig = D3DFONTSIG;
_lwrite(hFile,(LPCSTR)&header,sizeof(header));
for (int iTexture = 0; iTexture < iNumTextures; iTexture++)
{
pTextures[iTexture]->Save(hFile);
}
return true;
}
void Font::Shorten()
{
header.dwFontHeight--;
for (int i=0; i<256; i++)
{
header.bY[i]++;
}
for (i=0; i<iNumTextures; i++)
{
pTextures[i]->ChangeFontHeight((int)header.dwFontHeight);
}
}
void Font::ShortenFromBottom()
{
header.dwFontHeight--;
for (int i=0; i<iNumTextures; i++)
{
pTextures[i]->ChangeFontHeight((int)header.dwFontHeight);
}
}
void Font::DrawTexture(HDC hDC,int iTexture, int x, int y)
{
DrawGrayscaleBmp(hDC,x,y,pTextures[iTexture]->Size(),pTextures[iTexture]->Size(),pTextures[iTexture]->GetTexture());
if (b32Bit)
Draw32BitBmp(hDC,x,y+266,pTextures[iTexture]->Size(),pTextures[iTexture]->Size(),pTextures[iTexture]->Get32BitTexture());
}
void Font::ExportTGAS(const char *szTag,const char *szOutputDir)
{
char szOutput[260];
strcpy(szOutput,szOutputDir);
int iLen = strlen(szOutput);
if (szOutput[iLen-1] != '\\')
strcat(szOutput,"\\"); // make sure the path ends in a backspace
for (int i=0; i<iNumTextures; i++)
{
char szFileName[260];
wsprintf(szFileName,"%s%s%02d.TGA",szOutput,szTag,i);
pTextures[i]->ExportTGA(szFileName);
}
char szMessage[260];
wsprintf(szMessage,"Wrote %d .TGA files to %s.",iNumTextures,szOutputDir);
MessageBox(NULL,szMessage,"Success",MB_OK);
}
void Font::ImportTGAS(const char *szFirstFile)
{
if (!strchr(szFirstFile,'.'))
{
MessageBox(NULL,"Invalid file path. Not a '.tga'.","Error",MB_OK);
return;
}
// find out where the number index is in the file name
const char *szWriteNumber = szFirstFile + strlen(szFirstFile) - 1;
while (*szWriteNumber != '.')
szWriteNumber--;
szWriteNumber-=2; // it should now point to the last
if (!isdigit(*szWriteNumber) || !isdigit(*(szWriteNumber+1)))
{
MessageBox(NULL,"Invalid file path. Could not file index numbers","Error",MB_OK);
return;
}
int iNumberIndex = szWriteNumber - szFirstFile;
for (int i=0; i<iNumTextures; i++)
{
char szFileName[260];
char szNumber[10];
strcpy(szFileName,szFirstFile);
wsprintf(szNumber,"%02d",i);
szFileName[iNumberIndex] = szNumber[0];
szFileName[iNumberIndex+1] = szNumber[1];
if (!pTextures[i]->ImportTGA(szFileName))
{
char szMessage[260];
wsprintf(szMessage,"Could not load texture %s.",szFileName);
MessageBox(NULL,szMessage,"Error",MB_OK);
b32Bit = false;
return;
}
}
b32Bit = true;
}
FontTexture::FontTexture(DWORD dwSize,int iFontHeight)
{
this->dwSize = dwSize;
this->iFontHeight = iFontHeight;
p32BitTexture = NULL;
iNumRows = dwSize/iFontHeight;
dwSpaceAvailableOnEachRow = new DWORD[iNumRows];
for (int iRow = 0; iRow < iNumRows; iRow++)
dwSpaceAvailableOnEachRow[iRow] = dwSize;
pTexture = new BYTE[dwSize * dwSize];
memset(pTexture,0,dwSize * dwSize);
b32Bit = false;
p32BitTexture = false;
}
FontTexture::FontTexture(HFILE hFile,int iFontHeight,bool b32Bit)
{
this->b32Bit = b32Bit;
p32BitTexture = NULL;
_lread(hFile,&dwSize,sizeof(dwSize));
this->iFontHeight = iFontHeight;
iNumRows = dwSize/iFontHeight;
dwSpaceAvailableOnEachRow = new DWORD[iNumRows];
for (int iRow = 0; iRow < iNumRows; iRow++)
dwSpaceAvailableOnEachRow[iRow] = 0; // we can't add anything else any more
if (b32Bit)
{
// read in 32 bit texture
p32BitTexture = new DWORD[dwSize * dwSize];
_lread(hFile,p32BitTexture,dwSize * dwSize * 4);
// now convert to 8 bit so we have something to work with
DWORD dwPixels = dwSize * dwSize;
pTexture = new BYTE[dwSize * dwSize];
DWORD *pSource = p32BitTexture;
BYTE *pDest = pTexture;
while (dwPixels)
{
*pDest = (BYTE)((*pSource)>>24);
pDest++;
pSource++;
dwPixels--;
}
}
else
{
pTexture = new BYTE[dwSize * dwSize];
_lread(hFile,pTexture,dwSize * dwSize);
}
}
FontTexture::~FontTexture()
{
delete pTexture;
delete p32BitTexture;
delete dwSpaceAvailableOnEachRow;
pTexture = NULL;
dwSpaceAvailableOnEachRow = NULL;
}
bool FontTexture::AddChar(BYTE *pData,DWORD dwWidth,DWORD &dwXPos,DWORD &dwYPos)
{
for (int iRow = 0; iRow < iNumRows; iRow++)
{
if (dwSpaceAvailableOnEachRow[iRow] >= dwWidth)
{
dwXPos = dwSize - dwSpaceAvailableOnEachRow[iRow];
dwYPos = iFontHeight * iRow;
AddCharToTexture(pData,dwWidth,dwXPos,dwYPos);
dwSpaceAvailableOnEachRow[iRow] -= dwWidth;
return true;
}
}
return false;
}
void FontTexture::AddCharToTexture(BYTE *pData,DWORD dwWidth,DWORD dwX,DWORD dwY)
{
for (int y=0; y<iFontHeight; y++)
{
BYTE *pSource = pData + dwWidth * y;
BYTE *pDest = pTexture + ((dwY+y) * dwSize) + dwX;
memcpy(pDest,pSource,dwWidth);
}
}
BYTE *FontTexture::GetCharMap(int iX, int iY, int iW)
{
BYTE *pResult = new BYTE[iW * iFontHeight];
for (int y=0; y<iFontHeight; y++)
{
BYTE *pDest = pResult + iW * y;
BYTE *pSource = pTexture + ((iY+y) * dwSize) + iX;
memcpy(pDest,pSource,iW);
}
return pResult;
}
bool FontTexture::Save(HFILE hFile)
{
_lwrite(hFile,(LPCSTR)&dwSize,sizeof(DWORD));
if (b32Bit)
_lwrite(hFile,(LPCSTR)p32BitTexture,dwSize * dwSize * 4);
else
_lwrite(hFile,(LPCSTR)pTexture,dwSize * dwSize);
return true;
}
bool FontTexture::ExportTGA(const char *szFullPath)
{
TGAHeader header;
memset(&header,0,sizeof(header));
header.TypeCode = 2;
header.Width = (WORD)dwSize;
header.Height = (WORD)dwSize;
header.BitsPerPixel = 32;
DWORD *dwExportTexture = new DWORD[dwSize * dwSize];
DWORD dwPixelsLeft = dwSize * dwSize;
DWORD *pDest = dwExportTexture;
// need to flip image
for (int iRow = dwSize-1; iRow>=0; iRow--)
{
for (int iColumn = 0; iColumn < (int)dwSize; iColumn++)
{
DWORD dwAlpha = pTexture[iRow * dwSize + iColumn];
if (dwAlpha)
*pDest = dwAlpha<<24 | 0xFFFFFF;
else
*pDest = 0;
pDest++;
}
}
bool bSuccess = false;
DWORD dwSizeWritten = 0;
HANDLE hFile = CreateFile(szFullPath,GENERIC_WRITE,0/*share mode*/,NULL/*security*/,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL/*template*/);
if (hFile == INVALID_HANDLE_VALUE)
goto errorexit;
WriteFile(hFile,&header,sizeof(header),&dwSizeWritten,NULL);
if (dwSizeWritten != sizeof(header))
goto errorexit;
dwSizeWritten = 0;
WriteFile(hFile,dwExportTexture,dwSize * dwSize * sizeof(DWORD),&dwSizeWritten,NULL);
if (dwSizeWritten != dwSize * dwSize * sizeof(DWORD))
goto errorexit;
bSuccess = true;
errorexit:
if (hFile != INVALID_HANDLE_VALUE)
CloseHandle(hFile);
delete dwExportTexture;
return bSuccess;
}
bool FontTexture::ImportTGA(const char *szFullPath)
{
b32Bit = true;
bool bSuccess = false;
HANDLE hFile = CreateFile(szFullPath,GENERIC_READ,0/*share mode*/,NULL/*security*/,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL/*template*/);
if (hFile == INVALID_HANDLE_VALUE)
return false;
TGAHeader header;
DWORD dwBytesRead = 0;
ReadFile(hFile,&header,sizeof(header),&dwBytesRead,NULL);
if (header.Width != header.Height)
return false;
if (header.Width != dwSize)
return false;
if (header.TypeCode != 2 || header.BitsPerPixel != 32)
return false;
DWORD *dwTexture = new DWORD[dwSize * dwSize];
// flip the image as we read it in
DWORD dwTotalBytesRead = 0;
for (int iRow = dwSize-1; iRow >=0; iRow--)
{
dwBytesRead = 0;
ReadFile(hFile,&dwTexture[iRow * dwSize],dwSize * 4,&dwBytesRead,NULL);
dwTotalBytesRead += dwBytesRead;
}
CloseHandle(hFile);
if (dwTotalBytesRead != dwSize * dwSize * 4)
{
delete dwTexture;
return false;
}
delete p32BitTexture;
p32BitTexture = dwTexture;
DWORD dwPixels = dwSize * dwSize;
delete pTexture;
pTexture = new BYTE[dwSize * dwSize];
DWORD *pSource = p32BitTexture;
BYTE *pDest = pTexture;
while (dwPixels)
{
*pDest = (BYTE)((*pSource)>>24);
pDest++;
pSource++;
dwPixels--;
}
return true;
}
@@ -0,0 +1,104 @@
// FontProperties.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "FontProperties.h"
#include "fontedoc.h"
#include "font.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFontProperties dialog
CFontProperties::CFontProperties(CWnd* pParent /*=NULL*/)
: CDialog(CFontProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(CFontProperties)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CFontProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFontProperties)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFontProperties, CDialog)
//{{AFX_MSG_MAP(CFontProperties)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFontProperties message handlers
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
FontProperties::FontProperties(CWnd* pParent /*=NULL*/)
: CDialog(FontProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(FontProperties)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void FontProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FontProperties)
DDX_Control(pDX, IDC_FONTSIZE, m_Size);
DDX_Control(pDX, IDC_FONTNAME, m_Name);
DDX_Control(pDX, IDC_FONTITALIC, m_Italic);
DDX_Control(pDX, IDC_FONTBOLD, m_Bold);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FontProperties, CDialog)
//{{AFX_MSG_MAP(FontProperties)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FontProperties message handlers
void FontProperties::OnOK()
{
CDialog::OnOK();
}
BOOL FontProperties::OnInitDialog()
{
CDialog::OnInitDialog();
char szOut[260];
sprintf(szOut,"%d",theFont->PointSize());
m_Size.SetWindowText(szOut);
if (theFont->IsBold())
m_Bold.SetWindowText("Yes");
else
m_Bold.SetWindowText("No");
if (theFont->IsItalic())
m_Italic.SetWindowText("Yes");
else
m_Italic.SetWindowText("No");
m_Name.SetWindowText(theFont->FaceName());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -0,0 +1,82 @@
#if !defined(AFX_FONTPROPERTIES_H__5AB361DF_79E3_4532_A954_B2BDCD94260C__INCLUDED_)
#define AFX_FONTPROPERTIES_H__5AB361DF_79E3_4532_A954_B2BDCD94260C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FontProperties.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CFontProperties dialog
class CFontProperties : public CDialog
{
// Construction
public:
CFontProperties(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CFontProperties)
enum { IDD = IDD_FONTPROPERTIES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFontProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CFontProperties)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
class FontProperties : public CDialog
{
// Construction
public:
FontProperties(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(FontProperties)
enum { IDD = IDD_FONTPROPERTIES };
CStatic m_Size;
CStatic m_Name;
CStatic m_Italic;
CStatic m_Bold;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(FontProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(FontProperties)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FONTPROPERTIES_H__5AB361DF_79E3_4532_A954_B2BDCD94260C__INCLUDED_)
@@ -0,0 +1,43 @@
// FontProperties1.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "FontProperties1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
FontProperties::FontProperties(CWnd* pParent /*=NULL*/)
: CDialog(FontProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(FontProperties)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void FontProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FontProperties)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FontProperties, CDialog)
//{{AFX_MSG_MAP(FontProperties)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FontProperties message handlers
@@ -0,0 +1,46 @@
#if !defined(AFX_FONTPROPERTIES1_H__114C7906_92A7_4611_9238_78185B12CCB9__INCLUDED_)
#define AFX_FONTPROPERTIES1_H__114C7906_92A7_4611_9238_78185B12CCB9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FontProperties1.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
class FontProperties : public CDialog
{
// Construction
public:
FontProperties(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(FontProperties)
enum { IDD = IDD_FONTPROPERTIES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(FontProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(FontProperties)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FONTPROPERTIES1_H__114C7906_92A7_4611_9238_78185B12CCB9__INCLUDED_)
@@ -0,0 +1,449 @@
//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
#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
"#include ""res\\fontedit.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"\r\n"
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"#include ""afxres.rc"" \t// Standard components\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\fontedit.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New...", ID_FILE_NEW
MENUITEM "N&ew Non Anti Aliased...", ID_FILE_NEWNONANTIALIASED
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
MENUITEM "Save &As...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "Export Textures...", ID_FILE_EXPORTTEXTURES
MENUITEM "Import Textures...", ID_FILE_IMPORTTEXTURES
MENUITEM SEPARATOR
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Image"
BEGIN
MENUITEM "&Undo", ID_IMAGE_UNDO
MENUITEM SEPARATOR
MENUITEM "&Next Char", ID_IMAGE_NEXT
MENUITEM "&Previous Char", ID_IMAGE_PREV
MENUITEM SEPARATOR
MENUITEM "Zoom &In", ID_IMAGE_ZOOMIN
MENUITEM "Zoom &Out", ID_IMAGE_ZOOMOUT
MENUITEM SEPARATOR
MENUITEM "&Shorten", ID_IMAGE_SHORTEN
MENUITEM "Shorten From &Bottom", ID_IMAGE_SHORTENFROMBOTTOM
MENUITEM "&Change A && C Widths", ID_IMAGE_CHANGEACWIDTHS
MENUITEM "Change &All A && C Widths", IDM_GLOBALCHANGEAANDC
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
MENUITEM "&Properties...", IDM_VIEW_PROPERTIES
END
POPUP "&Options"
BEGIN
MENUITEM "Minimize number of &Textures",
ID_OPTIONS_MINIMIZETEXTURECOUNT
MENUITEM "Minimize Texture &Space", ID_OPTIONS_MINIMIZETEXTURESPACE
MENUITEM SEPARATOR
MENUITEM "Alphabetic Characters Only", ID_OPTIONS_ALPHABETICCHARACTERSONLY
END
POPUP "&Help"
BEGIN
MENUITEM "&About Font Edit", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 34, 22, 217, 102
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About fontedit"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "Font Edit Version 4.2 for Game OS",IDC_STATIC,40,10,119,
8
LTEXT "Copyright © 1995-1999 Microsoft Corp. This programs is for internal use only.\nThis program comes with a 100% satisfaction guarantee. If you have any problems or ideas for improvement, please contact Matt Dawson (alias mad)",
IDC_STATIC,40,25,138,54
DEFPUSHBUTTON "OK",IDOK,176,6,32,14,WS_GROUP
LTEXT "By Matt Dawson",IDC_STATIC,40,87,96,8
END
IDD_ACWIDTH DIALOG DISCARDABLE 0, 0, 137, 39
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Set A & C Widths"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,76,2,50,14
PUSHBUTTON "Cancel",IDCANCEL,76,18,50,14
RTEXT "A Width",IDC_STATIC,6,7,29,7
EDITTEXT IDC_AWIDTH,37,4,33,12,ES_AUTOHSCROLL
RTEXT "C Width",IDC_STATIC,6,22,29,7
EDITTEXT IDC_CWIDTH,37,20,33,12,ES_AUTOHSCROLL
END
IDD_DELTASPACE DIALOG DISCARDABLE 0, 0, 186, 84
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Spacing"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
RTEXT "Delta A Width:",IDC_STATIC,7,11,55,8
RTEXT "Delta C Width:",IDC_STATIC,7,27,55,8
EDITTEXT IDC_DELTA_A,65,7,46,14,ES_AUTOHSCROLL
EDITTEXT IDC_DELTA_C,65,24,46,14,ES_AUTOHSCROLL
LTEXT "Clicking OK will add the values above to the respective A and C spacing widths for each character in the font. Positive values increase the space, negative values decrease the space.",
IDC_STATIC,7,42,172,35
END
IDD_FONTPROPERTIES DIALOG DISCARDABLE 0, 0, 212, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Properties"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,154,6,50,14
RTEXT "Font Name:",IDC_STATIC,8,7,65,8
RTEXT "Size:",IDC_STATIC,8,19,65,8
RTEXT "Bold:",IDC_STATIC,8,31,65,8
RTEXT "Italic:",IDC_STATIC,8,43,65,8
LTEXT "",IDC_FONTNAME,86,7,53,8
LTEXT "",IDC_FONTSIZE,86,19,53,8
LTEXT "",IDC_FONTBOLD,86,31,53,8
LTEXT "",IDC_FONTITALIC,86,43,53,8
END
IDD_EXPORT DIALOG DISCARDABLE 0, 0, 308, 87
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Export Textures"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,247,5,50,14
PUSHBUTTON "Cancel",IDCANCEL,247,23,50,14
EDITTEXT IDC_FILETAG,73,5,113,14,ES_AUTOHSCROLL
RTEXT "File Tag:",IDC_STATIC,6,9,65,8
EDITTEXT IDC_OUPUTDIR,73,23,113,14,ES_AUTOHSCROLL
RTEXT "Output Directory:",IDC_STATIC,6,27,65,8
PUSHBUTTON "Browse...",IDC_BROWSE,191,23,50,14
LTEXT "The file tag will be used to name the exported textures. If you entered 'myfont' for the file tag, then the first texture will be named myfont00.tga, the second myfont01.tga and so on.",
IDC_STATIC,8,46,235,35
END
IDD_CHOOSEDIR DIALOG DISCARDABLE 0, 0, 298, 149
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Choose Directory to Export Textures Too"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,242,8,50,14
PUSHBUTTON "Cancel",IDCANCEL,242,26,50,14
LISTBOX IDC_DIRLIST,6,24,114,92,LBS_SORT | LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_DIRPATH,6,128,230,14,ES_AUTOHSCROLL
LTEXT "Directory:",IDC_STATIC,6,119,182,8
COMBOBOX IDC_DRIVES,36,8,82,101,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
RTEXT "Drives:",IDC_STATIC,6,13,28,8
LISTBOX IDC_FILELIST,124,24,111,91,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LTEXT "Files",IDC_STATIC,126,15,67,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "FONTEDIT MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "FONTEDIT\0"
VALUE "LegalCopyright", "Copyright © 1995\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "FONTEDIT.EXE\0"
VALUE "ProductName", "FONTEDIT Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DELTASPACE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 77
END
IDD_FONTPROPERTIES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 205
TOPMARGIN, 7
BOTTOMMARGIN, 53
END
IDD_EXPORT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 301
TOPMARGIN, 7
BOTTOMMARGIN, 80
END
IDD_CHOOSEDIR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 291
TOPMARGIN, 7
BOTTOMMARGIN, 142
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "Font Edit\n\nFonted\nGOS Font (*.d3f)\n.d3f\nFontedit.Document\nFonted Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "Font Edit"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EXT"
ID_INDICATOR_CAPS "CAP"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "SCRL"
ID_INDICATOR_OVR "OVR"
ID_INDICATOR_REC "REC"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Create a new anti-aliased font\nNew"
ID_FILE_OPEN "Open an existing font\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the font\nSave"
ID_FILE_SAVE_AS "Save the font with a new name\nSave As"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display information about Font Edit\nAbout"
ID_APP_EXIT "Quit, prompts to save changes\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
ID_FILE_MRU_FILE3 "Open this document"
ID_FILE_MRU_FILE4 "Open this document"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_IMAGE_NEXT "Goto next char\nNext"
ID_IMAGE_PREV "Goto previous char\nPrevious"
ID_IMAGE_ZOOMIN "Enlarge view of char\nZoom"
ID_IMAGE_ZOOMOUT "Reduce view of char\nZoom Out"
ID_IMAGE_UNDO "Undo changes to this characture\nUndo"
ID_IMAGE_SHORTEN "removes one line from the top of the font"
ID_OPTIONS_ALL "Include all characters in the font that are built."
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_VIEW_PROPERTIES "View the properties of the current font."
ID_OPTIONS_FORCE256X256TEXTURES
"Forces all textures to be 256 x 256 textures"
ID_OPTIONS_MINIMIZETEXTURECOUNT
"Minimize the total number of textures required by new fonts"
ID_OPTIONS_MINIMIZETEXTURESPACE
"Minimizes the total texture space required by new fonts"
ID_FILE_EXPORTTEXTURES "Export Textures to TGA files"
ID_FILE_IMPORTTEXTURES "Import Textures from TGA files."
ID_OPTIONS_ALPHABETICCHARACTERSONLY
"With this option on no numbers or symbol characters will be included in the font"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "res\fontedit.rc2" // non-Microsoft Visual C++ edited resources
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#include "afxres.rc" // Standard components
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,38 @@
#ifdef __GLOBALS__
#define __ALLOC__
#define ALLOC(def,val) def = val
#else
#define __ALLOC__ extern
#define ALLOC(def,val) extern def
#endif
#define LEN_PATH 256
#define ALIAS_SHIFT 0
#define ALIAS_MASK 0xFF // top three bits
typedef struct {
int nOffset;
BYTE bWidth;
BYTE bHeight;
signed char nAWidth;
signed char nCWidth;
} Char;
typedef struct BitMapInfoTag {
BITMAPINFOHEADER bmiH;
union {
RGBQUAD qc[256];
WORD bmiC[256];
} colors;
} BitMapInfo;
class CFonteditView;
class CFonteditDoc;
class CMainFrame;
ALLOC(CFonteditView *view,0);
ALLOC(CMainFrame *main,0);
ALLOC(int nLanguage,4);
@@ -0,0 +1,124 @@
// mainfrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "globals.h"
#include "fontedit.h"
#include "mainfrm.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_IMAGE_SHORTENFROMBOTTOM, OnImageShortenfrombottom)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// arrays of IDs used to initialize control bars
// toolbar buttons - IDs are command buttons
static UINT BASED_CODE buttons[] =
{
// same order as in the bitmap 'toolbar.bmp'
ID_FILE_OPEN,
ID_FILE_SAVE,
ID_SEPARATOR,
ID_IMAGE_PREV,
ID_IMAGE_NEXT,
ID_SEPARATOR,
ID_IMAGE_ZOOMIN,
ID_IMAGE_ZOOMOUT
};
static UINT BASED_CODE indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
main = this;
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
!m_wndToolBar.SetButtons(buttons,
sizeof(buttons)/sizeof(UINT)))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
// TODO: Remove this if you don't want tool tips
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnImageShortenfrombottom()
{
// TODO: Add your command handler code here
}
@@ -0,0 +1,43 @@
// mainfrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnImageShortenfrombottom();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,43 @@
// Prop.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "Prop.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProp dialog
CProp::CProp(CWnd* pParent /*=NULL*/)
: CDialog(CProp::IDD, pParent)
{
//{{AFX_DATA_INIT(CProp)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CProp::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProp)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProp, CDialog)
//{{AFX_MSG_MAP(CProp)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProp message handlers
@@ -0,0 +1,46 @@
#if !defined(AFX_PROP_H__C7110B15_6EE9_4C65_BA2A_C25B74F090FF__INCLUDED_)
#define AFX_PROP_H__C7110B15_6EE9_4C65_BA2A_C25B74F090FF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Prop.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CProp dialog
class CProp : public CDialog
{
// Construction
public:
CProp(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CProp)
enum { IDD = IDD_FONTPROPERTIES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProp)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CProp)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROP_H__C7110B15_6EE9_4C65_BA2A_C25B74F090FF__INCLUDED_)
Binary file not shown.
@@ -0,0 +1,13 @@
//
// FONTEDIT.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
Binary file not shown.
@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// fontedit.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
@@ -0,0 +1,7 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
@@ -0,0 +1,322 @@
#define DEF_CHAR 128
Char cmap_all[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
1,0,0,0,0, // 127 
1,0,0,0,0, // 128 €
1,0,0,0,0, // 129
1,0,0,0,0, // 130
1,0,0,0,0, // 131 ƒ
1,0,0,0,0, // 132 „
1,0,0,0,0, // 133 …
1,0,0,0,0, // 134 †
1,0,0,0,0, // 135 ‡
1,0,0,0,0, // 136 ˆ
1,0,0,0,0, // 137 ‰
1,0,0,0,0, // 138 Š
1,0,0,0,0, // 139
1,0,0,0,0, // 140 Œ
1,0,0,0,0, // 141
1,0,0,0,0, // 142 Ž
1,0,0,0,0, // 143
1,0,0,0,0, // 144
1,0,0,0,0, // 145
1,0,0,0,0, // 146
1,0,0,0,0, // 147 “
1,0,0,0,0, // 148 ”
1,0,0,0,0, // 149 •
1,0,0,0,0, // 150
1,0,0,0,0, // 151 —
1,0,0,0,0, // 152 ˜
1,0,0,0,0, // 153 ™
1,0,0,0,0, // 154 š
1,0,0,0,0, // 155
1,0,0,0,0, // 156 œ
1,0,0,0,0, // 157
1,0,0,0,0, // 158 ž
1,0,0,0,0, // 159 Ÿ
1,0,0,0,0, // 160  
1,0,0,0,0, // 161 ¡
1,0,0,0,0, // 162 ¢
1,0,0,0,0, // 163 £
1,0,0,0,0, // 164 ¤
1,0,0,0,0, // 165 ¥
1,0,0,0,0, // 166 ¦
1,0,0,0,0, // 167 §
1,0,0,0,0, // 168 ¨
1,0,0,0,0, // 169 ©
1,0,0,0,0, // 170 ª
1,0,0,0,0, // 171 «
1,0,0,0,0, // 172 ¬
1,0,0,0,0, // 173 ­
1,0,0,0,0, // 174 ®
1,0,0,0,0, // 175 ¯
1,0,0,0,0, // 176 °
1,0,0,0,0, // 177 ±
1,0,0,0,0, // 178 ²
1,0,0,0,0, // 179 ³
1,0,0,0,0, // 180 ´
1,0,0,0,0, // 181 µ
1,0,0,0,0, // 182 ¶
1,0,0,0,0, // 183 ·
1,0,0,0,0, // 184 ¸
1,0,0,0,0, // 185 ¹
1,0,0,0,0, // 186 º
1,0,0,0,0, // 187 »
1,0,0,0,0, // 188 ¼
1,0,0,0,0, // 189 ½
1,0,0,0,0, // 190 ¾
1,0,0,0,0, // 191 µ
1,0,0,0,0, // 192 À
1,0,0,0,0, // 193 Á
1,0,0,0,0, // 194 Â
1,0,0,0,0, // 195 Ã
1,0,0,0,0, // 196 Ä
1,0,0,0,0, // 197 Å
1,0,0,0,0, // 198 Æ
1,0,0,0,0, // 199 Ç
1,0,0,0,0, // 200 È
1,0,0,0,0, // 201 É
1,0,0,0,0, // 202 Ê
1,0,0,0,0, // 203 Ë
1,0,0,0,0, // 204 Ì
1,0,0,0,0, // 205 Í
1,0,0,0,0, // 206 Î
1,0,0,0,0, // 207 Ï
1,0,0,0,0, // 208 Ð
1,0,0,0,0, // 209 Ñ
1,0,0,0,0, // 210 Ò
1,0,0,0,0, // 211 Ó
1,0,0,0,0, // 212 Ô
1,0,0,0,0, // 213 Õ
1,0,0,0,0, // 214 Ö
1,0,0,0,0, // 215 ×
1,0,0,0,0, // 216 Ø
1,0,0,0,0, // 217 Ù
1,0,0,0,0, // 218 Ú
1,0,0,0,0, // 219 Û
1,0,0,0,0, // 220 Ü
1,0,0,0,0, // 221 Ý
1,0,0,0,0, // 222 Þ
1,0,0,0,0, // 223 ß
1,0,0,0,0, // 224 à
1,0,0,0,0, // 225 á
1,0,0,0,0, // 226 â
1,0,0,0,0, // 227 ã
1,0,0,0,0, // 228 ä
1,0,0,0,0, // 229 å
1,0,0,0,0, // 230 æ
1,0,0,0,0, // 231 ç
1,0,0,0,0, // 232 è
1,0,0,0,0, // 233 é
1,0,0,0,0, // 234 ê
1,0,0,0,0, // 235 ë
1,0,0,0,0, // 236 ì
1,0,0,0,0, // 237 í
1,0,0,0,0, // 238 î
1,0,0,0,0, // 239 ï
1,0,0,0,0, // 240 ð
1,0,0,0,0, // 241 ñ
1,0,0,0,0, // 242 ò
1,0,0,0,0, // 243 ó
1,0,0,0,0, // 244 ô
1,0,0,0,0, // 245 õ
1,0,0,0,0, // 246 ö
1,0,0,0,0, // 247 ÷
1,0,0,0,0, // 248 ø
1,0,0,0,0, // 249 ù
1,0,0,0,0, // 250 ú
1,0,0,0,0, // 251 û
1,0,0,0,0, // 252 ü
1,0,0,0,0, // 253 ý
1,0,0,0,0, // 254 þ
1,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,322 @@
#define DEF_CHAR 128
Char cmap_alphaonly[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
0,0,0,0,0, // 033 !
0,0,0,0,0, // 034 "
0,0,0,0,0, // 035 #
0,0,0,0,0, // 036 $
0,0,0,0,0, // 037 %
0,0,0,0,0, // 038 &
0,0,0,0,0, // 039 '
0,0,0,0,0, // 040 (
0,0,0,0,0, // 041 )
0,0,0,0,0, // 042 *
0,0,0,0,0, // 043 +
0,0,0,0,0, // 044 ,
0,0,0,0,0, // 045 -
0,0,0,0,0, // 046 .
0,0,0,0,0, // 047 /
0,0,0,0,0, // 048 0
0,0,0,0,0, // 049 1
0,0,0,0,0, // 040 2
0,0,0,0,0, // 051 3
0,0,0,0,0, // 052 4
0,0,0,0,0, // 053 5
0,0,0,0,0, // 054 6
0,0,0,0,0, // 055 7
0,0,0,0,0, // 056 8
0,0,0,0,0, // 057 9
0,0,0,0,0, // 058 :
0,0,0,0,0, // 059 ;
0,0,0,0,0, // 060 <
0,0,0,0,0, // 061 =
0,0,0,0,0, // 062 >
0,0,0,0,0, // 063 ?
0,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
0,0,0,0,0, // 091 [
0,0,0,0,0, // 092 "\"
0,0,0,0,0, // 093 ]
0,0,0,0,0, // 094 ^
0,0,0,0,0, // 095 _
0,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
0,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
0,0,0,0,0, // 125 }
0,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
0,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
0,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
0,0,0,0,0, // 145
0,0,0,0,0, // 146
0,0,0,0,0, // 147 “
0,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
0,0,0,0,0, // 154 š
0,0,0,0,0, // 155
0,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
0,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
0,0,0,0,0, // 161 ¡
0,0,0,0,0, // 162 ¢
0,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
0,0,0,0,0, // 165 ¥
0,0,0,0,0, // 166 ¦
0,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
0,0,0,0,0, // 169 ©
0,0,0,0,0, // 170 ª
0,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
0,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
0,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
0,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
0,0,0,0,0, // 186 º
0,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
0,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
0,0,0,0,0, // 191 µ
1,0,0,0,0, // 192 À
1,0,0,0,0, // 193 Á
1,0,0,0,0, // 194 Â
1,0,0,0,0, // 195 Ã
1,0,0,0,0, // 196 Ä
1,0,0,0,0, // 197 Å
1,0,0,0,0, // 198 Æ
1,0,0,0,0, // 199 Ç
1,0,0,0,0, // 200 È
1,0,0,0,0, // 201 É
1,0,0,0,0, // 202 Ê
1,0,0,0,0, // 203 Ë
1,0,0,0,0, // 204 Ì
1,0,0,0,0, // 205 Í
1,0,0,0,0, // 206 Î
1,0,0,0,0, // 207 Ï
1,0,0,0,0, // 208 Ð
1,0,0,0,0, // 209 Ñ
1,0,0,0,0, // 210 Ò
1,0,0,0,0, // 211 Ó
1,0,0,0,0, // 212 Ô
1,0,0,0,0, // 213 Õ
1,0,0,0,0, // 214 Ö
0,0,0,0,0, // 215 ×
1,0,0,0,0, // 216 Ø
1,0,0,0,0, // 217 Ù
1,0,0,0,0, // 218 Ú
1,0,0,0,0, // 219 Û
1,0,0,0,0, // 220 Ü
1,0,0,0,0, // 221 Ý
1,0,0,0,0, // 222 Þ
1,0,0,0,0, // 223 ß
1,0,0,0,0, // 224 à
1,0,0,0,0, // 225 á
1,0,0,0,0, // 226 â
1,0,0,0,0, // 227 ã
1,0,0,0,0, // 228 ä
1,0,0,0,0, // 229 å
1,0,0,0,0, // 230 æ
1,0,0,0,0, // 231 ç
1,0,0,0,0, // 232 è
1,0,0,0,0, // 233 é
1,0,0,0,0, // 234 ê
1,0,0,0,0, // 235 ë
1,0,0,0,0, // 236 ì
1,0,0,0,0, // 237 í
1,0,0,0,0, // 238 î
1,0,0,0,0, // 239 ï
1,0,0,0,0, // 240 ð
1,0,0,0,0, // 241 ñ
1,0,0,0,0, // 242 ò
1,0,0,0,0, // 243 ó
1,0,0,0,0, // 244 ô
1,0,0,0,0, // 245 õ
1,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
1,0,0,0,0, // 248 ø
1,0,0,0,0, // 249 ù
1,0,0,0,0, // 250 ú
1,0,0,0,0, // 251 û
1,0,0,0,0, // 252 ü
1,0,0,0,0, // 253 ý
1,0,0,0,0, // 254 þ
1,0,0,0,0 // 255 ÿ
};
Binary file not shown.
@@ -0,0 +1,262 @@
# Microsoft Developer Studio Project File - Name="Fontedit" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Fontedit - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "fontedit.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fontedit.mak" CFG="Fontedit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Fontedit - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "Fontedit - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Fontedit - Win32 Debug"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\WinDebug"
# PROP BASE Intermediate_Dir ".\WinDebug"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# ADD BASE CPP /nologo /MT /W3 /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp4 /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD MTL /mktyplib203
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\WinRel"
# PROP BASE Intermediate_Dir ".\WinRel"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp4 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD MTL /mktyplib203
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "Fontedit - Win32 Debug"
# Name "Fontedit - Win32 Release"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\acwidths.cpp
# End Source File
# Begin Source File
SOURCE=.\ChooseDir.cpp
# End Source File
# Begin Source File
SOURCE=.\DeltaSpace.cpp
# End Source File
# Begin Source File
SOURCE=.\ExportTextures.cpp
# End Source File
# Begin Source File
SOURCE=.\FONT.CPP
# End Source File
# Begin Source File
SOURCE=.\FONTEDIT.CPP
# End Source File
# Begin Source File
SOURCE=.\FONTEDIT.RC
# End Source File
# Begin Source File
SOURCE=.\FONTEDOC.CPP
# End Source File
# Begin Source File
SOURCE=.\fontevw.cpp
# End Source File
# Begin Source File
SOURCE=.\FontProperties.cpp
# End Source File
# Begin Source File
SOURCE=.\lz.cpp
# End Source File
# Begin Source File
SOURCE=.\MAINFRM.CPP
# End Source File
# Begin Source File
SOURCE=.\README.TXT
# End Source File
# Begin Source File
SOURCE=.\STDAFX.CPP
# ADD BASE CPP /Yc"stdafx.h"
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\acwidths.h
# End Source File
# Begin Source File
SOURCE=.\all.h
# End Source File
# Begin Source File
SOURCE=.\alphaonly.h
# End Source File
# Begin Source File
SOURCE=.\ChooseDir.h
# End Source File
# Begin Source File
SOURCE=.\clubs.h
# End Source File
# Begin Source File
SOURCE=.\DeltaSpace.h
# End Source File
# Begin Source File
SOURCE=.\ENGLISH.H
# End Source File
# Begin Source File
SOURCE=.\ExportTextures.h
# End Source File
# Begin Source File
SOURCE=.\FONT.H
# End Source File
# Begin Source File
SOURCE=.\FONTEDIT.H
# End Source File
# Begin Source File
SOURCE=.\FONTEDOC.H
# End Source File
# Begin Source File
SOURCE=.\fontevw.h
# End Source File
# Begin Source File
SOURCE=.\FontProperties.h
# End Source File
# Begin Source File
SOURCE=.\FontProperties1.h
# End Source File
# Begin Source File
SOURCE=.\foreign.h
# End Source File
# Begin Source File
SOURCE=.\GLOBALS.H
# End Source File
# Begin Source File
SOURCE=.\lz.h
# End Source File
# Begin Source File
SOURCE=.\mac.h
# End Source File
# Begin Source File
SOURCE=.\MAINFRM.H
# End Source File
# Begin Source File
SOURCE=.\Prop.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\STDAFX.H
# End Source File
# Begin Source File
SOURCE=.\targa.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\RES\FONTEDIT.ICO
# End Source File
# Begin Source File
SOURCE=.\RES\FONTEDIT.RC2
# End Source File
# Begin Source File
SOURCE=.\RES\TOOLBAR.BMP
# End Source File
# End Group
# End Target
# End Project
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Fontedit"=.\fontedit.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,414 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=Fontedit - Win32 Debug
!MESSAGE No configuration specified. Defaulting to Fontedit - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "Fontedit - Win32 Debug" && "$(CFG)" !=\
"Fontedit - Win32 Release"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fontedit.mak" CFG="Fontedit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Fontedit - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "Fontedit - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "Fontedit - Win32 Debug"
MTL=mktyplib.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Fontedit - Win32 Debug"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "WinDebug"
# PROP BASE Intermediate_Dir "WinDebug"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "WinDebug"
# PROP Intermediate_Dir "WinDebug"
OUTDIR=.\WinDebug
INTDIR=.\WinDebug
ALL : "$(OUTDIR)\fontedit.exe"
CLEAN :
-@erase "$(INTDIR)\acwidths.obj"
-@erase "$(INTDIR)\DeltaSpace.obj"
-@erase "$(INTDIR)\FONT.OBJ"
-@erase "$(INTDIR)\FONTEDIT.OBJ"
-@erase "$(INTDIR)\fontedit.pch"
-@erase "$(INTDIR)\FONTEDIT.res"
-@erase "$(INTDIR)\FONTEDOC.OBJ"
-@erase "$(INTDIR)\fontevw.obj"
-@erase "$(INTDIR)\MAINFRM.OBJ"
-@erase "$(INTDIR)\STDAFX.OBJ"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(OUTDIR)\fontedit.exe"
-@erase "$(OUTDIR)\fontedit.ilk"
-@erase "$(OUTDIR)\fontedit.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MT /W3 /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp1 /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
# SUBTRACT CPP /Fr
CPP_PROJ=/nologo /Zp1 /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D\
"_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
CPP_OBJS=.\WinDebug/
CPP_SBRS=.\.
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/FONTEDIT.res" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/fontedit.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/fontedit.pdb" /debug /machine:I386\
/out:"$(OUTDIR)/fontedit.exe"
LINK32_OBJS= \
"$(INTDIR)\acwidths.obj" \
"$(INTDIR)\DeltaSpace.obj" \
"$(INTDIR)\FONT.OBJ" \
"$(INTDIR)\FONTEDIT.OBJ" \
"$(INTDIR)\FONTEDIT.res" \
"$(INTDIR)\FONTEDOC.OBJ" \
"$(INTDIR)\fontevw.obj" \
"$(INTDIR)\MAINFRM.OBJ" \
"$(INTDIR)\STDAFX.OBJ"
"$(OUTDIR)\fontedit.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "WinRel"
# PROP BASE Intermediate_Dir "WinRel"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "WinRel"
# PROP Intermediate_Dir "WinRel"
OUTDIR=.\WinRel
INTDIR=.\WinRel
ALL : "$(OUTDIR)\fontedit.exe"
CLEAN :
-@erase "$(INTDIR)\acwidths.obj"
-@erase "$(INTDIR)\DeltaSpace.obj"
-@erase "$(INTDIR)\FONT.OBJ"
-@erase "$(INTDIR)\FONTEDIT.OBJ"
-@erase "$(INTDIR)\fontedit.pch"
-@erase "$(INTDIR)\FONTEDIT.res"
-@erase "$(INTDIR)\FONTEDOC.OBJ"
-@erase "$(INTDIR)\fontevw.obj"
-@erase "$(INTDIR)\MAINFRM.OBJ"
-@erase "$(INTDIR)\STDAFX.OBJ"
-@erase "$(OUTDIR)\fontedit.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
# SUBTRACT CPP /Fr
CPP_PROJ=/nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
"_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
CPP_OBJS=.\WinRel/
CPP_SBRS=.\.
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/FONTEDIT.res" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/fontedit.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)/fontedit.pdb" /machine:I386 /out:"$(OUTDIR)/fontedit.exe"
LINK32_OBJS= \
"$(INTDIR)\acwidths.obj" \
"$(INTDIR)\DeltaSpace.obj" \
"$(INTDIR)\FONT.OBJ" \
"$(INTDIR)\FONTEDIT.OBJ" \
"$(INTDIR)\FONTEDIT.res" \
"$(INTDIR)\FONTEDOC.OBJ" \
"$(INTDIR)\fontevw.obj" \
"$(INTDIR)\MAINFRM.OBJ" \
"$(INTDIR)\STDAFX.OBJ"
"$(OUTDIR)\fontedit.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
MTL_PROJ=
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "Fontedit - Win32 Debug"
# Name "Fontedit - Win32 Release"
!IF "$(CFG)" == "Fontedit - Win32 Debug"
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\STDAFX.CPP
DEP_CPP_STDAF=\
".\STDAFX.H"\
!IF "$(CFG)" == "Fontedit - Win32 Debug"
# ADD BASE CPP /Yc"stdafx.h"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /Zp1 /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D\
"_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c $(SOURCE) \
"$(INTDIR)\STDAFX.OBJ" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\fontedit.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
# ADD BASE CPP /Yc"stdafx.h"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
"_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
"$(INTDIR)\STDAFX.OBJ" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\fontedit.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONTEDIT.CPP
DEP_CPP_FONTE=\
".\FONTEDIT.H"\
".\FONTEDOC.H"\
".\fontevw.h"\
".\GLOBALS.H"\
".\MAINFRM.H"\
".\STDAFX.H"\
"$(INTDIR)\FONTEDIT.OBJ" : $(SOURCE) $(DEP_CPP_FONTE) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\MAINFRM.CPP
DEP_CPP_MAINF=\
".\FONTEDIT.H"\
".\GLOBALS.H"\
".\MAINFRM.H"\
".\STDAFX.H"\
"$(INTDIR)\MAINFRM.OBJ" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONTEDOC.CPP
DEP_CPP_FONTED=\
".\FONT.H"\
".\FONTEDIT.H"\
".\FONTEDOC.H"\
".\fontevw.h"\
".\GLOBALS.H"\
".\MAINFRM.H"\
".\STDAFX.H"\
"$(INTDIR)\FONTEDOC.OBJ" : $(SOURCE) $(DEP_CPP_FONTED) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\fontevw.cpp
DEP_CPP_FONTEV=\
".\acwidths.h"\
".\DeltaSpace.h"\
".\FONTEDIT.H"\
".\FONTEDOC.H"\
".\fontevw.h"\
".\GLOBALS.H"\
".\STDAFX.H"\
"$(INTDIR)\fontevw.obj" : $(SOURCE) $(DEP_CPP_FONTEV) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONTEDIT.RC
DEP_RSC_FONTEDI=\
".\RES\FONTEDIT.ICO"\
".\RES\FONTEDIT.RC2"\
".\RES\TOOLBAR.BMP"\
"$(INTDIR)\FONTEDIT.res" : $(SOURCE) $(DEP_RSC_FONTEDI) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\README.TXT
!IF "$(CFG)" == "Fontedit - Win32 Debug"
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONT.CPP
DEP_CPP_FONT_=\
".\all.h"\
".\clubs.h"\
".\ENGLISH.H"\
".\fontevw.h"\
".\foreign.h"\
".\GLOBALS.H"\
".\mac.h"\
".\STDAFX.H"\
"$(INTDIR)\FONT.OBJ" : $(SOURCE) $(DEP_CPP_FONT_) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\acwidths.cpp
DEP_CPP_ACWID=\
".\acwidths.h"\
".\FONTEDIT.H"\
".\STDAFX.H"\
"$(INTDIR)\acwidths.obj" : $(SOURCE) $(DEP_CPP_ACWID) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\DeltaSpace.cpp
DEP_CPP_DELTA=\
".\DeltaSpace.h"\
".\FONTEDIT.H"\
".\STDAFX.H"\
"$(INTDIR)\DeltaSpace.obj" : $(SOURCE) $(DEP_CPP_DELTA) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
# End Target
# End Project
################################################################################
@@ -0,0 +1,319 @@
// fontedoc.cpp : implementation of the CFonteditDoc class
//
#include "stdafx.h"
#include "globals.h"
#include "font.h"
#include "fontedit.h"
#include "mainfrm.h"
#include "fontedoc.h"
#include "fontevw.h"
#include "exporttextures.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
Font *theFont = NULL;
char szExportName[260];
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc
IMPLEMENT_DYNCREATE(CFonteditDoc, CDocument)
BEGIN_MESSAGE_MAP(CFonteditDoc, CDocument)
//{{AFX_MSG_MAP(CFonteditDoc)
ON_COMMAND(ID_FILE_NEW, OnFileNew)
ON_COMMAND(ID_IMAGE_SHORTEN, OnImageShorten)
ON_COMMAND(ID_FILE_NEWNONANTIALIASED, OnFileNewnonantialiased)
ON_COMMAND(ID_OPTIONS_MINIMIZETEXTURECOUNT, OnOptionsMinimizetexturecount)
ON_COMMAND(ID_OPTIONS_MINIMIZETEXTURESPACE, OnOptionsMinimizetexturespace)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_MINIMIZETEXTURECOUNT, OnUpdateOptionsMinimizetexturecount)
ON_COMMAND(ID_FILE_EXPORTTEXTURES, OnFileExporttextures)
ON_COMMAND(ID_FILE_IMPORTTEXTURES, OnFileImporttextures)
ON_UPDATE_COMMAND_UI(ID_FILE_EXPORTTEXTURES, OnUpdateFileExporttextures)
ON_UPDATE_COMMAND_UI(ID_FILE_IMPORTTEXTURES, OnUpdateFileImporttextures)
ON_COMMAND(ID_IMAGE_SHORTENFROMBOTTOM, OnImageShortenfrombottom)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc construction/destruction
CFonteditDoc::CFonteditDoc()
{
bMinimizeTextureCount = true;
SetModifiedFlag(FALSE);
}
CFonteditDoc::~CFonteditDoc()
{
}
BOOL CFonteditDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc serialization
void CFonteditDoc::Serialize(CArchive& ar)
{
if (!theFont)
return;
if (ar.IsStoring())
{
theFont->Save(ar.GetFile()->m_hFile);
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc diagnostics
#ifdef _DEBUG
void CFonteditDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CFonteditDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc commands
BOOL CFonteditDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
Font *temp;
bool bSuccess=false;
temp = new Font(lpszPathName,bSuccess);
if (!bSuccess)
{
delete temp;
return FALSE;
}
if (theFont)
Cleanup();
theFont = temp;
view->NewFont();
return TRUE;
}
void CFonteditDoc::Cleanup(void)
{
delete theFont;
}
void CFonteditDoc::OnFileNewnonantialiased()
{
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
if (theFont)
{
lf.lfHeight = theFont->PointSize();
lf.lfWeight = theFont->IsBold()?700:400;
lf.lfItalic = theFont->IsItalic();
strcpy(lf.lfFaceName, theFont->FaceName());
}
CFontDialog fdlg(&lf);
Font *temp;
if (IsModified())
{
int result = view->MessageBox("This font has been modified, do you want to save it",NULL,MB_YESNOCANCEL);
if(result == IDCANCEL)
return;
if (result == IDYES)
main->SendMessage(WM_COMMAND,ID_FILE_SAVE,0);
}
fdlg.m_cf.Flags |= CF_TTONLY;
if (fdlg.DoModal() != IDOK)
return;
temp=new Font(fdlg.m_cf.lpLogFont->lfFaceName,
fdlg.m_cf.lpLogFont->lfHeight,
fdlg.m_cf.lpLogFont->lfItalic!=0,
fdlg.m_cf.lpLogFont->lfWeight,false,bMinimizeTextureCount);
if (!temp)
return;
Cleanup();
theFont = temp;
m_strPathName.Empty();
view->NewFont();
view->InvalidateRect(NULL,TRUE);
SetModifiedFlag(FALSE);
}
void CFonteditDoc::OnFileNew()
{
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
if (theFont)
{
lf.lfHeight = theFont->PointSize();
lf.lfWeight = theFont->IsBold()?700:400;
lf.lfItalic = theFont->IsItalic();
strcpy(lf.lfFaceName, theFont->FaceName());
}
CFontDialog fdlg(&lf);
Font *temp;
if (IsModified())
{
int result = view->MessageBox("This font has been modified, do you want to save it",NULL,MB_YESNOCANCEL);
if(result == IDCANCEL)
return;
if (result == IDYES)
main->SendMessage(WM_COMMAND,ID_FILE_SAVE,0);
}
fdlg.m_cf.Flags |= CF_TTONLY;
if (fdlg.DoModal() != IDOK)
return;
temp=new Font(fdlg.m_cf.lpLogFont->lfFaceName,
fdlg.m_cf.lpLogFont->lfHeight,
fdlg.m_cf.lpLogFont->lfItalic!=0,
fdlg.m_cf.lpLogFont->lfWeight,true,bMinimizeTextureCount);
if (!temp)
return;
Cleanup();
theFont = temp;
m_strPathName.Empty();
view->NewFont();
view->InvalidateRect(NULL,TRUE);
SetModifiedFlag(FALSE);
}
BOOL CFonteditDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
if (!theFont)
return false;
view->UpdateFont();
return CDocument::OnSaveDocument(lpszPathName);
}
void CFonteditDoc::OnImageShorten()
{
if (!theFont)
return;
theFont->Shorten();
view->InvalidateRect(NULL,TRUE);
}
void CFonteditDoc::OnImageShortenfrombottom()
{
if (!theFont)
return;
theFont->ShortenFromBottom();
view->InvalidateRect(NULL,TRUE);
}
void CFonteditDoc::OnOptionsMinimizetexturecount()
{
bMinimizeTextureCount = true;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURECOUNT,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURESPACE,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditDoc::OnOptionsMinimizetexturespace()
{
bMinimizeTextureCount = false;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURECOUNT,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURESPACE,MF_BYCOMMAND|MF_CHECKED);
}
void CFonteditDoc::OnUpdateOptionsMinimizetexturecount(CCmdUI* pCmdUI)
{
if (bMinimizeTextureCount)
OnOptionsMinimizetexturecount();
else
OnOptionsMinimizetexturespace();
}
void CFonteditDoc::OnFileExporttextures()
{
CExportTextures dlg;
if (dlg.DoModal()!= IDOK)
return;
if (!SetCurrentDirectory(dlg.m_OutputDir))
{
int iResult = MessageBox(NULL,"That directory does not exist, do you want to create it?","Question",MB_YESNO);
if (iResult == IDNO)
return;
CreateDirectory(dlg.m_OutputDir,NULL);
}
theFont->ExportTGAS(dlg.m_FileTag,dlg.m_OutputDir);
}
void CFonteditDoc::OnFileImporttextures()
{
CFileDialog dlg(true /*open/save*/,"*.tga",NULL,OFN_FILEMUSTEXIST,"Targas (*.tga)|*.tga||",NULL);
dlg.DoModal();
const char *szPath = dlg.m_ofn.lpstrFile;
if (!strstr(szPath,"00.tga") && !strstr(szPath,"00.TGA"))
{
MessageBox(NULL,"You must select the first file that was written out by the export command, it will be called something like 'fontname00.tga'","Bogus File Name",MB_OK);
return;
}
theFont->ImportTGAS(szPath);
view->InvalidateRect(NULL,TRUE);
}
void CFonteditDoc::OnUpdateFileExporttextures(CCmdUI* pCmdUI)
{
if (!theFont)
pCmdUI->Enable(false);
else
pCmdUI->Enable(true);
}
void CFonteditDoc::OnUpdateFileImporttextures(CCmdUI* pCmdUI)
{
if (!theFont)
pCmdUI->Enable(false);
else
pCmdUI->Enable(true);
}
@@ -0,0 +1,58 @@
// fontedoc.h : interface of the CFonteditDoc class
//
/////////////////////////////////////////////////////////////////////////////
class CFonteditDoc : public CDocument
{
protected: // create from serialization only
CFonteditDoc();
DECLARE_DYNCREATE(CFonteditDoc)
void Cleanup(void);
// Attributes
bool bMinimizeTextureCount;
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFonteditDoc)
public:
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFonteditDoc();
virtual void Serialize(CArchive& ar); // overridden for document i/o
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFonteditDoc)
afx_msg void OnFileNew();
afx_msg void OnImageShorten();
afx_msg void OnFileNewnonantialiased();
afx_msg void OnOptionsMinimizetexturecount();
afx_msg void OnOptionsMinimizetexturespace();
afx_msg void OnUpdateOptionsMinimizetexturecount(CCmdUI* pCmdUI);
afx_msg void OnFileExporttextures();
afx_msg void OnFileImporttextures();
afx_msg void OnUpdateFileExporttextures(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileImporttextures(CCmdUI* pCmdUI);
afx_msg void OnImageShortenfrombottom();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class Font;
extern Font *theFont;
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,601 @@
// fontevw.cpp : implementation of the CFonteditView class
//
#include "stdafx.h"
#include "globals.h"
#include "fontedit.h"
#include "fontedoc.h"
#include "fontevw.h"
#include "acwidths.h"
#include "deltaspace.h"
#include "fontproperties.h"
#include "font.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFonteditView
IMPLEMENT_DYNCREATE(CFonteditView, CView)
BEGIN_MESSAGE_MAP(CFonteditView, CView)
//{{AFX_MSG_MAP(CFonteditView)
ON_COMMAND(ID_IMAGE_NEXT, OnImageNext)
ON_COMMAND(ID_IMAGE_PREV, OnImagePrev)
ON_COMMAND(ID_IMAGE_ZOOMIN, OnImageZoomin)
ON_COMMAND(ID_IMAGE_ZOOMOUT, OnImageZoomout)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_COMMAND(ID_IMAGE_UNDO, OnImageUndo)
ON_WM_CHAR()
ON_COMMAND(ID_OPTIONS_CLUBS, OnOptionsClubs)
ON_COMMAND(ID_OPTIONS_ENGLISH, OnOptionsEnglish)
ON_COMMAND(ID_OPTIONS_FOREIGN, OnOptionsForeign)
ON_COMMAND(ID_IMAGE_CHANGEACWIDTHS, OnImageChangeacwidths)
ON_COMMAND(ID_OPTIONS_MAC, OnOptionsMac)
ON_COMMAND(ID_OPTIONS_ALL, OnOptionsAll)
ON_COMMAND(IDM_GLOBALCHANGEAANDC, OnGlobalchangeaandc)
ON_COMMAND(IDM_VIEW_PROPERTIES, OnViewProperties)
ON_COMMAND(ID_OPTIONS_ALPHABETICCHARACTERSONLY, OnOptionsAlphabeticcharactersonly)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#define MAPHEIGHT 25
#define EDIT_OFFSET_X 0
#define EDIT_OFFSET_Y 35
#define GAP 10
#define SWIDTH 32
/////////////////////////////////////////////////////////////////////////////
// CFonteditView construction/destruction
CFonteditView::CFonteditView()
{
int n,m;
view = this;
nZoom = 5;
bCurChar = 65;
CurColor = 128;
bDownInColor = 0;
bDownInDraw = 0;
pWorkspace=0;
nWorkspaceSize = 0;
nWorkspaceWidth = 0;
nWorkspaceHeight = 0;
lp = (LOGPALETTE *)malloc(sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY)*256));
lp->palVersion = 0x300;
lp->palNumEntries = 256;
for (n=0; n<256; n++)
{
lp->palPalEntry[n].peRed = (BYTE)n;
lp->palPalEntry[n].peGreen = (BYTE)n;
lp->palPalEntry[n].peBlue = (BYTE)n;
lp->palPalEntry[n].peFlags = 0;
}
hPal = CreatePalette(lp);
bmi.bmiH.biSize = sizeof(bmi.bmiH);
bmi.bmiH.biPlanes = 1;
bmi.bmiH.biBitCount = 8;
bmi.bmiH.biCompression = BI_RGB;
bmi.bmiH.biSizeImage = 0;
bmi.bmiH.biClrUsed = 0;
bmi.bmiH.biClrImportant = 0;
for (n=0; n<256; n++)
{
bmi.colors.bmiC[n] = (WORD)n;
}
pScale = (BYTE *)malloc(MAPHEIGHT * 512);
pCurColor = (BYTE *)malloc(SWIDTH * SWIDTH);
memset(pCurColor,CurColor,SWIDTH*SWIDTH);
DWORD b;
for (n=0; n<256; n++)
{
b = n;
if (b>255)
b=255;
for (m=0; m<MAPHEIGHT; m++)
{
pScale[m*512 + n*2] = (BYTE)b;
pScale[m*512 + n*2 + 1] = (BYTE)b;
}
}
}
CFonteditView::~CFonteditView()
{
free(lp);
DeleteObject(hPal);
if (pWorkspace)
free(pWorkspace);
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditView drawing
void CFonteditView::OnDraw(CDC* pDC)
{
int nMainWidth;
int nMainHeight;
int nHeight;
int nWidth;
char szOut[256];
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!theFont)
return;
HPALETTE hOldPal = ::SelectPalette(pDC->m_hDC,hPal,FALSE);
RealizePalette(pDC->m_hDC);
// draw the grayscale gradient map of values to pick from
bmi.bmiH.biHeight = MAPHEIGHT;
bmi.bmiH.biWidth = 512;
HBRUSH hRedBrush= ::CreateSolidBrush(0x0000FF);
HBRUSH hOldBrush = (HBRUSH)::SelectObject(pDC->m_hDC,hRedBrush);
::PatBlt(pDC->m_hDC,0,0,518,MAPHEIGHT + 6,PATCOPY);
SetDIBitsToDevice(pDC->m_hDC,
3,
3,
512,
MAPHEIGHT,
0,0,
0,
MAPHEIGHT,
pScale,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS);
nWidth = nWorkspaceWidth;
nHeight = nWorkspaceHeight;
nMainWidth = theFont->GetCharWidth(bCurChar) * nZoom;
nMainHeight = theFont->GetCharHeight(bCurChar) * nZoom;
bmi.bmiH.biWidth = nWidth;
bmi.bmiH.biHeight = nHeight;
rCurChar.left = EDIT_OFFSET_X;
rCurChar.top = EDIT_OFFSET_Y;
rCurChar.right = rCurChar.left + theFont->GetCharWidth(bCurChar) * nZoom;
rCurChar.bottom = rCurChar.top + theFont->GetCharHeight(bCurChar) * nZoom;
if (!pWorkspace)
GetCurImage();
StretchDIBits(pDC->m_hDC,EDIT_OFFSET_X,EDIT_OFFSET_Y,
theFont->GetCharWidth(bCurChar) * nZoom,
theFont->GetCharHeight(bCurChar) * nZoom,
0,0,
theFont->GetCharWidth(bCurChar),
theFont->GetCharHeight(bCurChar),
pWorkspace,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS,
SRCCOPY);
rCurSmallChar.left = EDIT_OFFSET_X + nMainWidth + GAP;
rCurSmallChar.top = EDIT_OFFSET_Y;
rCurSmallChar.right = rCurSmallChar.left + theFont->GetCharWidth(bCurChar);
rCurSmallChar.bottom = rCurSmallChar.top + theFont->GetCharHeight(bCurChar);
SetDIBitsToDevice(pDC->m_hDC,
EDIT_OFFSET_X + nMainWidth + GAP,
EDIT_OFFSET_Y,
theFont->GetCharWidth(bCurChar),
theFont->GetCharHeight(bCurChar),
0,0,
0,
theFont->GetCharHeight(bCurChar),
pWorkspace,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS);
bmi.bmiH.biWidth = bmi.bmiH.biHeight = SWIDTH;
rCurColor.top = EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) + GAP;
rCurColor.left = EDIT_OFFSET_X + nMainWidth + GAP;
rCurColor.right = rCurColor.left + SWIDTH + SWIDTH + SWIDTH;
rCurColor.bottom = rCurColor.top + SWIDTH;
::PatBlt(pDC->m_hDC,rCurColor.left - 3,rCurColor.top - 3
,SWIDTH+6,SWIDTH+6,PATCOPY);
SetDIBitsToDevice(pDC->m_hDC,
EDIT_OFFSET_X + nMainWidth + GAP,
EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) + GAP,
SWIDTH,
SWIDTH,
0,0,
0,
SWIDTH,
pCurColor,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS);
wsprintf(szOut,"%d ",((int)CurColor)>>ALIAS_SHIFT);
pDC->TextOut(
EDIT_OFFSET_X + nMainWidth + GAP + SWIDTH + GAP,
EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) + GAP,
szOut,lstrlen(szOut));
wsprintf(szOut,"%c:%d ",bCurChar,(int)bCurChar);
pDC->TextOut(0,EDIT_OFFSET_Y + nMainHeight + GAP,szOut,lstrlen(szOut));
::SelectPalette(pDC->m_hDC,hOldPal,FALSE);
::SelectObject(pDC->m_hDC,hOldBrush);
::DeleteObject(hRedBrush);
int iTextureY = EDIT_OFFSET_Y + nMainHeight + GAP + 50;
int iTextureCount = theFont->GetTextureCount();
for (int i=0; i<iTextureCount; i++)
{
theFont->DrawTexture(pDC->m_hDC,i,i*260,iTextureY);
}
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditView diagnostics
#ifdef _DEBUG
void CFonteditView::AssertValid() const
{
CView::AssertValid();
}
void CFonteditView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CFonteditDoc* CFonteditView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFonteditDoc)));
return (CFonteditDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFonteditView message handlers
void CFonteditView::NewFont(void)
{
GetCurImage();
}
void CFonteditView::UpdateFont(void)
{
SetCurImage();
}
void CFonteditView::OnImageNext()
{
if (!theFont)
return;
SetCurImage();
bCurChar++;
GetCurImage();
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnImagePrev()
{
if (!theFont)
return;
SetCurImage();
bCurChar--;
GetCurImage();
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnImageZoomin()
{
if (!theFont)
return;
if (nZoom <24)
nZoom++;
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnImageZoomout()
{
if (!theFont)
return;
if (nZoom > 1)
nZoom --;
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnMouseMove(UINT nFlags, CPoint point)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (bDownInColor && point.y > 3 && point.y <= 3 + MAPHEIGHT &&
point.x > 3 && point.x <= 515)
{
CurColor = (BYTE)((point.x - 3)/2);
memset(pCurColor,CurColor,SWIDTH * SWIDTH);
InvalidateRect(&rCurColor,FALSE);
}
if (bDownInDraw && point.y > EDIT_OFFSET_Y &&
point.y < EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) * nZoom &&
point.x > EDIT_OFFSET_X &&
point.x < EDIT_OFFSET_X + theFont->GetCharWidth(bCurChar) * nZoom)
{ // we're drawing on the bmp
bDownInDraw = 1;
point.y -= EDIT_OFFSET_Y;
point.x -= EDIT_OFFSET_X;
int x = point.x/nZoom;
int y = point.y/nZoom;
pWorkspace[(nWorkspaceHeight-1-y) * nWorkspaceWidth + x] = CurColor;
InvalidateRect(&rCurChar,FALSE);
InvalidateRect(&rCurSmallChar,FALSE);
return;
}
}
void CFonteditView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (!theFont)
return;
GetCapture();
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (point.y > 3 && point.y <= 3 + MAPHEIGHT &&
point.x > 3 && point.x <= 515)
{
CurColor = (BYTE)((point.x - 3));
memset(pCurColor,CurColor,SWIDTH * SWIDTH);
InvalidateRect(&rCurColor,FALSE);
bDownInColor = TRUE;
return;
}
if (point.y > EDIT_OFFSET_Y &&
point.y < EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) * nZoom &&
point.x > EDIT_OFFSET_X &&
point.x < EDIT_OFFSET_X + theFont->GetCharWidth(bCurChar) * nZoom)
{ // we're drawing on the bmp
bDownInDraw = 1;
point.y -= EDIT_OFFSET_Y;
point.x -= EDIT_OFFSET_X;
int x = point.x/nZoom;
int y = point.y/nZoom;
pWorkspace[(nWorkspaceHeight-1-y) * nWorkspaceWidth + x] = CurColor;
InvalidateRect(&rCurChar,FALSE);
InvalidateRect(&rCurSmallChar,FALSE);
pDoc->SetModifiedFlag(TRUE);
return;
}
}
void CFonteditView::OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
bDownInColor = FALSE;
bDownInDraw = FALSE;
}
void CFonteditView::OnRButtonDown(UINT nFlags, CPoint point)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (point.y > EDIT_OFFSET_Y &&
point.y < EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) * nZoom &&
point.x > EDIT_OFFSET_X &&
point.x < EDIT_OFFSET_X + theFont->GetCharWidth(bCurChar) * nZoom)
{ // we're drawing on the bmp
point.y -= EDIT_OFFSET_Y;
point.x -= EDIT_OFFSET_X;
int x = point.x/nZoom;
int y = point.y/nZoom;
CurColor = pWorkspace[(nWorkspaceHeight-1-y) * nWorkspaceWidth + x];
memset(pCurColor,CurColor,SWIDTH * SWIDTH);
InvalidateRect(&rCurColor,FALSE);
return;
}
}
void CFonteditView::GetCurImage(void)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int nHeight = theFont->GetCharHeight(bCurChar);
int nWidth = theFont->GetCharWidth(bCurChar);
int nInternalWidth = nWidth;
if (nInternalWidth & 0x3)
nInternalWidth += 4 - (nInternalWidth&0x03);
if (!pWorkspace || nWorkspaceSize < nInternalWidth * nHeight)
{
if (pWorkspace)
{
free(pWorkspace);
}
nWorkspaceSize = nInternalWidth * nHeight;
pWorkspace = (BYTE *)malloc(nWorkspaceSize);
}
memset(pWorkspace,0,nWorkspaceSize);
nWorkspaceWidth = nInternalWidth;
nWorkspaceHeight = nHeight;
BYTE *pSource = theFont->GetCharMap(bCurChar);
for (int n=0; n<nHeight; n++)
{ // flip the image to display DIB
memcpy(pWorkspace + (nHeight-1-n)*nInternalWidth,pSource + (n*nWidth),nWidth);
}
delete pSource;
}
void CFonteditView::SetCurImage(void)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int nHeight = theFont->GetCharHeight(bCurChar);
int nWidth = theFont->GetCharWidth(bCurChar);
if (!pWorkspace)
return;
BYTE *pDest = new BYTE[nHeight * nWidth];
for (int n=0; n<nHeight; n++)
{ // flip the image to set back to font
memcpy(pDest + (n*nWidth),pWorkspace + (nHeight-1-n)*nWorkspaceWidth,nWidth);
}
theFont->SetCharMap(bCurChar,pDest);
delete pDest;
}
void CFonteditView::OnImageUndo()
{
if (!theFont)
return;
GetCurImage();
InvalidateRect(&rCurChar,FALSE);
InvalidateRect(&rCurSmallChar,FALSE);
}
void CFonteditView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CView::OnChar(nChar, nRepCnt, nFlags);
SetCurImage();
bCurChar = nChar;
GetCurImage();
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnOptionsClubs()
{
nLanguage = 1;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnOptionsEnglish()
{
nLanguage = 0;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnOptionsForeign()
{
nLanguage = 2;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnImageChangeacwidths()
{
if (!theFont)
return;
ACWidths dlg;
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
dlg.nAWidth = theFont->GetCharAWidth(bCurChar);
dlg.nCWidth = theFont->GetCharCWidth(bCurChar);
if (dlg.DoModal() != IDOK)
return;
theFont->SetCharAWidth(bCurChar,dlg.nAWidth);
theFont->SetCharCWidth(bCurChar,dlg.nCWidth);
}
void CFonteditView::OnOptionsMac()
{
nLanguage = 3;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnOptionsAll()
{
nLanguage = 4;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_CHECKED);
}
void CFonteditView::OnGlobalchangeaandc()
{
if (!theFont)
return;
CDeltaSpace dlg;
if (dlg.DoModal()!= IDOK)
return;
CFonteditDoc* pDoc = GetDocument();
for (int n=0; n<256; n++)
{
int a = theFont->GetCharAWidth(n);
int c = theFont->GetCharCWidth(n);
theFont->SetCharAWidth(n,a + dlg.m_DeltaA);
theFont->SetCharCWidth(n,c + dlg.m_DeltaC);
}
}
void CFonteditView::OnViewProperties()
{
FontProperties dlg;
if (!theFont)
return;
dlg.DoModal();
}
void CFonteditView::OnOptionsAlphabeticcharactersonly()
{
if (nLanguage == 100)
{
nLanguage = 0;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALPHABETICCHARACTERSONLY,MF_BYCOMMAND|MF_UNCHECKED);
}
else
{
nLanguage = 100;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALPHABETICCHARACTERSONLY,MF_BYCOMMAND|MF_CHECKED);
}
}
@@ -0,0 +1,90 @@
// fontevw.h : interface of the CFonteditView class
//
/////////////////////////////////////////////////////////////////////////////
class CFonteditView : public CView
{
protected: // create from serialization only
CFonteditView();
DECLARE_DYNCREATE(CFonteditView)
BYTE bCurChar;
int nZoom;
HPALETTE hPal;
LOGPALETTE *lp;
BYTE *pWorkspace;
int nWorkspaceSize;
int nWorkspaceWidth;
int nWorkspaceHeight;
BitMapInfo bmi;
BYTE *pScale;
BYTE *pCurColor;
BYTE CurColor;
RECT rCurColor;
RECT rCurChar;
RECT rCurSmallChar;
BOOL bDownInColor;
BOOL bDownInDraw;
bool bForce256x256;
void GetCurImage(void);
void SetCurImage(void);
// Attributes
public:
CFonteditDoc* GetDocument();
void NewFont(void);
void UpdateFont(void);
BYTE CurrChar(void) {return bCurChar;}
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFonteditView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFonteditView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFonteditView)
afx_msg void OnImageNext();
afx_msg void OnImagePrev();
afx_msg void OnImageZoomin();
afx_msg void OnImageZoomout();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnImageUndo();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnOptionsClubs();
afx_msg void OnOptionsEnglish();
afx_msg void OnOptionsForeign();
afx_msg void OnImageChangeacwidths();
afx_msg void OnOptionsMac();
afx_msg void OnOptionsAll();
afx_msg void OnGlobalchangeaandc();
afx_msg void OnViewProperties();
afx_msg void OnOptionsAlphabeticcharactersonly();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in fontevw.cpp
inline CFonteditDoc* CFonteditView::GetDocument()
{ return (CFonteditDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,437 @@
// THIS CODE IS COPYRIGHT ACCESS SOFTWARE INC. ALL RIGHTS RESERVED
// THE ORIGINAL CODE IS BY PAUL JOHNSTON, MODIFIED BY MATT DAWSON 8/4/97
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <windef.h>
#include <winbase.h>
#include "lz.h"
ComDecEngine::ComDecEngine()
{
input_code_size=8;
bEncrypt = 0;
}
void ComDecEngine::ReInitLZW (void)
/* (Re)initialize LZW state; shared code for startup and Clear processing */
{
code_size = input_code_size+1;
limit_code = clear_code << 1; /* 2^code_size */
max_code = clear_code + 2; /* first unused code value */
sp = symbol_stack; /* init stack to empty */
}
void ComDecEngine::InitLZWCode (void)
/* Initialize for a series of LZWReadByte (and hence GetCode) calls */
{
/* GetCode initialization */
last_byte = 2; /* make safe to "recopy last two bytes" */
last_bit = 0; /* nothing in the buffer */
cur_bit = 0; /* force buffer load on first call */
out_of_blocks = FALSE;
/* LZWReadByte initialization */
clear_code = 1 << input_code_size; /* compute special code values */
end_code = clear_code + 1; /* note that these do not change */
first_time = TRUE;
ReInitLZW();
}
int ComDecEngine::GetDataBlock(void)
{
int i,count;
count=min(SrcLeft,READ_MAX);
//if (InputType)
//{
// Buffer=SrcPtr-2;
// SrcPtr+=count;
//}
//else
count=_lread(hInFile,Buffer+2,count);
SrcLeft-=count;
if (bEncrypt)
{
//do unencryption
for (i=0; i<count; i++)
Buffer[i+2]^=5;
}
return count;
}
int ComDecEngine::GetCode (void)
/* Fetch the next code_size bits from the GIF data */
/* We assume code_size is less than 16 */
{
register int accum;
int offs, ret, count;
if ( (cur_bit+code_size) > last_bit)
{
/* Time to reload the buffer */
/* preserve last two bytes of what we have -- assume code_size <= 16 */
if (!InputType)
{
Buffer[0] = Buffer[last_byte-2];
Buffer[1] = Buffer[last_byte-1];
}
/* Load more bytes; set flag if we reach the terminator block */
count = GetDataBlock();
/* Reset counters */
cur_bit = (cur_bit - last_bit) + 16;
last_byte = 2 + count;
last_bit = last_byte * 8;
}
/* Form up next 24 bits in accum */
offs = cur_bit >> 3; /* byte containing cur_bit */
accum = Buffer[offs+2] & 0xFF;
accum <<= 8;
accum |= Buffer[offs+1] & 0xFF;
accum <<= 8;
accum |= Buffer[offs] & 0xFF;
/* Right-align cur_bit in accum, then mask off desired number of bits */
accum >>= (cur_bit & 7);
ret = ((int) accum) & ((1 << code_size) - 1);
cur_bit += code_size;
return ret;
}
int ComDecEngine::LZWReadByte (void)
/* Read an LZW-compressed byte */
{
int code; /* current working code */
int incode; /* saves actual input code */
/* First time, just eat the expected Clear code(s) and return next code, */
/* which is assumed to be a raw byte. */
if (first_time) {
first_time = FALSE;
do {
code = GetCode();
} while (code == clear_code);
firstcode = oldcode = code; /* make firstcode, oldcode valid! */
return code;
}
/* If any codes are stacked from a previously read symbol, return them */
if (sp > symbol_stack)
return (int) *(--sp);
code = GetCode();
if (code == clear_code) {
/* Reinit static state, swallow any extra Clear codes, and return */
ReInitLZW();
do {
code = GetCode();
} while (code == clear_code);
firstcode = oldcode = code; /* gotta reinit these too */
return code;
}
if (code == end_code)
return -1;
/* Normal raw byte or LZW symbol */
incode = code; /* save for a moment */
if (code >= max_code) { /* special case for not-yet-defined symbol */
*sp++ = (UINT8) firstcode; /* it will be defined as oldcode/firstcode */
code = oldcode;
}
/* If it's a symbol, expand it into the stack */
while (code >= clear_code) {
*sp++ = symbol_tail[code]; /* tail of symbol: a simple byte value */
code = symbol_head[code]; /* head of symbol: another LZW symbol */
}
/* At this point code just represents a raw byte */
firstcode = code; /* save for possible future use */
/* If there's room in table, */
if ((code = max_code) < LZW_TABLE_SIZE) {
/* Define a new symbol = prev sym + head of this sym's expansion */
symbol_head[code] = oldcode;
symbol_tail[code] = (UINT8) firstcode;
max_code++;
/* Is it time to increase code_size? */
if ((max_code >= limit_code) && (code_size < MAX_LZW_BITS)) {
code_size++;
limit_code <<= 1; /* keep equal to 2^code_size */
}
}
oldcode = incode; /* save last input symbol for future use */
return firstcode; /* return first byte of symbol's expansion */
}
int ComDecEngine::DecompressLZW(HFILE hSrcFile,DWORD dwCompressedSize,BYTE* OutputBuffer)
{
int nextbyte;
hInFile = hSrcFile; //input_file=SrcHandle;
SrcLeft = dwCompressedSize;//(int)GetFileSize((void *)hInFile,NULL);
InputType=0;//SrcType;
DestPtr=OutputBuffer;
symbol_head=(UINT16 *)hash_prefix;
symbol_tail=(UINT8 *)hash_suffix;
InitLZWCode();
do {
nextbyte=LZWReadByte();
if (nextbyte>=0)
*DestPtr++=nextbyte;
} while (nextbyte!=-1);
return DestPtr-OutputBuffer;
}
/******************************/
/* this is the LZW write code */
/******************************/
void ComDecEngine::flush_packet (void)
/* flush any accumulated data */
{
if (bytesinpkt > 0) { /* never write zero-length packet */
//packetbuf[0] = (char) bytesinpkt++;
if (_lwrite(hOutFile,packetbuf, bytesinpkt)
!= (size_t) bytesinpkt) {
printf("Output file write error");
exit(1);
}
bytesinpkt = 0;
}
}
/* Add a character to current packet; flush to disk if necessary */
#define CHAR_OUT(c) \
{ packetbuf[bytesinpkt++] = (char) (c); \
if (bytesinpkt >= 255) \
flush_packet(); \
}
#define ENCR_CHAR_OUT(c) \
{ packetbuf[bytesinpkt++] = (char) ((c)^5); \
if (bytesinpkt >= 255) \
flush_packet(); \
}
/* Routine to convert variable-width codes into a byte stream */
void ComDecEngine::output (short code)
/* Emit a code of n_bits bits */
/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */
{
cur_accum |= ((int) code) << cur_bits;
cur_bits += n_bits;
if (bEncrypt)
{
while (cur_bits >= 8) {
ENCR_CHAR_OUT(cur_accum & 0xFF);
cur_accum >>= 8;
cur_bits -= 8;
}
}
else
{
while (cur_bits >= 8) {
CHAR_OUT(cur_accum & 0xFF);
cur_accum >>= 8;
cur_bits -= 8;
}
}
/*
* If the next entry is going to be too big for the code size,
* then increase it, if possible. We do this here to ensure
* that it's done in sync with the decoder's codesize increases.
*/
if (free_code > maxcode) {
n_bits++;
if (n_bits == MAX_LZW_BITS)
maxcode = LZW_TABLE_SIZE; /* free_code will never exceed this */
else
maxcode = MAXCODE(n_bits);
}
}
/* The LZW algorithm proper */
void ComDecEngine::clear_hash (void)
/* Fill the hash table with empty entries */
{
/* It's sufficient to zero hash_code[] */
memset((void *) hash_code, 0, HSIZE * sizeof(short));
}
void ComDecEngine::clear_block (void)
/* Reset compressor and issue a Clear code */
{
clear_hash(); /* delete all the symbols */
free_code = ClearCode + 2;
output(ClearCode); /* inform decoder */
n_bits = init_bits; /* reset code size */
maxcode = MAXCODE(n_bits);
}
void ComDecEngine::compress_init (short i_bits)
/* Initialize LZW compressor */
{
/* init all the static variables */
n_bits = init_bits = i_bits;
maxcode = MAXCODE(n_bits);
ClearCode = ((int) 1 << (init_bits - 1));
EOFCode = ClearCode + 1;
free_code = ClearCode + 2;
first_byte = 1; /* no waiting symbol yet */
/* init output buffering vars */
bytesinpkt = 0;
cur_accum = 0;
cur_bits = 0;
/* clear hash table */
clear_hash();
/* GIF specifies an initial Clear code */
output(ClearCode);
}
void ComDecEngine::compress_byte (short c)
/* Accept and compress one 8-bit byte */
{
register short i;
register short disp;
if (first_byte) { /* need to initialize waiting_code */
waiting_code = c;
first_byte = 0;
return;
}
/* Probe hash table to see if a symbol exists for
* waiting_code followed by c.
* If so, replace waiting_code by that symbol and return.
*/
i = ((short) c << (MAX_LZW_BITS-8)) + waiting_code;
/* i is less than twice 2**MAX_LZW_BITS, therefore less than twice HSIZE */
if (i >= LZW_TABLE_SIZE)
i -= LZW_TABLE_SIZE;
if (hash_code[i] != 0)
{ /* is first probed slot empty? */
if (hash_prefix[i] == waiting_code && hash_suffix[i] == (UINT8) c)
{
waiting_code = hash_code[i];
return;
}
if (i == 0) /* secondary hash (after G. Knott) */
disp = 1;
else
disp = HSIZE - i;
while (1)
{
i -= disp;
if (i < 0)
i += HSIZE;
if (hash_code[i] == 0)
break; /* hit empty slot */
if (hash_prefix[i] == waiting_code && hash_suffix[i] == (UINT8) c)
{
waiting_code = hash_code[i];
return;
}
}
}
/* here when hashtable[i] is an empty slot; desired symbol not in table */
output(waiting_code);
if (free_code < LZW_TABLE_SIZE) {
hash_code[i] = free_code++; /* add symbol to hashtable */
hash_prefix[i] = waiting_code;
hash_suffix[i] = (UINT8) c;
} else
clear_block();
waiting_code = c;
}
void ComDecEngine::compress_term (void)
/* Clean up at end */
{
/* Flush out the buffered code */
if (! first_byte)
output(waiting_code);
/* Send an EOF code */
output(EOFCode);
/* Flush the bit-packing buffer */
if (bEncrypt)
{
if (cur_bits > 0) {
ENCR_CHAR_OUT(cur_accum & 0xFF);
}
}
else
{
if (cur_bits > 0) {
CHAR_OUT(cur_accum & 0xFF);
}
}
/* Flush the packet buffer */
flush_packet();
}
#define MAX_DATA 4096
BOOL ComDecEngine::CompressFile(BYTE *pData,DWORD dwSize, HFILE hOut)
{
DWORD dwPos = 0;
hOutFile = hOut;
compress_init(9);
while (dwPos < dwSize)
{
compress_byte(pData[dwPos]);
dwPos++;
}
compress_term();
return TRUE;
}
@@ -0,0 +1,131 @@
#ifndef engine_h
#define engine_h
#define MAX_LZW_BITS 13 /* maximum LZW code size (8192 symbols) */
#define LZW_TABLE_SIZE ((int) 1 << MAX_LZW_BITS)
#define HSIZE 10009 /* hash table size for 80% occupancy THIS MUST BE PRIME*/
#define MAXCODE(n_bits) (((int) 1 << (n_bits)) - 1)
/* Macros for extracting header data --- note we assume chars may be signed */
#define UINT8 unsigned char
typedef unsigned char byte;
#define UINT16 unsigned short
#define READ_MAX 8192
class ComDecEngine
{
private:
/* vars used by both comrpession and decression */
BOOL bEncrypt;
/* FOR DECOMPRESSION */
HFILE hInFile;
BYTE *SrcPtr;
int SrcLeft;
int InputType;
unsigned char Buffer[READ_MAX+2];
unsigned char *DestPtr;
int last_byte; /* # of bytes in code_buf */
int last_bit; /* # of bits in code_buf */
int cur_bit; /* next bit index to read */
int out_of_blocks; /* TRUE if hit terminator data block */
int input_code_size; /* codesize given in GIF file */
int clear_code,end_code; /* values for Clear and End codes */
int code_size; /* current actual code size */
int limit_code; /* 2^code_size */
int max_code; /* first unused code value */
int first_time; /* flags first call to LZWReadByte */
int oldcode; /* previous LZW symbol */
int firstcode; /* first byte of oldcode's expansion */
UINT16 *symbol_head; /* => table of prefix symbols */
UINT8 *symbol_tail; /* => table of suffix bytes */
UINT8 symbol_stack[8192]; /* stack for symbol expansions */
UINT8 *sp; /* stack pointer */
/* FOR COMPRESSION */
HFILE hOutFile;
short n_bits; /* current number of bits/code */
short maxcode; /* maximum code, given n_bits */
short init_bits; /* initial n_bits ... restored after clear */
short ClearCode; /* clear code (doesn't change) */
short EOFCode; /* EOF code (ditto) */
short free_code; /* first not-yet-used symbol code */
short hash_code[HSIZE]; /* => hash table of symbol codes */
short hash_prefix[HSIZE]; /* => hash table of prefix symbols */
UINT8 hash_suffix[HSIZE]; /* => hash table of suffix bytes */
short bytesinpkt; /* # of bytes in current packet */
char packetbuf[256]; /* workspace for accumulating packet */
int cur_accum; /* holds bits not yet output */
short cur_bits; /* # of bits in cur_accum */
short waiting_code; /* symbol not yet output; may be extendable */
int first_byte; /* if TRUE, waiting_code is not valid */
/* internal methods for decompression */
void ReInitLZW(void);
void InitLZWCode(void);
int GetDataBlock(void);
int GetCode(void);
int LZWReadByte(void);
/* internal methods for compression */
void flush_packet(void);
void output(short code);
void clear_hash(void);
void clear_block(void);
void compress_init(short i_bits);
void compress_byte(short c);
void compress_term(void);
public:
ComDecEngine();
DecompressLZW(HFILE hSrcFile,DWORD dwCompressedSize,BYTE *OutputBuffer);
BOOL CompressFile(BYTE *pData,DWORD dwSize, HFILE hOut);
void SetEncrypt(BOOL bEncrypt) {this->bEncrypt = bEncrypt;}
};
/* LZW decompression tables:
* symbol_head[K] = prefix symbol of any LZW symbol K (0..LZW_TABLE_SIZE-1)
* symbol_tail[K] = suffix byte of any LZW symbol K (0..LZW_TABLE_SIZE-1)
* Note that entries 0..end_code of the above tables are not used,
* since those symbols represent raw bytes or special codes.
*
* The stack represents the not-yet-used expansion of the last LZW symbol.
* In the worst case, a symbol could expand to as many bytes as there are
* LZW symbols, so we allocate LZW_TABLE_SIZE bytes for the stack.
* (This is conservative since that number includes the raw-byte symbols.)
*/
/* COMPRESSION info
* The LZW hash table consists of three parallel arrays:
* hash_code[i] code of symbol in slot i, or 0 if empty slot
* hash_prefix[i] symbol's prefix code; undefined if empty slot
* hash_suffix[i] symbol's suffix character; undefined if empty slot
* where slot values (i) range from 0 to HSIZE-1.
*
* Algorithm: use open addressing double hashing (no chaining) on the
* prefix code / suffix character combination. We do a variant of Knuth's
* algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
* secondary probe.
*
* The hash tables are allocated from heap space since they would use up
* rather a lot of the near data space in a PC.
*/
#endif
@@ -0,0 +1,322 @@
#define DEF_CHAR 128
Char cmap_mac[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
1,'@',0,0,0, // 017
1,'@',0,0,0, // 018
1,'@',0,0,0, // 019
1,'@',0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
1,'Ä'',0,0,0, // 128 €
1,'Ä'',0,0,0, // 129
1,'Ç'',0,0,0, // 130
1,'É'',0,0,0, // 131 ƒ
1,'Ñ'',0,0,0, // 132 „
1,'Ö'',0,0,0, // 133 …
1,'Ü'',0,0,0, // 134 †
1,'á'',0,0,0, // 135 ‡
1,'à'',0,0,0, // 136 ˆ
1,'â'',0,0,0, // 137 ‰
1,'ä'',0,0,0, // 138 Š
1,'ã'',0,0,0, // 139
1,'å'',0,0,0, // 140 Œ
1,'ç'',0,0,0, // 141
1,'é'',0,0,0, // 142 Ž
1,'è'',0,0,0, // 143
1,'ê'',0,0,0, // 144
1,'ë'',0,0,0, // 145
1,'í'',0,0,0, // 146
1,'ì'',0,0,0, // 147 “
1,'î'',0,0,0, // 148 ”
1,'ï'',0,0,0, // 149 •
1,'ñ'',0,0,0, // 150
1,'ó'',0,0,0, // 151 —
1,'ò'',0,0,0, // 152 ˜
1,'ô'',0,0,0, // 153 ™
1,'ö'',0,0,0, // 154 š
1,'õ'',0,0,0, // 155
1,'ú'',0,0,0, // 156 œ
1,'ù'',0,0,0, // 157
1,'û'',0,0,0, // 158 ž
1,'ü'',0,0,0, // 159 Ÿ
1,''',0,0,0, // 160  
1,'º'',0,0,0, // 161 ¡
1,'¢'',0,0,0, // 162 ¢
1,'£'',0,0,0, // 163 £
1,'§'',0,0,0, // 164 ¤
1,'©'',0,0,0, // 165 ¥
1,''',0,0,0, // 166 ¦
1,'ß'',0,0,0, // 167 §
1,'®'',0,0,0, // 168 ¨
1,'©'',0,0,0, // 169 ©
1,''',0,0,0, // 170 ª
1,'´'',0,0,0, // 171 «
1,'¨'',0,0,0, // 172 ¬
1,'=',0,0,0, // 173 ­
1,'Æ'',0,0,0, // 174 ®
1,'Ø'',0,0,0, // 175 ¯
1,''',0,0,0, // 176 °
1,'±'',0,0,0, // 177 ±
1,'«'',0,0,0, // 178 ²
1,'»'',0,0,0, // 179 ³
1,'¥'',0,0,0, // 180 ´
1,'µ'',0,0,0, // 181 µ
1,'ð'',0,0,0, // 182 ¶
1,'E',0,0,0, // 183 ·
1,'P',0,0,0, // 184 ¸
1,'p',0,0,0, // 185 ¹
1,'ƒ'',0,0,0, // 186 º
1,'a',0,0,0, // 187 »
1,'o',0,0,0, // 188 ¼
1,'O',0,0,0, // 189 ½
1,'æ'',0,0,0, // 190 ¾
1,'ø'',0,0,0, // 191 µ
1,'¿'',0,0,0, // 192 À
1,'¡'',0,0,0, // 193 Á
1,'¬'',0,0,0, // 194 Â
1,'Œ'',0,0,0, // 195 Ã
1,'ƒ'',0,0,0, // 196 Ä
1,'=',0,0,0, // 197 Å
1,'D',0,0,0, // 198 Æ
1,'«'',0,0,0, // 199 Ç
1,'»'',0,0,0, // 200 È
1,''',0,0,0, // 201 É
1,' ',0,0,0, // 202 Ê
1,'À'',0,0,0, // 203 Ë
1,'Ã'',0,0,0, // 204 Ì
1,'Õ'',0,0,0, // 205 Í
1,'Œ'',0,0,0, // 206 Î
1,'œ'',0,0,0, // 207 Ï
1,''',0,0,0, // 208 Ð
1,''',0,0,0, // 209 Ñ
1,''',0,0,0, // 210 Ò
1,''',0,0,0, // 211 Ó
1,''',0,0,0, // 212 Ô
1,''',0,0,0, // 213 Õ
1,'÷'',0,0,0, // 214 Ö
1,'¤'',0,0,0, // 215 ×
1,'ÿ',0,0,0, // 216 Ø
0,0,0,0,0, // 217 Ù
0,0,0,0,0, // 218 Ú
0,0,0,0,0, // 219 Û
0,0,0,0,0, // 220 Ü
0,0,0,0,0, // 221 Ý
0,0,0,0,0, // 222 Þ
0,0,0,0,0, // 223 ß
0,0,0,0,0, // 224 à
0,0,0,0,0, // 225 á
0,0,0,0,0, // 226 â
0,0,0,0,0, // 227 ã
0,0,0,0,0, // 228 ä
0,0,0,0,0, // 229 å
0,0,0,0,0, // 230 æ
0,0,0,0,0, // 231 ç
0,0,0,0,0, // 232 è
0,0,0,0,0, // 233 é
0,0,0,0,0, // 234 ê
0,0,0,0,0, // 235 ë
0,0,0,0,0, // 236 ì
0,0,0,0,0, // 237 í
0,0,0,0,0, // 238 î
0,0,0,0,0, // 239 ï
0,0,0,0,0, // 240 ð
0,0,0,0,0, // 241 ñ
0,0,0,0,0, // 242 ò
0,0,0,0,0, // 243 ó
0,0,0,0,0, // 244 ô
0,0,0,0,0, // 245 õ
0,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
0,0,0,0,0, // 248 ø
0,0,0,0,0, // 249 ù
0,0,0,0,0, // 250 ú
0,0,0,0,0, // 251 û
0,0,0,0,0, // 252 ü
0,0,0,0,0, // 253 ý
0,0,0,0,0, // 254 þ
0,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,62 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Fontedit.RC
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDD_ACWIDTH 130
#define IDD_DELTASPACE 131
#define IDD_FONTPROPERTIES 132
#define IDD_EXPORT 133
#define IDD_CHOOSEDIR 135
#define IDC_AWIDTH 1000
#define IDC_CWIDTH 1001
#define IDC_DELTA_A 1001
#define IDC_DIRLIST 1001
#define IDC_DELTA_C 1002
#define IDC_FONTNAME 1002
#define IDC_DIRPATH 1002
#define IDC_FONTSIZE 1003
#define IDC_DRIVES 1003
#define IDC_FILETAG 1003
#define IDC_FONTBOLD 1004
#define IDC_FILELIST 1004
#define IDC_OUPUTDIR 1004
#define IDC_FONTITALIC 1005
#define IDC_BROWSE 1005
#define ID_IMAGE_NEXT 32771
#define ID_IMAGE_PREV 32772
#define ID_IMAGE_ZOOMIN 32773
#define ID_IMAGE_ZOOMOUT 32774
#define ID_IMAGE_UNDO 32775
#define ID_IMAGE_SHORTEN 32776
#define ID_OPTIONS_ENGLISH 32777
#define ID_OPTIONS_CLUBS 32778
#define ID_OPTIONS_FOREIGN 32779
#define ID_IMAGE_CHANGEACWIDTHS 32780
#define ID_OPTIONS_MAC 32781
#define ID_OPTIONS_ALL 32782
#define IDM_GLOBALCHANGEAANDC 32783
#define IDM_SAVEFORD3D 32784
#define IDM_VIEW_PROPERTIES 32785
#define ID_FILE_NEWNONANTIALIASED 32786
#define ID_FILE_IMPORTTEXTURESFROMTGAS 32788
#define ID_OPTIONS_FORCE256X256TEXTURES 32789
#define ID_OPTIONS_MINIMIZETEXTURECOUNT 32790
#define ID_OPTIONS_MINIMIZETEXTURESPACE 32791
#define ID_FILE_EXPORTTEXTURES 32792
#define ID_FILE_IMPORTTEXTURES 32793
#define ID_OPTIONS_ALPHABETICCHARACTERSONLY 32794
#define ID_IMAGE_SHORTENFROMBOTTOM 32795
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 32796
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
@@ -0,0 +1,48 @@
//===========================================================================//
// File: targa.h //
// Project: Window Library //
// Contents: Code to make basic button workd //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#ifndef TARGA_H
#define TARGA_H
#define TGA_SIZE 18
typedef struct tgaheader { /* Offset Meaning */
BYTE IdSize; /* 0 id field size at end of header */
BYTE ColMapType; /* 1 0=>no color map, 1=>color map */
BYTE TypeCode; /* 2 1=>type 1, 2=>type 2 images,... */
WORD ColMapOrigin; /* 3 index of first color map entry */
WORD ColMapLength; /* 5 number of entries in color map */
BYTE ColMapBits; /* 7 number of bits/color map entry */
WORD XOrigin; /* 8 lower left corner of image */
WORD YOrigin; /* 10 lower left corner of image */
WORD Width; /* 12 width of image in pixels */
WORD Height; /* 14 height of image in pixels */
BYTE BitsPerPixel; /* 16 see note 1: below */
BYTE Descriptor; /* 17 see note 2: below */
/* */
/* Note 1: The "BitsPerPixel" field depends of the type of */
/* Targa file. For Targa type 1 images, it is the */
/* number of bits per pixel index. For a true- */
/* color Targa image this is 24, since pixels need */
/* 1 byte each for r, g, and b. */
/* Note 2: Individual bits have meaning here. For example, */
/* toggling bit 5 flips the image upside down. */
} TGAHeader;
#define TGA_FILE 1 //Display from a file
#define TGA_RESOURCE 2 //Display from resource ID
#define TGA_MATTE 4 //Don't show black (0,0,0) areas
#define TGA_OPAQUE 8 //Show completely
#define TGA_LZ 16 //Comes from graphics.lz
class FileType;
extern FileType *gLZGraphics;
//Modes for displaying
#endif
@@ -0,0 +1,386 @@
//
//
// Create a DSW and DSP file with correct compiler settings for a GameOS based products
//
//
//
//
//
#include <windows.h>
#include <commdlg.h>
#include "resource.h"
//
//
HINSTANCE hInst;
POINT DialogScreenPosition;
RECT DialogRect;
char ProjectName[MAX_PATH];
char Buffer[64*1024];
char Name[MAX_PATH];
//
//
// Empty DSW file project name replaced with ~ character
//
//
char DSWString[]=
"Microsoft Developer Studio Workspace File, Format Version 6.00\r\n"\
"# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\r\n"\
"\r\n"\
"###############################################################################\r\n"\
"\r\n"\
"Project: \"~\"=\".\\~.dsp\" - Package Owner=<4>\r\n"\
"\r\n"\
"Package=<5>\r\n"\
"{{{\r\n"\
"}}}\r\n"\
"\r\n"\
"Package=<4>\r\n"\
"{{{\r\n"\
"}}}\r\n"\
"\r\n"\
"###############################################################################\r\n"\
"\r\n"\
"Global:\r\n"\
"\r\n"\
"Package=<5>\r\n"\
"{{{\r\n"\
"}}}\r\n"\
"\r\n"\
"Package=<3>\r\n"\
"{{{\r\n"\
"}}}\r\n"\
"\r\n"\
"###############################################################################\r\n"\
"\r\n";
//
// Empty DSP file - project name replaced with ~ character
//
char DSPString[]=
"# Microsoft Developer Studio Project File - Name=\"~\" - Package Owner=<4>\r\n"\
"# Microsoft Developer Studio Generated Build File, Format Version 6.00\r\n"\
"# ** DO NOT EDIT **\r\n"\
"\r\n"\
"# TARGTYPE \"Win32 (x86) Application\" 0x0101\r\n"\
"\r\n"\
"CFG=~ - Win32 Debug\r\n"\
"!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r\n"\
"!MESSAGE use the Export Makefile command and run\r\n"\
"!MESSAGE \r\n"\
"!MESSAGE NMAKE /f \"~.mak\".\r\n"\
"!MESSAGE \r\n"\
"!MESSAGE You can specify a configuration when running NMAKE\r\n"\
"!MESSAGE by defining the macro CFG on the command line. For example:\r\n"\
"!MESSAGE \r\n"\
"!MESSAGE NMAKE /f \"~.mak\" CFG=\"~ - Win32 Debug\"\r\n"\
"!MESSAGE \r\n"\
"!MESSAGE Possible choices for configuration are:\r\n"\
"!MESSAGE \r\n"\
"!MESSAGE \"~ - Win32 Release\" (based on \"Win32 (x86) Application\")\r\n"\
"!MESSAGE \"~ - Win32 Profile\" (based on \"Win32 (x86) Application\")\r\n"\
"!MESSAGE \"~ - Win32 Armor\" (based on \"Win32 (x86) Application\")\r\n"\
"!MESSAGE \"~ - Win32 Debug\" (based on \"Win32 (x86) Application\")\r\n"\
"!MESSAGE \r\n"\
"\r\n"\
"# Begin Project\r\n"\
"# PROP Scc_ProjName \"\"\r\n"\
"# PROP Scc_LocalPath \"\"\r\n"\
"CPP=cl.exe\r\n"\
"MTL=midl.exe\r\n"\
"RSC=rc.exe\r\n"\
"\r\n"\
"!IF \"$(CFG)\" == \"~ - Win32 Release\"\r\n"\
"\r\n"\
"# PROP BASE Use_MFC 0\r\n"\
"# PROP BASE Use_Debug_Libraries 0\r\n"\
"# PROP BASE Output_Dir \"Release\"\r\n"\
"# PROP BASE Intermediate_Dir \"Release\"\r\n"\
"# PROP BASE Target_Dir \"\"\r\n"\
"# PROP Use_MFC 0\r\n"\
"# PROP Use_Debug_Libraries 0\r\n"\
"# PROP Output_Dir \"Release\"\r\n"\
"# PROP Intermediate_Dir \"Release\"\r\n"\
"# PROP Ignore_Export_Lib 0\r\n"\
"# PROP Target_Dir \"\"\r\n"\
"# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\r\n"\
"# ADD CPP /nologo /G6 /Gz /Zp4 /W4 /GR /Zi /MD /Ox /Ot /Oa /Og /Oi /GF /Gy /I \"..\\..\\Libraries\" /I \"..\\..\\..\\CoreTech\\Libraries\" /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\r\n"\
"# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\r\n"\
"# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\r\n"\
"# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\r\n"\
"# ADD RSC /l 0x409 /d \"NDEBUG\"\r\n"\
"BSC32=bscmake.exe\r\n"\
"# ADD BASE BSC32 /nologo\r\n"\
"# ADD BSC32 /nologo\r\n"\
"LINK32=link.exe\r\n"\
"# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386\r\n"\
"# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /fixed:no\r\n"\
"# SUBTRACT LINK32 /pdb:none\r\n"\
"\r\n"\
"!ELSEIF \"$(CFG)\" == \"~ - Win32 Profile\"\r\n"\
"\r\n"\
"# PROP BASE Use_MFC 0\r\n"\
"# PROP BASE Use_Debug_Libraries 0\r\n"\
"# PROP BASE Output_Dir \"Profile\"\r\n"\
"# PROP BASE Intermediate_Dir \"Profile\"\r\n"\
"# PROP BASE Target_Dir \"\"\r\n"\
"# PROP Use_MFC 0\r\n"\
"# PROP Use_Debug_Libraries 0\r\n"\
"# PROP Output_Dir \"Profile\"\r\n"\
"# PROP Intermediate_Dir \"Profile\"\r\n"\
"# PROP Ignore_Export_Lib 0\r\n"\
"# PROP Target_Dir \"\"\r\n"\
"# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\r\n"\
"# ADD CPP /nologo /G6 /Gz /Zp4 /W4 /GR /Zi /MD /Ox /Ot /Oa /Og /Oi /GF /Gy /I \"..\\..\\Libraries\" /I \"..\\..\\..\\CoreTech\\Libraries\" /D \"LAB_ONLY\" /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /YX /FD /c\r\n"\
"# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\r\n"\
"# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o NUL /win32\r\n"\
"# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\r\n"\
"# ADD RSC /l 0x409 /d \"NDEBUG\"\r\n"\
"BSC32=bscmake.exe\r\n"\
"# ADD BASE BSC32 /nologo\r\n"\
"# ADD BSC32 /nologo\r\n"\
"LINK32=link.exe\r\n"\
"# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386\r\n"\
"# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /fixed:no\r\n"\
"# SUBTRACT LINK32 /pdb:none\r\n"\
"\r\n"\
"!ELSEIF \"$(CFG)\" == \"~ - Win32 Debug\"\r\n"\
"\r\n"\
"# PROP BASE Use_MFC 0\r\n"\
"# PROP BASE Use_Debug_Libraries 1\r\n"\
"# PROP BASE Output_Dir \"Debug\"\r\n"\
"# PROP BASE Intermediate_Dir \"Debug\"\r\n"\
"# PROP BASE Target_Dir \"\"\r\n"\
"# PROP Use_MFC 0\r\n"\
"# PROP Use_Debug_Libraries 1\r\n"\
"# PROP Output_Dir \"Debug\"\r\n"\
"# PROP Intermediate_Dir \"Debug\"\r\n"\
"# PROP Ignore_Export_Lib 0\r\n"\
"# PROP Target_Dir \"\"\r\n"\
"# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D \"WIN32\" /D \"_DEBUG\" /D \"_WINDOWS\" /YX /FD /c\r\n"\
"# ADD CPP /nologo /G6 /Gz /Zp4 /W4 /GR /Zi /Od /MDd /I \"..\\..\\Libraries\" /I \"..\\..\\..\\CoreTech\\Libraries\" /D \"WIN32\" /D \"_DEBUG\" /D \"NOMINMAX\" /D \"_ARMOR\" /D \"LAB_ONLY\" /D \"_WINDOWS\" /YX /FD /c\r\n"\
"# SUBTRACT CPP /Gf /Gy\r\n"\
"# ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\r\n"\
"# ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /o NUL /win32\r\n"\
"# ADD BASE RSC /l 0x409 /d \"_DEBUG\"\r\n"\
"# ADD RSC /l 0x409 /d \"_DEBUG\"\r\n"\
"BSC32=bscmake.exe\r\n"\
"# ADD BASE BSC32 /nologo\r\n"\
"# ADD BSC32 /nologo\r\n"\
"LINK32=link.exe\r\n"\
"# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept\r\n"\
"# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /fixed:no\r\n"\
"# SUBTRACT LINK32 /pdb:none\r\n"\
"\r\n"\
"!ELSEIF \"$(CFG)\" == \"~ - Win32 Armor\"\r\n"\
"\r\n"\
"# PROP BASE Use_MFC 0\r\n"\
"# PROP BASE Use_Debug_Libraries 0\r\n"\
"# PROP BASE Output_Dir \"Armor\"\r\n"\
"# PROP BASE Intermediate_Dir \"Armor\"\r\n"\
"# PROP BASE Ignore_Export_Lib 0\r\n"\
"# PROP BASE Target_Dir \"\"\r\n"\
"# PROP Use_MFC 0\r\n"\
"# PROP Use_Debug_Libraries 0\r\n"\
"# PROP Output_Dir \"Armor\"\r\n"\
"# PROP Intermediate_Dir \"Armor\"\r\n"\
"# PROP Ignore_Export_Lib 0\r\n"\
"# PROP Target_Dir \"\"\r\n"\
"# ADD BASE CPP /nologo /G6 /Zp4 /MD /W4 /GR /Zi /Ox /Ot /Oa /Og /Oi /Gy /I \"..\\..\\Libraries\" /I \"..\\..\\..\\CoreTech\\Libraries\" /D \"PROFILE\" /D \"WIN32\" /D \"NDEBUG\" /D \"_WINDOWS\" /D \"LAB_ONLY\" /YX /FD /GF /c\r\n"\
"# ADD CPP /nologo /G6 /Gz /Zp4 /MD /W4 /GR /Zi /Ox /Ot /Oa /Og /Oi /Gy /I \"..\\..\\Libraries\" /I \"..\\..\\..\\CoreTech\\Libraries\" /D \"NDEBUG\" /D \"LAB_ONLY\" /D \"_WINDOWS\" /D \"WIN32\" /D \"NOMINMAX\" /D \"_ARMOR\" /YX /FD /GF /c\r\n"\
"# ADD BASE MTL /nologo /D \"NDEBUG\" /mktyplib203 /o \"NUL\" /win32\r\n"\
"# ADD MTL /nologo /D \"NDEBUG\" /mktyplib203 /o \"NUL\" /win32\r\n"\
"# ADD BASE RSC /l 0x409 /d \"NDEBUG\"\r\n"\
"# ADD RSC /l 0x409 /d \"NDEBUG\"\r\n"\
"BSC32=bscmake.exe\r\n"\
"# ADD BASE BSC32 /nologo\r\n"\
"# ADD BSC32 /nologo\r\n"\
"LINK32=link.exe\r\n"\
"# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /fixed:no\r\n"\
"# SUBTRACT BASE LINK32 /pdb:none\r\n"\
"# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /fixed:no\r\n"\
"# SUBTRACT LINK32 /pdb:none\r\n"\
"\r\n"\
"!ENDIF \r\n"\
"\r\n"\
"# Begin Target\r\n"\
"\r\n"\
"# Name \"~ - Win32 Release\"\r\n"\
"# Name \"~ - Win32 Profile\"\r\n"\
"# Name \"~ - Win32 Armor\"\r\n"\
"# Name \"~ - Win32 Debug\"\r\n"\
"# Begin Source File\r\n"\
"\r\n"\
"SOURCE=\".\\~.cpp\"\r\n"\
"# End Source File\r\n"\
"# End Target\r\n"\
"# End Project\r\n"\
"\r\n";
//
// Decode the DSW or DSP file passed into Buffer and expand project name
//
DWORD Decode( char* Source )
{
char* Dest=Buffer;
DWORD Size=0;
while( *Source )
{
if( *Source=='~' )
{
strcpy( Dest, Name );
Dest+=strlen( Name );
}
else
*Dest++=*Source;
Source++;
}
return Dest-Buffer;
}
BOOL APIENTRY Dialog( HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
switch (message)
{
//
// Center dialog
//
case WM_INITDIALOG:
RECT ParentRect;
POINT DialogScreenPosition;
GetWindowRect(hDlg,&DialogRect);
GetClientRect(GetDesktopWindow(), &ParentRect);
DialogScreenPosition.x = (ParentRect.right-ParentRect.left)/2;
DialogScreenPosition.y = (ParentRect.bottom-ParentRect.top)/2;
DialogScreenPosition.x -= (DialogRect.right-DialogRect.left)/2;
DialogScreenPosition.y -= (DialogRect.bottom-DialogRect.top)/2;
MoveWindow(hDlg,DialogScreenPosition.x,DialogScreenPosition.y,DialogRect.right-DialogRect.left,DialogRect.bottom-DialogRect.top,1);
break;
//
// Close window - exit
//
case WM_CLOSE:
EndDialog( hDlg, 0 );
break;
case WM_COMMAND:
//
// Clicked on Ok - write out files
//
if(LOWORD(wParam) == ID_OK)
{
GetDlgItemText( hDlg,IDC_BUILDLOCATION, ProjectName, sizeof(ProjectName) );
//
// Make sure the Project name does not end in DSW
//
char NamePath[MAX_PATH];
if( 0==strnicmp( &ProjectName[strlen(ProjectName)-4],".dsw", 4) )
{
ProjectName[strlen(ProjectName)-4]=0;
}
strcpy( NamePath, ProjectName );
//
// Find just the name
//
DWORD t1=strlen(NamePath);
while( t1>0 && NamePath[t1-1]!='\\' )
t1--;
strcpy( Name, &NamePath[t1] );
//
// Write out DSW file
//
char DSWFile[MAX_PATH];
strcpy( DSWFile, NamePath );
strcat( DSWFile, ".dsw" );
HANDLE hFile = CreateFile( DSWFile, GENERIC_WRITE, 0,NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL );
if( hFile!=INVALID_HANDLE_VALUE )
{
DWORD temp=0;
WriteFile( hFile, Buffer, Decode( DSWString ), &temp, NULL );
CloseHandle( hFile );
}
//
// Write out DSP file
//
char DSPFile[MAX_PATH];
strcpy( DSPFile, NamePath );
strcat( DSPFile, ".dsp" );
hFile = CreateFile( DSPFile, GENERIC_WRITE, 0,NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL );
if( hFile!=INVALID_HANDLE_VALUE )
{
DWORD temp=0;
WriteFile( hFile, Buffer, Decode( DSPString ), &temp, NULL );
CloseHandle( hFile );
}
EndDialog(hDlg, 1);
return TRUE;
}
//
// Clicked on 'Browse' button
//
if(LOWORD(wParam) == IDC_BROWSE)
{
OPENFILENAME OpenFileName;
TCHAR szFile[MAX_PATH] = "";
OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hDlg;
OpenFileName.lpstrFilter = "Visual C Project (*.dsw)\0*.dsw\0\0";
OpenFileName.lpstrCustomFilter = NULL;
OpenFileName.nMaxCustFilter = 0;
OpenFileName.nFilterIndex = 1;
OpenFileName.lpstrFile = szFile;
OpenFileName.nMaxFile = sizeof(szFile);
OpenFileName.lpstrFileTitle = NULL;
OpenFileName.nMaxFileTitle = 0;
OpenFileName.lpstrInitialDir = NULL;
OpenFileName.lpstrTitle = "Location of project";
OpenFileName.nFileOffset = 0;
OpenFileName.nFileExtension = 0;
OpenFileName.lpstrDefExt = NULL;
OpenFileName.Flags = OFN_HIDEREADONLY | OFN_LONGNAMES;
if (GetOpenFileName(&OpenFileName))
{
strcpy( ProjectName, OpenFileName.lpstrFile );
SetDlgItemText ( hDlg,IDC_BUILDLOCATION, ProjectName );
}
}
break;
}
return FALSE;
}
//
//
// Main windows entry point - just displays one dialog.
//
//
//
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
hInst=hInstance;
DialogBox(hInst, MAKEINTRESOURCE(IDD_Dialog), NULL, (DLGPROC)Dialog);
return 0;
}
@@ -0,0 +1,103 @@
# Microsoft Developer Studio Project File - Name="GameOSWizard" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=GameOSWizard - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "GameOSWizard.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "GameOSWizard.mak" CFG="GameOSWizard - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "GameOSWizard - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "GameOSWizard - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "GameOSWizard - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "GameOSWizard - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "GameOSWizard - Win32 Release"
# Name "GameOSWizard - Win32 Debug"
# Begin Group "Resources"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\GameOSWizard.rc
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\GameOSWizard.cpp
# End Source File
# End Target
# End Project
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "GameOSWizard"=".\GameOSWizard.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,55 @@
//
//
//
//
//
//
//
//
//
//
#include <windows.h>
#include <commdlg.h>
#include "resource.h"
extern HINSTANCE hInst;
extern POINT DialogScreenPosition;
extern RECT DialogRect;
extern char BuildName[MAX_PATH];
extern char RootDirectory[MAX_PATH];
//
// Routines
//
BOOL APIENTRY InstancePage( HWND hDlg, UINT message, UINT wParam, LONG lParam);
BOOL APIENTRY VideoPage( HWND hDlg, UINT message, UINT wParam, LONG lParam);
BOOL APIENTRY DataPage( HWND hDlg, UINT message, UINT wParam, LONG lParam);
BOOL APIENTRY BuildPage( HWND hDlg, UINT message, UINT wParam, LONG lParam);
//
// File handling
//
typedef struct
{
char* Buffer; // Pointer to memory containing file
int Length; // Length of file
char* Section; // Offset to current section
char* Offset; // Offset to current line
} INIFILE;
INIFILE FileOpen( char* FileName );
void FileClose( INIFILE &File );
char* FindNext( INIFILE &File, char* Section, char* string );
bool FileExists( char* FileName );
@@ -0,0 +1,99 @@
//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
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_Dialog DIALOG DISCARDABLE 0, 0, 341, 58
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Create an empty GameOS project"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "Generate Visual C Project",ID_OK,121,32,99,14
EDITTEXT IDC_BUILDLOCATION,59,7,212,14,ES_AUTOHSCROLL
LTEXT "Directory\\name",IDC_STATIC,7,8,50,8
PUSHBUTTON "Browse",IDC_BROWSE,279,7,41,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_Dialog, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 336
TOPMARGIN, 7
BOTTOMMARGIN, 51
END
END
#endif // APSTUDIO_INVOKED
#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
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by TonyaTool.rc
//
#define IDD_Build 103
#define IDD_Dialog 103
#define IDC_BUILDLOCATION 1028
#define IDC_BROWSE 1031
#define ID_OK 1033
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1034
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
@@ -0,0 +1,251 @@
// ChooseDir.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "ChooseDir.h"
#include "direct.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChooseDir dialog
CChooseDir::CChooseDir(CWnd* pParent /*=NULL*/)
: CDialog(CChooseDir::IDD, pParent)
{
//{{AFX_DATA_INIT(CChooseDir)
m_Dir = _T("");
//}}AFX_DATA_INIT
szCurrDir[0] = 0;
szTitle[0] = 0;
}
void CChooseDir::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChooseDir)
DDX_Control(pDX, IDC_FILELIST, m_FileList);
DDX_Control(pDX, IDC_DRIVES, m_Drives);
DDX_Control(pDX, IDC_DIRPATH, m_DirPath);
DDX_Control(pDX, IDC_DIRLIST, m_DirList);
DDX_Text(pDX, IDC_DIRPATH, m_Dir);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChooseDir, CDialog)
//{{AFX_MSG_MAP(CChooseDir)
ON_LBN_DBLCLK(IDC_DIRLIST, OnDblclkDirlist)
ON_CBN_SELCHANGE(IDC_DRIVES, OnSelchangeDrives)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChooseDir message handlers
BOOL CChooseDir::OnInitDialog()
{
CDialog::OnInitDialog();
// fill drive list
if (szTitle[0])
SetWindowText(szTitle);
if (!szCurrDir[0]) // if no directory has been set then choose the current drive and directory
_getcwd(szCurrDir,sizeof(szCurrDir));
char szDrive[]="A:\\";
nCurrDrive = _getdrive()-1;
for (int nDrive=0; nDrive<26; nDrive++)
{
szDrive[0] = 'A' + nDrive;
char szDescription[260];
DWORD dwType = GetDriveType(szDrive);
sprintf(szDescription,"[%c:]",nDrive+'A');
switch(dwType)
{
case 0:
case 1:
continue; // invalid drives
case DRIVE_REMOVABLE:
strcat(szDescription," - removable");
break;
case DRIVE_FIXED:
case DRIVE_REMOTE:
{
char szName[260];
char szFileSystemName[260];
DWORD dwJunk;
GetVolumeInformation(szDrive,szName,sizeof(szName),&dwJunk,&dwJunk,&dwJunk,szFileSystemName,sizeof(szFileSystemName));
strcat(szDescription," - ");
strcat(szDescription,szName);
}
break;
break;
case DRIVE_CDROM:
strcat(szDescription," - CDROM");
break;
case DRIVE_RAMDISK:
strcat(szDescription," - RAMDISK");
break;
}
int nIndex = m_Drives.AddString(szDescription);
m_Drives.SetItemData(nIndex,nDrive);
if (nDrive == nCurrDrive)
m_Drives.SetCurSel(nIndex);
}
// fill in directory list
FillDirList();
m_Dir = szCurrDir;
m_DirPath.SetWindowText(szCurrDir);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CChooseDir::FillDirList()
{
WIN32_FIND_DATA find;
char szFind[260];
strcpy(szFind,szCurrDir);
int nLen = strlen(szFind);
if (szFind[nLen-1] != '\\')
strcat(szFind,"\\");
strcat(szFind,"*.*");
HANDLE hFind = FindFirstFile(szFind,&find);
BOOL bContinue=hFind!=INVALID_HANDLE_VALUE;
m_DirList.ResetContent();
m_FileList.ResetContent();
while (bContinue)
{
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (find.cFileName[0] == '.' && find.cFileName[1]==NULL)
; // don't show the single dot
else
m_DirList.AddString(find.cFileName);
}
else
{
m_FileList.AddString(find.cFileName);
}
bContinue = FindNextFile(hFind,&find);
}
FindClose(hFind);
}
void CChooseDir::OnDblclkDirlist()
{
int nItem = m_DirList.GetCurSel();
char szDirName[260];
m_DirList.GetText(nItem,szDirName);
if (szDirName[0] == '.')
{ // back up one directory
int nLastSlash = -1;
int nChar=0;
while (szCurrDir[nChar])
{
if (szCurrDir[nChar] == '\\')
nLastSlash = nChar;
nChar++;
}
if (nLastSlash >=0)
szCurrDir[nLastSlash] = 0;
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
}
else
{ // go into the next directory
int nLen = strlen(szCurrDir);
if (szCurrDir[nLen-1] != '\\')
strcat(szCurrDir,"\\");
strcat(szCurrDir,szDirName);
}
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
}
void CChooseDir::OnSelchangeDrives()
{
int nItem = m_Drives.GetCurSel();
int nDrive = m_Drives.GetItemData(nItem);
sprintf(szCurrDir,"%c:\\",nDrive+'A');
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
}
void CChooseDir::OnOK()
{
char szTemp[260];
m_DirPath.GetWindowText(szTemp,sizeof(szTemp));
if (!strcmp(szTemp,".."))
{ // back up one dir
int nLastSlash = -1;
int nChar=0;
while (szCurrDir[nChar])
{
if (szCurrDir[nChar] == '\\')
nLastSlash = nChar;
nChar++;
}
if (nLastSlash >=0)
szCurrDir[nLastSlash] = 0;
FillDirList();
m_DirPath.SetWindowText(szCurrDir);
return;
}
if (strcmp(szTemp,szCurrDir))
{ // the user has typed in the entry. try to set to the directory they typed
if (_chdir(szTemp)==0) // success
{
strcpy(szCurrDir,szTemp);
FillDirList();
return;
}
else
{
// do a little file name validation
if (!isalpha(szTemp[0]) || szTemp[1] != ':' || szTemp[2] != '\\')
{
m_DirPath.SetWindowText(szCurrDir);
return;
}
int nResult = MessageBox("The selected directory does not exist. Would you like to create it?","Question",MB_YESNO);
if (nResult == IDNO)
return;
else
{
int nChar=0;
int nSlashCount=-1;
strcpy(szCurrDir,szTemp);
while (szCurrDir[nChar])
{
if (szCurrDir[nChar] == '\\')
{
nSlashCount++;
if (nSlashCount > 0)
{
szCurrDir[nChar] = 0;
CreateDirectory(szCurrDir,NULL);
szCurrDir[nChar] = '\\';
}
}
nChar++;
}
CreateDirectory(szCurrDir,NULL);
}
}
}
CDialog::OnOK();
}
void CChooseDir::OnCancel()
{
CDialog::OnCancel();
}
@@ -0,0 +1,45 @@
// ChooseDir.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CChooseDir dialog
class CChooseDir : public CDialog
{
// Construction
public:
CChooseDir(CWnd* pParent = NULL); // standard constructor
char szCurrDir[260];
char szTitle[260];
// Dialog Data
//{{AFX_DATA(CChooseDir)
enum { IDD = IDD_CHOOSEDIR };
CListBox m_FileList;
CComboBox m_Drives;
CEdit m_DirPath;
CListBox m_DirList;
CString m_Dir;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChooseDir)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
void FillDirList();
int nCurrDrive;
// Generated message map functions
//{{AFX_MSG(CChooseDir)
virtual BOOL OnInitDialog();
afx_msg void OnDblclkDirlist();
afx_msg void OnSelchangeDrives();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@@ -0,0 +1,76 @@
// DeltaSpace.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "DeltaSpace.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDeltaSpace dialog
CDeltaSpace::CDeltaSpace(CWnd* pParent /*=NULL*/)
: CDialog(CDeltaSpace::IDD, pParent)
{
//{{AFX_DATA_INIT(CDeltaSpace)
m_A = _T("");
m_C = _T("");
//}}AFX_DATA_INIT
}
void CDeltaSpace::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDeltaSpace)
DDX_Text(pDX, IDC_DELTA_A, m_A);
DDX_Text(pDX, IDC_DELTA_C, m_C);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDeltaSpace, CDialog)
//{{AFX_MSG_MAP(CDeltaSpace)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDeltaSpace message handlers
BOOL CDeltaSpace::OnInitDialog()
{
m_DeltaA = 0;
m_DeltaC = 0;
m_A = "0";
m_C = "0";
UpdateData(FALSE);
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDeltaSpace::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
m_DeltaA = atoi(m_A);
m_DeltaC = atoi(m_C);
CDialog::OnOK();
}
void CDeltaSpace::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
@@ -0,0 +1,40 @@
// DeltaSpace.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CDeltaSpace dialog
class CDeltaSpace : public CDialog
{
// Construction
public:
CDeltaSpace(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDeltaSpace)
enum { IDD = IDD_DELTASPACE };
int m_DeltaA;
int m_DeltaC;
CString m_A;
CString m_C;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDeltaSpace)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDeltaSpace)
virtual BOOL OnInitDialog();
virtual void OnOK();
virtual void OnCancel();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
@@ -0,0 +1,448 @@
#define DEF_CHAR 128
Char cmap_english[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
0,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
0,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
1,0,0,0,0, // 145
0,0,0,0,0, // 146
1,0,0,0,0, // 147 “
1,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
0,0,0,0,0, // 154 š
0,0,0,0,0, // 155
0,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
0,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
1,0,0,0,0, // 161 ¡
1,0,0,0,0, // 162 ¢
1,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
0,0,0,0,0, // 165 ¥
1,0,0,0,0, // 166 ¦
0,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
1,0,0,0,0, // 169 ©
0,0,0,0,0, // 170 ª
0,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
1,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
1,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
0,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
0,0,0,0,0, // 186 º
0,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
0,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
0,0,0,0,0, // 191 µ
0,0,0,0,0, // 192 À
0,0,0,0,0, // 193 Á
0,0,0,0,0, // 194 Â
0,0,0,0,0, // 195 Ã
0,0,0,0,0, // 196 Ä
0,0,0,0,0, // 197 Å
0,0,0,0,0, // 198 Æ
0,0,0,0,0, // 199 Ç
0,0,0,0,0, // 200 È
0,0,0,0,0, // 201 É
0,0,0,0,0, // 202 Ê
0,0,0,0,0, // 203 Ë
0,0,0,0,0, // 204 Ì
0,0,0,0,0, // 205 Í
0,0,0,0,0, // 206 Î
0,0,0,0,0, // 207 Ï
0,0,0,0,0, // 208 Ð
0,0,0,0,0, // 209 Ñ
0,0,0,0,0, // 210 Ò
0,0,0,0,0, // 211 Ó
0,0,0,0,0, // 212 Ô
0,0,0,0,0, // 213 Õ
0,0,0,0,0, // 214 Ö
1,0,0,0,0, // 215 ×
0,0,0,0,0, // 216 Ø
0,0,0,0,0, // 217 Ù
0,0,0,0,0, // 218 Ú
0,0,0,0,0, // 219 Û
0,0,0,0,0, // 220 Ü
0,0,0,0,0, // 221 Ý
0,0,0,0,0, // 222 Þ
0,0,0,0,0, // 223 ß
0,0,0,0,0, // 224 à
0,0,0,0,0, // 225 á
0,0,0,0,0, // 226 â
0,0,0,0,0, // 227 ã
0,0,0,0,0, // 228 ä
0,0,0,0,0, // 229 å
0,0,0,0,0, // 230 æ
0,0,0,0,0, // 231 ç
0,0,0,0,0, // 232 è
0,0,0,0,0, // 233 é
0,0,0,0,0, // 234 ê
0,0,0,0,0, // 235 ë
0,0,0,0,0, // 236 ì
0,0,0,0,0, // 237 í
0,0,0,0,0, // 238 î
0,0,0,0,0, // 239 ï
0,0,0,0,0, // 240 ð
0,0,0,0,0, // 241 ñ
0,0,0,0,0, // 242 ò
0,0,0,0,0, // 243 ó
0,0,0,0,0, // 244 ô
0,0,0,0,0, // 245 õ
0,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
0,0,0,0,0, // 248 ø
0,0,0,0,0, // 249 ù
0,0,0,0,0, // 250 ú
0,0,0,0,0, // 251 û
0,0,0,0,0, // 252 ü
0,0,0,0,0, // 253 ý
0,0,0,0,0, // 254 þ
0,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,74 @@
// ExportTextures.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "ExportTextures.h"
#include "choosedir.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExportTextures dialog
CExportTextures::CExportTextures(CWnd* pParent /*=NULL*/)
: CDialog(CExportTextures::IDD, pParent)
{
//{{AFX_DATA_INIT(CExportTextures)
m_FileTag = _T("");
m_OutputDir = _T("");
//}}AFX_DATA_INIT
}
void CExportTextures::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExportTextures)
DDX_Text(pDX, IDC_FILETAG, m_FileTag);
DDX_Text(pDX, IDC_OUPUTDIR, m_OutputDir);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExportTextures, CDialog)
//{{AFX_MSG_MAP(CExportTextures)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExportTextures message handlers
void CExportTextures::OnOK()
{
UpdateData(true);
if (m_FileTag.GetLength() < 1)
{
MessageBox("You must enter a tag.","Hello!",MB_OK);
return;
}
if (m_OutputDir.GetLength() < 1)
{
MessageBox("You must enter a directory to write the exported files into.","Hello!",MB_OK);
return;
}
CDialog::OnOK();
}
void CExportTextures::OnCancel()
{
CDialog::OnCancel();
}
void CExportTextures::OnBrowse()
{
CChooseDir dlg;
dlg.DoModal();
}
@@ -0,0 +1,49 @@
#if !defined(AFX_EXPORTTEXTURES_H__BED90C97_31F1_472F_8511_78AC695DF83D__INCLUDED_)
#define AFX_EXPORTTEXTURES_H__BED90C97_31F1_472F_8511_78AC695DF83D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ExportTextures.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CExportTextures dialog
class CExportTextures : public CDialog
{
// Construction
public:
CExportTextures(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CExportTextures)
enum { IDD = IDD_EXPORT };
CString m_FileTag;
CString m_OutputDir;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CExportTextures)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CExportTextures)
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnBrowse();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EXPORTTEXTURES_H__BED90C97_31F1_472F_8511_78AC695DF83D__INCLUDED_)
@@ -0,0 +1,869 @@
#include "stdafx.h"
#include "globals.h"
#include "fontevw.h"
#include "english.h"
#include "alphaonly.h"
#include "mac.h"
#include "clubs.h"
#include "foreign.h"
#include "all.h"
#include "font.h"
#include "assert.h"
#include "targa.h"
static BOOL bBackOpaque=FALSE;
static BYTE frRed=0xFF,frGreen=0xFF,frBlue=0xFF;
static BYTE bkRed=0x00,bkGreen=0x00,bkBlue=0x00;
static BYTE *pfWorkspace=0;
static int wsWidth=0;
static int wsHeight=0;
BOOL DrawGrayscaleBmp(HDC hDC,int x,int y,int w,int h,BYTE *pPixels)
{
LPBITMAPINFO lplocalbmi=NULL;
BYTE *lplocalpixels=NULL;
lplocalbmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
lplocalpixels = new BYTE[w*h];
int nBmpWidth = w + ((w&0x3)?(4-(w&3)):0); // figure out 4 byte aligned width (make windows happy)
lplocalbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lplocalbmi->bmiHeader.biWidth = nBmpWidth;
lplocalbmi->bmiHeader.biHeight = -h;
lplocalbmi->bmiHeader.biPlanes = 1;
lplocalbmi->bmiHeader.biBitCount = 8;
lplocalbmi->bmiHeader.biCompression = BI_RGB;
lplocalbmi->bmiHeader.biSizeImage = 0;
lplocalbmi->bmiHeader.biClrUsed = 0;
lplocalbmi->bmiHeader.biClrImportant = 0;
BYTE *pOut = lplocalpixels;
BYTE *pIn = pPixels;
int n;
for (n=0; n<h; n++)
{
memcpy(pOut,pIn,w);
pOut += nBmpWidth;
pIn += w;
}
for (n=0; n<256; n++)
{
lplocalbmi->bmiColors[n].rgbRed = n;
lplocalbmi->bmiColors[n].rgbGreen = n;
lplocalbmi->bmiColors[n].rgbBlue = n;
}
int nResult = SetDIBitsToDevice(hDC,
x,y,
w,h,
0,0,
0,h,
lplocalpixels,
lplocalbmi,
DIB_RGB_COLORS);
delete lplocalbmi;
delete lplocalpixels;
return (nResult > 0);
}
BOOL Draw32BitBmp(HDC hDC,int x,int y,int w,int h,BYTE *pPixels)
{
LPBITMAPINFO lplocalbmi=NULL;
DWORD *lplocalpixels=NULL;
lplocalbmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO)];
lplocalpixels = new DWORD[(w+4)*h];
int nBmpWidth = w + ((w&0x3)?(4-(w&3)):0); // figure out 4 byte aligned width (make windows happy)
lplocalbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lplocalbmi->bmiHeader.biWidth = nBmpWidth;
lplocalbmi->bmiHeader.biHeight = h;
lplocalbmi->bmiHeader.biPlanes = 1;
lplocalbmi->bmiHeader.biBitCount = 32;
lplocalbmi->bmiHeader.biCompression = BI_RGB;
lplocalbmi->bmiHeader.biSizeImage = 0;
lplocalbmi->bmiHeader.biClrUsed = 0;
lplocalbmi->bmiHeader.biClrImportant = 0;
DWORD *pOut = lplocalpixels + w*(h-1);
DWORD *pIn = (DWORD *)pPixels;
int n;
for (n=0; n<h; n++)
{
memcpy(pOut,pIn,w*sizeof(DWORD));
pOut -= nBmpWidth;
pIn += w;
}
int nResult = SetDIBitsToDevice(hDC,
x,y,
w,h,
0,0,
0,h,
(BYTE *)lplocalpixels,
lplocalbmi,
DIB_RGB_COLORS);
delete lplocalbmi;
delete lplocalpixels;
return (nResult > 0);
}
Font::Font(char *szFaceName,int iHeight,bool bItalic,int iWeight,bool bAntiAlias,bool bMinimizeTextureCount)
{ // convert a TT font to our anti-aliased format
this->bMinimizeTextureCount = bMinimizeTextureCount;
b32Bit = false;
strcpy(header.szFaceName,szFaceName);
header.iWeight = iWeight;
header.bItalic = bItalic;
header.iSize = iHeight;
memset(data,0,sizeof(data));
Char *cmap_char;
int n;
CFont font;
CDC dc;
CSize sz;
BYTE *pPixels;
char szChar[2] = " ";
CBitmap bmp;
TEXTMETRIC tm;
ABC abc;
if (nLanguage == 100)
cmap_char = cmap_alphaonly;
else
cmap_char = cmap_foreign;
CDC *pDC = view->GetDC();
dc.CreateCompatibleDC(pDC);
view->ReleaseDC(pDC);
dc.SetTextColor(0xFFFFFF);
dc.SetBkColor(0);
int iSize = iHeight;
if (bAntiAlias)
iSize *= 8;
font.CreateFont(iSize,
0,
0,
0,
iWeight,
bItalic,
0,
0,
DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,DEFAULT_PITCH|FF_DONTCARE,
szFaceName);
CFont *oldfont = dc.SelectObject(&font);
CBitmap *oldbmp;
dc.GetTextMetrics(&tm);
for (n=0; n<256; n++)
{
if (cmap_char[n].nOffset) // add char if it's listed in this array as one to include
{
int a,c;
szChar[0] = (char)n;
// figure out how wide the character is
sz = dc.GetTextExtent(szChar,1);
GetCharABCWidths(dc.m_hDC,(BYTE)*szChar,(BYTE)*szChar,&abc);
sz.cx = abc.abcB;
if (bAntiAlias)
{
sz.cx += 8;
// create a monochrom bitmap with 8x8 pixels per resultant alpha value
pPixels = (BYTE *)malloc(((sz.cx+16) * (sz.cy+8)));
memset(pPixels,0,((sz.cx+16) * (sz.cy+8)));
bmp.CreateBitmap(sz.cx,sz.cy ,1,1,pPixels);
oldbmp = dc.SelectObject(&bmp);
dc.PatBlt(0,0,sz.cx,sz.cy,BLACKNESS);
dc.TextOut(-abc.abcA,0,szChar,1);
a = abc.abcA;
c = abc.abcC;
c-=8; // BECAUSE WE ADDED 8 TO sz.cx above
if (a<0)
a-=4;
else
a+=4;
if (c<0)
c-=4;
else
c+=4;
a/=8;
c/=8;
bmp.GetBitmapBits(((sz.cx+16) * sz.cy)/8,pPixels);
// do the work of converting the monochrome bitmap to an alpha bimap and add it to the font
CalcAlphaAndAddChar(pPixels,sz.cx,sz.cy,n,a,c);
free(pPixels);
dc.SelectObject(oldbmp);
bmp.DeleteObject();
}
else
{ // non-antialiased
// create a monochrom bitmap with 8x8 pixels per resultant alpha value
pPixels = (BYTE *)malloc(((sz.cx+16) * (sz.cy+8)));
memset(pPixels,0,((sz.cx+16) * (sz.cy+8)));
bmp.CreateBitmap(sz.cx,sz.cy ,1,1,pPixels);
oldbmp = dc.SelectObject(&bmp);
dc.PatBlt(0,0,sz.cx,sz.cy,BLACKNESS);
dc.TextOut(-abc.abcA,0,szChar,1);
a = abc.abcA;
c = abc.abcC;
bmp.GetBitmapBits(((sz.cx+16) * sz.cy)/8,pPixels);
// do the work of converting the monochrome bitmap to an alpha bimap and add it to the font
CalcAndAddChar(pPixels,sz.cx,sz.cy,n,a,c);
free(pPixels);
dc.SelectObject(oldbmp);
bmp.DeleteObject();
}
}
else
data[n].bUsed = false;
}
dc.DeleteDC();
BuildTextures();
CleanTempData();
}
Font::Font(const char *szFileName,bool &bSuccess)
{ // load a font from a file
bSuccess = false;
OFSTRUCT of;
HFILE hFile = OpenFile(szFileName,&of,OF_READ);
if (hFile == HFILE_ERROR)
return;
_lread(hFile,&header,sizeof(header));
if (header.dwSig == D3DFONTSIG)
{
b32Bit = false;
}
else if (header.dwSig == D3D32BITFONTSIG)
{
b32Bit = true;
}
else
{
_lclose(hFile);
return;
}
for (int i=0; i<header.iTextureCount; i++)
{
pTextures[i] = new FontTexture(hFile,(int)header.dwFontHeight,b32Bit);
}
iNumTextures = header.iTextureCount;
bSuccess = true;
}
Font::~Font()
{
CleanTextures();
}
void Font::CalcAlphaAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c)
{
int bmpw,bmph,rbmpw;
BYTE *pAAPix;
BYTE *pCur;
int x,y,n;
int val;
bmpw = (width)/8 ;
if (width%8)
bmpw++;
rbmpw = bmpw;
bmph = (height/8)+1;
if (bmpw & 1)
rbmpw++;
pAAPix = (BYTE *)malloc(bmpw * bmph * 2);
for (y=0; y<bmph; y++)
{
for (x=0; x<bmpw; x++)
{
pCur = pPixels + (y*rbmpw*8) + x;
val = 0;
for (n=0; n<8; n++)
{
val += (*pCur & 0x01)?1:0;
val += (*pCur & 0x02)?1:0;
val += (*pCur & 0x04)?1:0;
val += (*pCur & 0x08)?1:0;
val += (*pCur & 0x10)?1:0;
val += (*pCur & 0x20)?1:0;
val += (*pCur & 0x40)?1:0;
val += (*pCur & 0x80)?1:0;
pCur += rbmpw;
}
val<<=2;
if (val)
val-=1;
//if (val > 8)
// val += 40;
if (val > 255)
val = 255;
// adjust for gama
pAAPix[y*bmpw + x] = ((BYTE)(val & ALIAS_MASK))>>ALIAS_SHIFT;
}
}
// check to see if this char is the same as the default char
// there is no good way to determine if a given character actually exists in a font
// so we're just going to compare the resulatant bitmap with the character zero
// if it's exactly the same we're not going to add it to the font
if (num)
{
BYTE *pData = data[0].pData;
if (bmpw == data[0].bWidth)
{
int iSize = bmpw * bmph;
if (!memcmp(pData,pAAPix,iSize))
{
data[num].bUsed = false;
return; // don't add the char because it's the same as the default char
}
}
}
AddChar(pAAPix,bmpw,bmph,num,a,c);
}
void Font::CalcAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c)
{
int bmpw,bmph,rbmpw;
BYTE *pAAPix;
BYTE *pCur;
int x,y;
int val;
bmpw = width;
rbmpw = bmpw/8;
if (bmpw & 0x7)
rbmpw ++;
bmph = height;
if (rbmpw & 1)
rbmpw++;
bmpw += 1; // add one pixel between each letter
pAAPix = (BYTE *)malloc(bmpw * bmph * 2);
for (y=0; y<bmph; y++)
{
for (x=0; x<bmpw; x++)
{
pCur = pPixels + (y*rbmpw) + x/8;
int mask = 1 << (7-(x%8));
val = 0;
if (*pCur & mask)
val = 255;
pAAPix[y*bmpw + x] = ((BYTE)(val & ALIAS_MASK))>>ALIAS_SHIFT;
}
}
// check to see if this char is the same as the default char
// there is no good way to determine if a given character actually exists in a font
// so we're just going to compare the resulatant bitmap with the character zero
// if it's exactly the same we're not going to add it to the font
if (num)
{
BYTE *pData = data[0].pData;
if (bmpw == data[0].bWidth)
{
int iSize = bmpw * bmph;
if (!memcmp(pData,pAAPix,iSize))
{
data[num].bUsed = false;
return; // don't add the char because it's the same as the default char
}
}
}
AddChar(pAAPix,bmpw,bmph,num,a,c);
}
void Font::AddChar(BYTE *pAAPix,int w, int h,int nChar,int a, int c)
{
data[nChar].pData = pAAPix;
data[nChar].bWidth = w;
data[nChar].aWidth = a;
data[nChar].cWidth = c;
data[nChar].bUsed = true;
header.dwFontHeight = (DWORD)h; // all chars are same height;
}
void Font::CleanTempData()
{
for (int iChar = 0; iChar < 256; iChar++)
{
if (data[iChar].bUsed)
{
delete data[iChar].pData;
data[iChar].bUsed = false;
}
}
}
void Font::CleanTextures()
{
for (int iTexture = 0; iTexture < iNumTextures; iTexture++)
{
delete pTextures[iTexture];
}
iNumTextures = 0;
}
bool Font::BuildTextures()
{ // this function starts by trying to build 128x128 textures, if it ends up with more than 3 of them then it
// tries for 1 256x256 texture and suppliments with 128x128 textures, if it still ends up with more than 3 128x128 textures
// it tries for 2 256x256 textures, and so on and so on
int iMaxLargeTextures = 0;
int iNumSmallTextures = 0;
iNumTextures = 0;
retry:
CleanTextures();
iNumSmallTextures = 0;
if (iNumTextures >= iMaxLargeTextures)
{
pTextures[0] = new FontTexture((DWORD)128,header.dwFontHeight);
iNumSmallTextures = 1;
}
else
{
pTextures[0] = new FontTexture((DWORD)256,header.dwFontHeight);
}
iNumTextures = 1;
header.dwSig = D3DFONTSIG;
for (int nChar=0; nChar<256; nChar++)
{
if (!nChar || data[nChar].bUsed)
{
bool bSuccess = false;
for (int iTexture=0; iTexture<iNumTextures; iTexture++)
{
DWORD dwXPos,dwYPos;
if (pTextures[iTexture]->AddChar(data[nChar].pData,data[nChar].bWidth,dwXPos,dwYPos))
{ // the character fit in this texture, so note it and continue on to the next character
header.bTexture[nChar] = (BYTE)iTexture;
header.bX[nChar] = (BYTE)dwXPos;
header.bY[nChar] = (BYTE)dwYPos;
header.bW[nChar] = (BYTE)data[nChar].bWidth;
header.cA[nChar] = (BYTE)data[nChar].aWidth;
header.cC[nChar] = (BYTE)data[nChar].cWidth;
bSuccess = true;
break;
}
}
if (!bSuccess)
{ // we are out of space in the old texture(s) so
// we need to create a new texture
if (iNumTextures >= MAX_FONT_TEXTURES)
{ // we've exceeded our maximum number of textures
MessageBox(NULL,"Font too big","Error",MB_OK);
CleanTextures();
break;
}
// we need to create a new texture
if (iNumTextures >= iMaxLargeTextures)
{ // we've already created as many 256x256 textures as we determined, so now start creating 128x128 textures
pTextures[iNumTextures] = new FontTexture((DWORD)128,header.dwFontHeight);
iNumSmallTextures++;
if(iNumSmallTextures > 3)
{ // we've exceeded 3 128x128 textures, so increment the number of large textures and try another iteration
iMaxLargeTextures++;
goto retry;
}
if (bMinimizeTextureCount && iNumSmallTextures)
{
iMaxLargeTextures++;
goto retry;
}
}
else
{ // we haven't used the number of 256x256 textures we determined to use, so create another
pTextures[iNumTextures] = new FontTexture((DWORD)256,header.dwFontHeight);
}
iTexture = iNumTextures;
iNumTextures++;
DWORD dwXPos,dwYPos;
// try to add the current character to the new texture
if (pTextures[iTexture]->AddChar(data[nChar].pData,data[nChar].bWidth,dwXPos,dwYPos))
{ // it worked, so note it and continue to the next char
header.bTexture[nChar] = (BYTE)iTexture;
header.bX[nChar] = (BYTE)dwXPos;
header.bY[nChar] = (BYTE)dwYPos;
header.bW[nChar] = (BYTE)data[nChar].bWidth;
header.cA[nChar] = (BYTE)data[nChar].aWidth;
header.cC[nChar] = (BYTE)data[nChar].cWidth;
bSuccess = true;
}
else
{ // we couldn't even fit the character on a new texture so bail
CleanTextures();
MessageBox(NULL,"Font too big","Error",MB_OK);
break;
}
}
}
else
{ // this character was either not in the font or was not in the list of characters to include
// so just make it point to the same spot as character zero
header.bTexture[nChar] = header.bTexture[0];
header.bX[nChar] = header.bX[0];
header.bY[nChar] = header.bY[0];
header.bW[nChar] = header.bW[0];
header.cA[nChar] = header.cA[0];
header.cC[nChar] = header.cC[0];
}
}
header.iTextureCount = iNumTextures;
return true;
}
BYTE *Font::GetCharMap(int iChar)
{ // return a copy the bitmap for the specified character
if (iChar < 0 || iChar > 255)
return 0;
return pTextures[header.bTexture[iChar]]->GetCharMap(header.bX[iChar],header.bY[iChar],header.bW[iChar]);
}
void Font::SetCharMap(int iChar,BYTE *pData)
{ // copy the data specified into the data for the specified char
if (iChar < 0 || iChar > 255)
return;
pTextures[header.bTexture[iChar]]->SetCharMap(pData,header.bX[iChar],header.bY[iChar],header.bW[iChar]);
}
bool Font::Save(HFILE hFile)
{
if (b32Bit)
header.dwSig = D3D32BITFONTSIG;
else
header.dwSig = D3DFONTSIG;
_lwrite(hFile,(LPCSTR)&header,sizeof(header));
for (int iTexture = 0; iTexture < iNumTextures; iTexture++)
{
pTextures[iTexture]->Save(hFile);
}
return true;
}
void Font::Shorten()
{
header.dwFontHeight--;
for (int i=0; i<256; i++)
{
header.bY[i]++;
}
for (i=0; i<iNumTextures; i++)
{
pTextures[i]->ChangeFontHeight((int)header.dwFontHeight);
}
}
void Font::ShortenFromBottom()
{
header.dwFontHeight--;
for (int i=0; i<iNumTextures; i++)
{
pTextures[i]->ChangeFontHeight((int)header.dwFontHeight);
}
}
void Font::DrawTexture(HDC hDC,int iTexture, int x, int y)
{
DrawGrayscaleBmp(hDC,x,y,pTextures[iTexture]->Size(),pTextures[iTexture]->Size(),pTextures[iTexture]->GetTexture());
if (b32Bit)
Draw32BitBmp(hDC,x,y+266,pTextures[iTexture]->Size(),pTextures[iTexture]->Size(),pTextures[iTexture]->Get32BitTexture());
}
void Font::ExportTGAS(const char *szTag,const char *szOutputDir)
{
char szOutput[260];
strcpy(szOutput,szOutputDir);
int iLen = strlen(szOutput);
if (szOutput[iLen-1] != '\\')
strcat(szOutput,"\\"); // make sure the path ends in a backspace
for (int i=0; i<iNumTextures; i++)
{
char szFileName[260];
wsprintf(szFileName,"%s%s%02d.TGA",szOutput,szTag,i);
pTextures[i]->ExportTGA(szFileName);
}
char szMessage[260];
wsprintf(szMessage,"Wrote %d .TGA files to %s.",iNumTextures,szOutputDir);
MessageBox(NULL,szMessage,"Success",MB_OK);
}
void Font::ImportTGAS(const char *szFirstFile)
{
if (!strchr(szFirstFile,'.'))
{
MessageBox(NULL,"Invalid file path. Not a '.tga'.","Error",MB_OK);
return;
}
// find out where the number index is in the file name
const char *szWriteNumber = szFirstFile + strlen(szFirstFile) - 1;
while (*szWriteNumber != '.')
szWriteNumber--;
szWriteNumber-=2; // it should now point to the last
if (!isdigit(*szWriteNumber) || !isdigit(*(szWriteNumber+1)))
{
MessageBox(NULL,"Invalid file path. Could not file index numbers","Error",MB_OK);
return;
}
int iNumberIndex = szWriteNumber - szFirstFile;
for (int i=0; i<iNumTextures; i++)
{
char szFileName[260];
char szNumber[10];
strcpy(szFileName,szFirstFile);
wsprintf(szNumber,"%02d",i);
szFileName[iNumberIndex] = szNumber[0];
szFileName[iNumberIndex+1] = szNumber[1];
if (!pTextures[i]->ImportTGA(szFileName))
{
char szMessage[260];
wsprintf(szMessage,"Could not load texture %s.",szFileName);
MessageBox(NULL,szMessage,"Error",MB_OK);
b32Bit = false;
return;
}
}
b32Bit = true;
}
FontTexture::FontTexture(DWORD dwSize,int iFontHeight)
{
this->dwSize = dwSize;
this->iFontHeight = iFontHeight;
p32BitTexture = NULL;
iNumRows = dwSize/iFontHeight;
dwSpaceAvailableOnEachRow = new DWORD[iNumRows];
for (int iRow = 0; iRow < iNumRows; iRow++)
dwSpaceAvailableOnEachRow[iRow] = dwSize;
pTexture = new BYTE[dwSize * dwSize];
memset(pTexture,0,dwSize * dwSize);
b32Bit = false;
p32BitTexture = false;
}
FontTexture::FontTexture(HFILE hFile,int iFontHeight,bool b32Bit)
{
this->b32Bit = b32Bit;
p32BitTexture = NULL;
_lread(hFile,&dwSize,sizeof(dwSize));
this->iFontHeight = iFontHeight;
iNumRows = dwSize/iFontHeight;
dwSpaceAvailableOnEachRow = new DWORD[iNumRows];
for (int iRow = 0; iRow < iNumRows; iRow++)
dwSpaceAvailableOnEachRow[iRow] = 0; // we can't add anything else any more
if (b32Bit)
{
// read in 32 bit texture
p32BitTexture = new DWORD[dwSize * dwSize];
_lread(hFile,p32BitTexture,dwSize * dwSize * 4);
// now convert to 8 bit so we have something to work with
DWORD dwPixels = dwSize * dwSize;
pTexture = new BYTE[dwSize * dwSize];
DWORD *pSource = p32BitTexture;
BYTE *pDest = pTexture;
while (dwPixels)
{
*pDest = (BYTE)((*pSource)>>24);
pDest++;
pSource++;
dwPixels--;
}
}
else
{
pTexture = new BYTE[dwSize * dwSize];
_lread(hFile,pTexture,dwSize * dwSize);
}
}
FontTexture::~FontTexture()
{
delete pTexture;
delete p32BitTexture;
delete dwSpaceAvailableOnEachRow;
pTexture = NULL;
dwSpaceAvailableOnEachRow = NULL;
}
bool FontTexture::AddChar(BYTE *pData,DWORD dwWidth,DWORD &dwXPos,DWORD &dwYPos)
{
for (int iRow = 0; iRow < iNumRows; iRow++)
{
if (dwSpaceAvailableOnEachRow[iRow] >= dwWidth)
{
dwXPos = dwSize - dwSpaceAvailableOnEachRow[iRow];
dwYPos = iFontHeight * iRow;
AddCharToTexture(pData,dwWidth,dwXPos,dwYPos);
dwSpaceAvailableOnEachRow[iRow] -= dwWidth;
return true;
}
}
return false;
}
void FontTexture::AddCharToTexture(BYTE *pData,DWORD dwWidth,DWORD dwX,DWORD dwY)
{
for (int y=0; y<iFontHeight; y++)
{
BYTE *pSource = pData + dwWidth * y;
BYTE *pDest = pTexture + ((dwY+y) * dwSize) + dwX;
memcpy(pDest,pSource,dwWidth);
}
}
BYTE *FontTexture::GetCharMap(int iX, int iY, int iW)
{
BYTE *pResult = new BYTE[iW * iFontHeight];
for (int y=0; y<iFontHeight; y++)
{
BYTE *pDest = pResult + iW * y;
BYTE *pSource = pTexture + ((iY+y) * dwSize) + iX;
memcpy(pDest,pSource,iW);
}
return pResult;
}
bool FontTexture::Save(HFILE hFile)
{
_lwrite(hFile,(LPCSTR)&dwSize,sizeof(DWORD));
if (b32Bit)
_lwrite(hFile,(LPCSTR)p32BitTexture,dwSize * dwSize * 4);
else
_lwrite(hFile,(LPCSTR)pTexture,dwSize * dwSize);
return true;
}
bool FontTexture::ExportTGA(const char *szFullPath)
{
TGAHeader header;
memset(&header,0,sizeof(header));
header.TypeCode = 2;
header.Width = (WORD)dwSize;
header.Height = (WORD)dwSize;
header.BitsPerPixel = 32;
DWORD *dwExportTexture = new DWORD[dwSize * dwSize];
DWORD dwPixelsLeft = dwSize * dwSize;
DWORD *pDest = dwExportTexture;
// need to flip image
for (int iRow = dwSize-1; iRow>=0; iRow--)
{
for (int iColumn = 0; iColumn < (int)dwSize; iColumn++)
{
DWORD dwAlpha = pTexture[iRow * dwSize + iColumn];
if (dwAlpha)
*pDest = dwAlpha<<24 | 0xFFFFFF;
else
*pDest = 0;
pDest++;
}
}
bool bSuccess = false;
DWORD dwSizeWritten = 0;
HANDLE hFile = CreateFile(szFullPath,GENERIC_WRITE,0/*share mode*/,NULL/*security*/,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL/*template*/);
if (hFile == INVALID_HANDLE_VALUE)
goto errorexit;
WriteFile(hFile,&header,sizeof(header),&dwSizeWritten,NULL);
if (dwSizeWritten != sizeof(header))
goto errorexit;
dwSizeWritten = 0;
WriteFile(hFile,dwExportTexture,dwSize * dwSize * sizeof(DWORD),&dwSizeWritten,NULL);
if (dwSizeWritten != dwSize * dwSize * sizeof(DWORD))
goto errorexit;
bSuccess = true;
errorexit:
if (hFile != INVALID_HANDLE_VALUE)
CloseHandle(hFile);
delete dwExportTexture;
return bSuccess;
}
bool FontTexture::ImportTGA(const char *szFullPath)
{
b32Bit = true;
bool bSuccess = false;
HANDLE hFile = CreateFile(szFullPath,GENERIC_READ,0/*share mode*/,NULL/*security*/,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL/*template*/);
if (hFile == INVALID_HANDLE_VALUE)
return false;
TGAHeader header;
DWORD dwBytesRead = 0;
ReadFile(hFile,&header,sizeof(header),&dwBytesRead,NULL);
if (header.Width != header.Height)
return false;
if (header.Width != dwSize)
return false;
if (header.TypeCode != 2 || header.BitsPerPixel != 32)
return false;
DWORD *dwTexture = new DWORD[dwSize * dwSize];
// flip the image as we read it in
DWORD dwTotalBytesRead = 0;
for (int iRow = dwSize-1; iRow >=0; iRow--)
{
dwBytesRead = 0;
ReadFile(hFile,&dwTexture[iRow * dwSize],dwSize * 4,&dwBytesRead,NULL);
dwTotalBytesRead += dwBytesRead;
}
CloseHandle(hFile);
if (dwTotalBytesRead != dwSize * dwSize * 4)
{
delete dwTexture;
return false;
}
delete p32BitTexture;
p32BitTexture = dwTexture;
DWORD dwPixels = dwSize * dwSize;
delete pTexture;
pTexture = new BYTE[dwSize * dwSize];
DWORD *pSource = p32BitTexture;
BYTE *pDest = pTexture;
while (dwPixels)
{
*pDest = (BYTE)((*pSource)>>24);
pDest++;
pSource++;
dwPixels--;
}
return true;
}
@@ -0,0 +1,114 @@
#define MAX_FONT_TEXTURES 128
class FontTexture
{
DWORD dwSize;
int iFontHeight;
int iNumRows;
DWORD *dwSpaceAvailableOnEachRow;
BYTE *pTexture;
DWORD *p32BitTexture;
bool b32Bit;
void AddCharToTexture(BYTE *pData,DWORD dwWidth,DWORD dwX,DWORD dwY);
public:
FontTexture(DWORD dwSize,int iFontHeight);
FontTexture(HFILE hFile,int iFontHeight,bool b32Bit);
~FontTexture();
bool AddChar(BYTE *pData,DWORD dwWidth,DWORD &dwXPos,DWORD &dwYPos);
bool Save(HFILE hFile);
bool Load(HFILE hFile);
BYTE *GetCharMap(int iX, int iY, int iW);
void SetCharMap(BYTE *pData,int iX, int iY, int iW) {AddCharToTexture(pData,(DWORD)iW,(DWORD)iX,(DWORD)iY);}
BYTE *GetTexture() {return pTexture;}
BYTE *Get32BitTexture() {return (BYTE *)p32BitTexture;}
void ChangeFontHeight(int iNewHeight) {iFontHeight = iNewHeight;}
DWORD Size() {return dwSize;}
bool ExportTGA(const char *szFullPath);
bool ImportTGA(const char *szFullPath);
};
typedef struct
{
BYTE *pData;
BYTE bWidth;
signed char aWidth;
signed char cWidth;
bool bUsed;
} CharData;
// structures for file format
#define D3DFONTSIG '4F3D'
#define D3D32BITFONTSIG 'TF3D'
#pragma warning( disable : 4200 )
typedef struct
{
DWORD dwSig;
char szFaceName[64];
int iSize; // point size of font used to create this font
bool bItalic; // italic on or off when this font was created
int iWeight; // weight of font created
int iTextureCount;
DWORD dwFontHeight; // height in pixels of the resulatant font
BYTE bTexture[256]; // indicate which texture each character is on
BYTE bX[256]; // indicates x position of each character on it's texture
BYTE bY[256]; // indicates y position of each character on it's texture
BYTE bW[256]; // indicates width of each character in the texture
signed char cA[256]; // indicates amount of space to add before each character (may be -)
signed char cC[256]; // indicates amount of space to add after each character (may be -)
//DWORD dwTextureOffsets[0]; // offsets to textures
} D3DFont;
typedef struct
{
DWORD dwSize;
BYTE bPixels[0];
} D3DFontTexture;
class Font
{
protected:
// temp data (used while building font, but not needed after font is built)
CharData data[256];
bool bMinimizeTextureCount;
bool b32Bit;
// intermediate data
D3DFont header;
int iNumTextures;
int iTextureSize;
FontTexture *pTextures[MAX_FONT_TEXTURES];
void CalcAlphaAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c);
void CalcAndAddChar(BYTE *pPixels,int width,int height,int num,int a, int c);
void AddChar(BYTE *pAAPix,int w, int h,int nChar,int a, int c);
bool BuildTextures();
void CleanTextures();
void CleanTempData();
public:
Font(char *szFaceName,int iHeight,bool bItalic,int iWeight,bool bAntiAlias,bool bMinimizeTextureSize=false);
Font(const char *szFullPath,bool &bSuccess);
~Font();
bool Save(HFILE hFile);
void Shorten(); // removes a single row of pixels at the top of each character
void ShortenFromBottom(); // removes a single row of pixels at the top of each character
int GetTextureCount() { return iNumTextures;}
void DrawTexture(HDC hDC, int iTexture, int x, int y);
BYTE *GetCharMap(int iChar);
void SetCharMap(int iChar,BYTE *pData);
char *FaceName() {return header.szFaceName;}
int PointSize() {return header.iSize;}
bool IsItalic() {return header.bItalic;}
bool IsBold() {return header.iWeight > 400;}
int GetCharHeight(int iChar) {return (int)header.dwFontHeight;}
int GetCharWidth(int iChar) {return header.bW[iChar];}
int GetCharAWidth(int iChar) {return header.cA[iChar];}
void SetCharAWidth(int iChar,int iVal) {header.cA[iChar] = (signed char)iVal;}
int GetCharCWidth(int iChar) {return header.cC[iChar];}
void SetCharCWidth(int iChar,int iVal) {header.cC[iChar] = (signed char)iVal;}
void ExportTGAS(const char *szTag,const char *szOutputDir);
void ImportTGAS(const char *szFirstFile);
};
@@ -0,0 +1,131 @@
// fontedit.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#define __GLOBALS__
#include "globals.h"
#include "fontedit.h"
#include "mainfrm.h"
#include "fontedoc.h"
#include "fontevw.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp
BEGIN_MESSAGE_MAP(CFonteditApp, CWinApp)
//{{AFX_MSG_MAP(CFonteditApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp construction
CFonteditApp::CFonteditApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CFonteditApp object
CFonteditApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp initialization
BOOL CFonteditApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
Enable3dControls();
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CFonteditDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CFonteditView));
AddDocTemplate(pDocTemplate);
// create a new (empty) document
OnFileNew();
if (m_lpCmdLine[0] != '\0')
{
// TODO: add command line processing here
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// Implementation
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CFonteditApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp commands
@@ -0,0 +1,38 @@
// fontedit.h : main header file for the FONTEDIT application
//
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CFonteditApp:
// See fontedit.cpp for the implementation of this class
//
class CFonteditApp : public CWinApp
{
public:
CFonteditApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFonteditApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CFonteditApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,449 @@
//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
#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
"#include ""res\\fontedit.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"\r\n"
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"#include ""afxres.rc"" \t// Standard components\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\fontedit.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\toolbar.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New...", ID_FILE_NEW
MENUITEM "N&ew Non Anti Aliased...", ID_FILE_NEWNONANTIALIASED
MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN
MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE
MENUITEM "Save &As...", ID_FILE_SAVE_AS
MENUITEM SEPARATOR
MENUITEM "Export Textures...", ID_FILE_EXPORTTEXTURES
MENUITEM "Import Textures...", ID_FILE_IMPORTTEXTURES
MENUITEM SEPARATOR
MENUITEM "Recent File", ID_FILE_MRU_FILE1, GRAYED
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Image"
BEGIN
MENUITEM "&Undo", ID_IMAGE_UNDO
MENUITEM SEPARATOR
MENUITEM "&Next Char", ID_IMAGE_NEXT
MENUITEM "&Previous Char", ID_IMAGE_PREV
MENUITEM SEPARATOR
MENUITEM "Zoom &In", ID_IMAGE_ZOOMIN
MENUITEM "Zoom &Out", ID_IMAGE_ZOOMOUT
MENUITEM SEPARATOR
MENUITEM "&Shorten", ID_IMAGE_SHORTEN
MENUITEM "Shorten From &Bottom", ID_IMAGE_SHORTENFROMBOTTOM
MENUITEM "&Change A && C Widths", ID_IMAGE_CHANGEACWIDTHS
MENUITEM "Change &All A && C Widths", IDM_GLOBALCHANGEAANDC
END
POPUP "&View"
BEGIN
MENUITEM "&Toolbar", ID_VIEW_TOOLBAR
MENUITEM "&Status Bar", ID_VIEW_STATUS_BAR
MENUITEM "&Properties...", IDM_VIEW_PROPERTIES
END
POPUP "&Options"
BEGIN
MENUITEM "Minimize number of &Textures",
ID_OPTIONS_MINIMIZETEXTURECOUNT
MENUITEM "Minimize Texture &Space", ID_OPTIONS_MINIMIZETEXTURESPACE
MENUITEM SEPARATOR
MENUITEM "Alphabetic Characters Only", ID_OPTIONS_ALPHABETICCHARACTERSONLY
END
POPUP "&Help"
BEGIN
MENUITEM "&About Font Edit", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
"O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
"S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 34, 22, 217, 102
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About fontedit"
FONT 8, "MS Sans Serif"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
LTEXT "Font Edit Version 4.2 for Game OS",IDC_STATIC,40,10,119,
8
LTEXT "Copyright © 1995-1999 Microsoft Corp. This programs is for internal use only.\nThis program comes with a 100% satisfaction guarantee. If you have any problems or ideas for improvement, please contact Matt Dawson (alias mad)",
IDC_STATIC,40,25,138,54
DEFPUSHBUTTON "OK",IDOK,176,6,32,14,WS_GROUP
LTEXT "By Matt Dawson",IDC_STATIC,40,87,96,8
END
IDD_ACWIDTH DIALOG DISCARDABLE 0, 0, 137, 39
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Set A & C Widths"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,76,2,50,14
PUSHBUTTON "Cancel",IDCANCEL,76,18,50,14
RTEXT "A Width",IDC_STATIC,6,7,29,7
EDITTEXT IDC_AWIDTH,37,4,33,12,ES_AUTOHSCROLL
RTEXT "C Width",IDC_STATIC,6,22,29,7
EDITTEXT IDC_CWIDTH,37,20,33,12,ES_AUTOHSCROLL
END
IDD_DELTASPACE DIALOG DISCARDABLE 0, 0, 186, 84
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Spacing"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
RTEXT "Delta A Width:",IDC_STATIC,7,11,55,8
RTEXT "Delta C Width:",IDC_STATIC,7,27,55,8
EDITTEXT IDC_DELTA_A,65,7,46,14,ES_AUTOHSCROLL
EDITTEXT IDC_DELTA_C,65,24,46,14,ES_AUTOHSCROLL
LTEXT "Clicking OK will add the values above to the respective A and C spacing widths for each character in the font. Positive values increase the space, negative values decrease the space.",
IDC_STATIC,7,42,172,35
END
IDD_FONTPROPERTIES DIALOG DISCARDABLE 0, 0, 212, 60
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Properties"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,154,6,50,14
RTEXT "Font Name:",IDC_STATIC,8,7,65,8
RTEXT "Size:",IDC_STATIC,8,19,65,8
RTEXT "Bold:",IDC_STATIC,8,31,65,8
RTEXT "Italic:",IDC_STATIC,8,43,65,8
LTEXT "",IDC_FONTNAME,86,7,53,8
LTEXT "",IDC_FONTSIZE,86,19,53,8
LTEXT "",IDC_FONTBOLD,86,31,53,8
LTEXT "",IDC_FONTITALIC,86,43,53,8
END
IDD_EXPORT DIALOG DISCARDABLE 0, 0, 308, 87
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Export Textures"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,247,5,50,14
PUSHBUTTON "Cancel",IDCANCEL,247,23,50,14
EDITTEXT IDC_FILETAG,73,5,113,14,ES_AUTOHSCROLL
RTEXT "File Tag:",IDC_STATIC,6,9,65,8
EDITTEXT IDC_OUPUTDIR,73,23,113,14,ES_AUTOHSCROLL
RTEXT "Output Directory:",IDC_STATIC,6,27,65,8
PUSHBUTTON "Browse...",IDC_BROWSE,191,23,50,14
LTEXT "The file tag will be used to name the exported textures. If you entered 'myfont' for the file tag, then the first texture will be named myfont00.tga, the second myfont01.tga and so on.",
IDC_STATIC,8,46,235,35
END
IDD_CHOOSEDIR DIALOG DISCARDABLE 0, 0, 298, 149
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Choose Directory to Export Textures Too"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,242,8,50,14
PUSHBUTTON "Cancel",IDCANCEL,242,26,50,14
LISTBOX IDC_DIRLIST,6,24,114,92,LBS_SORT | LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_DIRPATH,6,128,230,14,ES_AUTOHSCROLL
LTEXT "Directory:",IDC_STATIC,6,119,182,8
COMBOBOX IDC_DRIVES,36,8,82,101,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
RTEXT "Drives:",IDC_STATIC,6,13,28,8
LISTBOX IDC_FILELIST,124,24,111,91,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LTEXT "Files",IDC_STATIC,126,15,67,8
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "FONTEDIT MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "FONTEDIT\0"
VALUE "LegalCopyright", "Copyright © 1995\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "FONTEDIT.EXE\0"
VALUE "ProductName", "FONTEDIT Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DELTASPACE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 77
END
IDD_FONTPROPERTIES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 205
TOPMARGIN, 7
BOTTOMMARGIN, 53
END
IDD_EXPORT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 301
TOPMARGIN, 7
BOTTOMMARGIN, 80
END
IDD_CHOOSEDIR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 291
TOPMARGIN, 7
BOTTOMMARGIN, 142
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "Font Edit\n\nFonted\nGOS Font (*.d3f)\n.d3f\nFontedit.Document\nFonted Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "Font Edit"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_INDICATOR_EXT "EXT"
ID_INDICATOR_CAPS "CAP"
ID_INDICATOR_NUM "NUM"
ID_INDICATOR_SCRL "SCRL"
ID_INDICATOR_OVR "OVR"
ID_INDICATOR_REC "REC"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Create a new anti-aliased font\nNew"
ID_FILE_OPEN "Open an existing font\nOpen"
ID_FILE_CLOSE "Close the active document\nClose"
ID_FILE_SAVE "Save the font\nSave"
ID_FILE_SAVE_AS "Save the font with a new name\nSave As"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display information about Font Edit\nAbout"
ID_APP_EXIT "Quit, prompts to save changes\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_MRU_FILE1 "Open this document"
ID_FILE_MRU_FILE2 "Open this document"
ID_FILE_MRU_FILE3 "Open this document"
ID_FILE_MRU_FILE4 "Open this document"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_VIEW_TOOLBAR "Show or hide the toolbar\nToggle ToolBar"
ID_VIEW_STATUS_BAR "Show or hide the status bar\nToggle StatusBar"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window and prompts to save the documents"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_IMAGE_NEXT "Goto next char\nNext"
ID_IMAGE_PREV "Goto previous char\nPrevious"
ID_IMAGE_ZOOMIN "Enlarge view of char\nZoom"
ID_IMAGE_ZOOMOUT "Reduce view of char\nZoom Out"
ID_IMAGE_UNDO "Undo changes to this characture\nUndo"
ID_IMAGE_SHORTEN "removes one line from the top of the font"
ID_OPTIONS_ALL "Include all characters in the font that are built."
END
STRINGTABLE DISCARDABLE
BEGIN
IDM_VIEW_PROPERTIES "View the properties of the current font."
ID_OPTIONS_FORCE256X256TEXTURES
"Forces all textures to be 256 x 256 textures"
ID_OPTIONS_MINIMIZETEXTURECOUNT
"Minimize the total number of textures required by new fonts"
ID_OPTIONS_MINIMIZETEXTURESPACE
"Minimizes the total texture space required by new fonts"
ID_FILE_EXPORTTEXTURES "Export Textures to TGA files"
ID_FILE_IMPORTTEXTURES "Import Textures from TGA files."
ID_OPTIONS_ALPHABETICCHARACTERSONLY
"With this option on no numbers or symbol characters will be included in the font"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "res\fontedit.rc2" // non-Microsoft Visual C++ edited resources
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#include "afxres.rc" // Standard components
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,319 @@
// fontedoc.cpp : implementation of the CFonteditDoc class
//
#include "stdafx.h"
#include "globals.h"
#include "font.h"
#include "fontedit.h"
#include "mainfrm.h"
#include "fontedoc.h"
#include "fontevw.h"
#include "exporttextures.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
Font *theFont = NULL;
char szExportName[260];
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc
IMPLEMENT_DYNCREATE(CFonteditDoc, CDocument)
BEGIN_MESSAGE_MAP(CFonteditDoc, CDocument)
//{{AFX_MSG_MAP(CFonteditDoc)
ON_COMMAND(ID_FILE_NEW, OnFileNew)
ON_COMMAND(ID_IMAGE_SHORTEN, OnImageShorten)
ON_COMMAND(ID_FILE_NEWNONANTIALIASED, OnFileNewnonantialiased)
ON_COMMAND(ID_OPTIONS_MINIMIZETEXTURECOUNT, OnOptionsMinimizetexturecount)
ON_COMMAND(ID_OPTIONS_MINIMIZETEXTURESPACE, OnOptionsMinimizetexturespace)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_MINIMIZETEXTURECOUNT, OnUpdateOptionsMinimizetexturecount)
ON_COMMAND(ID_FILE_EXPORTTEXTURES, OnFileExporttextures)
ON_COMMAND(ID_FILE_IMPORTTEXTURES, OnFileImporttextures)
ON_UPDATE_COMMAND_UI(ID_FILE_EXPORTTEXTURES, OnUpdateFileExporttextures)
ON_UPDATE_COMMAND_UI(ID_FILE_IMPORTTEXTURES, OnUpdateFileImporttextures)
ON_COMMAND(ID_IMAGE_SHORTENFROMBOTTOM, OnImageShortenfrombottom)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc construction/destruction
CFonteditDoc::CFonteditDoc()
{
bMinimizeTextureCount = true;
SetModifiedFlag(FALSE);
}
CFonteditDoc::~CFonteditDoc()
{
}
BOOL CFonteditDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc serialization
void CFonteditDoc::Serialize(CArchive& ar)
{
if (!theFont)
return;
if (ar.IsStoring())
{
theFont->Save(ar.GetFile()->m_hFile);
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc diagnostics
#ifdef _DEBUG
void CFonteditDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CFonteditDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFonteditDoc commands
BOOL CFonteditDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
Font *temp;
bool bSuccess=false;
temp = new Font(lpszPathName,bSuccess);
if (!bSuccess)
{
delete temp;
return FALSE;
}
if (theFont)
Cleanup();
theFont = temp;
view->NewFont();
return TRUE;
}
void CFonteditDoc::Cleanup(void)
{
delete theFont;
}
void CFonteditDoc::OnFileNewnonantialiased()
{
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
if (theFont)
{
lf.lfHeight = theFont->PointSize();
lf.lfWeight = theFont->IsBold()?700:400;
lf.lfItalic = theFont->IsItalic();
strcpy(lf.lfFaceName, theFont->FaceName());
}
CFontDialog fdlg(&lf);
Font *temp;
if (IsModified())
{
int result = view->MessageBox("This font has been modified, do you want to save it",NULL,MB_YESNOCANCEL);
if(result == IDCANCEL)
return;
if (result == IDYES)
main->SendMessage(WM_COMMAND,ID_FILE_SAVE,0);
}
fdlg.m_cf.Flags |= CF_TTONLY;
if (fdlg.DoModal() != IDOK)
return;
temp=new Font(fdlg.m_cf.lpLogFont->lfFaceName,
fdlg.m_cf.lpLogFont->lfHeight,
fdlg.m_cf.lpLogFont->lfItalic!=0,
fdlg.m_cf.lpLogFont->lfWeight,false,bMinimizeTextureCount);
if (!temp)
return;
Cleanup();
theFont = temp;
m_strPathName.Empty();
view->NewFont();
view->InvalidateRect(NULL,TRUE);
SetModifiedFlag(FALSE);
}
void CFonteditDoc::OnFileNew()
{
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
if (theFont)
{
lf.lfHeight = theFont->PointSize();
lf.lfWeight = theFont->IsBold()?700:400;
lf.lfItalic = theFont->IsItalic();
strcpy(lf.lfFaceName, theFont->FaceName());
}
CFontDialog fdlg(&lf);
Font *temp;
if (IsModified())
{
int result = view->MessageBox("This font has been modified, do you want to save it",NULL,MB_YESNOCANCEL);
if(result == IDCANCEL)
return;
if (result == IDYES)
main->SendMessage(WM_COMMAND,ID_FILE_SAVE,0);
}
fdlg.m_cf.Flags |= CF_TTONLY;
if (fdlg.DoModal() != IDOK)
return;
temp=new Font(fdlg.m_cf.lpLogFont->lfFaceName,
fdlg.m_cf.lpLogFont->lfHeight,
fdlg.m_cf.lpLogFont->lfItalic!=0,
fdlg.m_cf.lpLogFont->lfWeight,true,bMinimizeTextureCount);
if (!temp)
return;
Cleanup();
theFont = temp;
m_strPathName.Empty();
view->NewFont();
view->InvalidateRect(NULL,TRUE);
SetModifiedFlag(FALSE);
}
BOOL CFonteditDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
if (!theFont)
return false;
view->UpdateFont();
return CDocument::OnSaveDocument(lpszPathName);
}
void CFonteditDoc::OnImageShorten()
{
if (!theFont)
return;
theFont->Shorten();
view->InvalidateRect(NULL,TRUE);
}
void CFonteditDoc::OnImageShortenfrombottom()
{
if (!theFont)
return;
theFont->ShortenFromBottom();
view->InvalidateRect(NULL,TRUE);
}
void CFonteditDoc::OnOptionsMinimizetexturecount()
{
bMinimizeTextureCount = true;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURECOUNT,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURESPACE,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditDoc::OnOptionsMinimizetexturespace()
{
bMinimizeTextureCount = false;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURECOUNT,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MINIMIZETEXTURESPACE,MF_BYCOMMAND|MF_CHECKED);
}
void CFonteditDoc::OnUpdateOptionsMinimizetexturecount(CCmdUI* pCmdUI)
{
if (bMinimizeTextureCount)
OnOptionsMinimizetexturecount();
else
OnOptionsMinimizetexturespace();
}
void CFonteditDoc::OnFileExporttextures()
{
CExportTextures dlg;
if (dlg.DoModal()!= IDOK)
return;
if (!SetCurrentDirectory(dlg.m_OutputDir))
{
int iResult = MessageBox(NULL,"That directory does not exist, do you want to create it?","Question",MB_YESNO);
if (iResult == IDNO)
return;
CreateDirectory(dlg.m_OutputDir,NULL);
}
theFont->ExportTGAS(dlg.m_FileTag,dlg.m_OutputDir);
}
void CFonteditDoc::OnFileImporttextures()
{
CFileDialog dlg(true /*open/save*/,"*.tga",NULL,OFN_FILEMUSTEXIST,"Targas (*.tga)|*.tga||",NULL);
dlg.DoModal();
const char *szPath = dlg.m_ofn.lpstrFile;
if (!strstr(szPath,"00.tga") && !strstr(szPath,"00.TGA"))
{
MessageBox(NULL,"You must select the first file that was written out by the export command, it will be called something like 'fontname00.tga'","Bogus File Name",MB_OK);
return;
}
theFont->ImportTGAS(szPath);
view->InvalidateRect(NULL,TRUE);
}
void CFonteditDoc::OnUpdateFileExporttextures(CCmdUI* pCmdUI)
{
if (!theFont)
pCmdUI->Enable(false);
else
pCmdUI->Enable(true);
}
void CFonteditDoc::OnUpdateFileImporttextures(CCmdUI* pCmdUI)
{
if (!theFont)
pCmdUI->Enable(false);
else
pCmdUI->Enable(true);
}
@@ -0,0 +1,58 @@
// fontedoc.h : interface of the CFonteditDoc class
//
/////////////////////////////////////////////////////////////////////////////
class CFonteditDoc : public CDocument
{
protected: // create from serialization only
CFonteditDoc();
DECLARE_DYNCREATE(CFonteditDoc)
void Cleanup(void);
// Attributes
bool bMinimizeTextureCount;
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFonteditDoc)
public:
virtual BOOL OnNewDocument();
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFonteditDoc();
virtual void Serialize(CArchive& ar); // overridden for document i/o
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFonteditDoc)
afx_msg void OnFileNew();
afx_msg void OnImageShorten();
afx_msg void OnFileNewnonantialiased();
afx_msg void OnOptionsMinimizetexturecount();
afx_msg void OnOptionsMinimizetexturespace();
afx_msg void OnUpdateOptionsMinimizetexturecount(CCmdUI* pCmdUI);
afx_msg void OnFileExporttextures();
afx_msg void OnFileImporttextures();
afx_msg void OnUpdateFileExporttextures(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileImporttextures(CCmdUI* pCmdUI);
afx_msg void OnImageShortenfrombottom();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class Font;
extern Font *theFont;
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,104 @@
// FontProperties.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "FontProperties.h"
#include "fontedoc.h"
#include "font.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFontProperties dialog
CFontProperties::CFontProperties(CWnd* pParent /*=NULL*/)
: CDialog(CFontProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(CFontProperties)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CFontProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFontProperties)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFontProperties, CDialog)
//{{AFX_MSG_MAP(CFontProperties)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFontProperties message handlers
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
FontProperties::FontProperties(CWnd* pParent /*=NULL*/)
: CDialog(FontProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(FontProperties)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void FontProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FontProperties)
DDX_Control(pDX, IDC_FONTSIZE, m_Size);
DDX_Control(pDX, IDC_FONTNAME, m_Name);
DDX_Control(pDX, IDC_FONTITALIC, m_Italic);
DDX_Control(pDX, IDC_FONTBOLD, m_Bold);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FontProperties, CDialog)
//{{AFX_MSG_MAP(FontProperties)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FontProperties message handlers
void FontProperties::OnOK()
{
CDialog::OnOK();
}
BOOL FontProperties::OnInitDialog()
{
CDialog::OnInitDialog();
char szOut[260];
sprintf(szOut,"%d",theFont->PointSize());
m_Size.SetWindowText(szOut);
if (theFont->IsBold())
m_Bold.SetWindowText("Yes");
else
m_Bold.SetWindowText("No");
if (theFont->IsItalic())
m_Italic.SetWindowText("Yes");
else
m_Italic.SetWindowText("No");
m_Name.SetWindowText(theFont->FaceName());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -0,0 +1,82 @@
#if !defined(AFX_FONTPROPERTIES_H__5AB361DF_79E3_4532_A954_B2BDCD94260C__INCLUDED_)
#define AFX_FONTPROPERTIES_H__5AB361DF_79E3_4532_A954_B2BDCD94260C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FontProperties.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CFontProperties dialog
class CFontProperties : public CDialog
{
// Construction
public:
CFontProperties(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CFontProperties)
enum { IDD = IDD_FONTPROPERTIES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFontProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CFontProperties)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
class FontProperties : public CDialog
{
// Construction
public:
FontProperties(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(FontProperties)
enum { IDD = IDD_FONTPROPERTIES };
CStatic m_Size;
CStatic m_Name;
CStatic m_Italic;
CStatic m_Bold;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(FontProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(FontProperties)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FONTPROPERTIES_H__5AB361DF_79E3_4532_A954_B2BDCD94260C__INCLUDED_)
@@ -0,0 +1,43 @@
// FontProperties1.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "FontProperties1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
FontProperties::FontProperties(CWnd* pParent /*=NULL*/)
: CDialog(FontProperties::IDD, pParent)
{
//{{AFX_DATA_INIT(FontProperties)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void FontProperties::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(FontProperties)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(FontProperties, CDialog)
//{{AFX_MSG_MAP(FontProperties)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// FontProperties message handlers
@@ -0,0 +1,46 @@
#if !defined(AFX_FONTPROPERTIES1_H__114C7906_92A7_4611_9238_78185B12CCB9__INCLUDED_)
#define AFX_FONTPROPERTIES1_H__114C7906_92A7_4611_9238_78185B12CCB9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// FontProperties1.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// FontProperties dialog
class FontProperties : public CDialog
{
// Construction
public:
FontProperties(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(FontProperties)
enum { IDD = IDD_FONTPROPERTIES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(FontProperties)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(FontProperties)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FONTPROPERTIES1_H__114C7906_92A7_4611_9238_78185B12CCB9__INCLUDED_)
@@ -0,0 +1,38 @@
#ifdef __GLOBALS__
#define __ALLOC__
#define ALLOC(def,val) def = val
#else
#define __ALLOC__ extern
#define ALLOC(def,val) extern def
#endif
#define LEN_PATH 256
#define ALIAS_SHIFT 0
#define ALIAS_MASK 0xFF // top three bits
typedef struct {
int nOffset;
BYTE bWidth;
BYTE bHeight;
signed char nAWidth;
signed char nCWidth;
} Char;
typedef struct BitMapInfoTag {
BITMAPINFOHEADER bmiH;
union {
RGBQUAD qc[256];
WORD bmiC[256];
} colors;
} BitMapInfo;
class CFonteditView;
class CFonteditDoc;
class CMainFrame;
ALLOC(CFonteditView *view,0);
ALLOC(CMainFrame *main,0);
ALLOC(int nLanguage,4);
@@ -0,0 +1,124 @@
// mainfrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "globals.h"
#include "fontedit.h"
#include "mainfrm.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_IMAGE_SHORTENFROMBOTTOM, OnImageShortenfrombottom)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// arrays of IDs used to initialize control bars
// toolbar buttons - IDs are command buttons
static UINT BASED_CODE buttons[] =
{
// same order as in the bitmap 'toolbar.bmp'
ID_FILE_OPEN,
ID_FILE_SAVE,
ID_SEPARATOR,
ID_IMAGE_PREV,
ID_IMAGE_NEXT,
ID_SEPARATOR,
ID_IMAGE_ZOOMIN,
ID_IMAGE_ZOOMOUT
};
static UINT BASED_CODE indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
main = this;
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
!m_wndToolBar.SetButtons(buttons,
sizeof(buttons)/sizeof(UINT)))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
// TODO: Remove this if you don't want tool tips
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnImageShortenfrombottom()
{
// TODO: Add your command handler code here
}
@@ -0,0 +1,43 @@
// mainfrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnImageShortenfrombottom();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,43 @@
// Prop.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "Prop.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CProp dialog
CProp::CProp(CWnd* pParent /*=NULL*/)
: CDialog(CProp::IDD, pParent)
{
//{{AFX_DATA_INIT(CProp)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CProp::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProp)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CProp, CDialog)
//{{AFX_MSG_MAP(CProp)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CProp message handlers
@@ -0,0 +1,46 @@
#if !defined(AFX_PROP_H__C7110B15_6EE9_4C65_BA2A_C25B74F090FF__INCLUDED_)
#define AFX_PROP_H__C7110B15_6EE9_4C65_BA2A_C25B74F090FF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Prop.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CProp dialog
class CProp : public CDialog
{
// Construction
public:
CProp(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CProp)
enum { IDD = IDD_FONTPROPERTIES };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CProp)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CProp)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_PROP_H__C7110B15_6EE9_4C65_BA2A_C25B74F090FF__INCLUDED_)
Binary file not shown.
@@ -0,0 +1,13 @@
//
// FONTEDIT.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////
Binary file not shown.
@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// fontedit.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
@@ -0,0 +1,7 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
@@ -0,0 +1,70 @@
// acwidths.cpp : implementation file
//
#include "stdafx.h"
#include "fontedit.h"
#include "acwidths.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ACWidths dialog
ACWidths::ACWidths(CWnd* pParent /*=NULL*/)
: CDialog(ACWidths::IDD, pParent)
{
//{{AFX_DATA_INIT(ACWidths)
m_AWidth = _T("");
m_CWidth = _T("");
//}}AFX_DATA_INIT
}
void ACWidths::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(ACWidths)
DDX_Text(pDX, IDC_AWIDTH, m_AWidth);
DDX_Text(pDX, IDC_CWIDTH, m_CWidth);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(ACWidths, CDialog)
//{{AFX_MSG_MAP(ACWidths)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// ACWidths message handlers
void ACWidths::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
nAWidth = atoi(m_AWidth);
nCWidth = atoi(m_CWidth);
CDialog::OnOK();
}
void ACWidths::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL ACWidths::OnInitDialog()
{
CDialog::OnInitDialog();
m_AWidth.Format("%d",nAWidth);
m_CWidth.Format("%d",nCWidth);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
@@ -0,0 +1,39 @@
// acwidths.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// ACWidths dialog
class ACWidths : public CDialog
{
// Construction
public:
ACWidths(CWnd* pParent = NULL); // standard constructor
int nAWidth;
int nCWidth;
// Dialog Data
//{{AFX_DATA(ACWidths)
enum { IDD = IDD_ACWIDTH };
CString m_AWidth;
CString m_CWidth;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(ACWidths)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(ACWidths)
virtual void OnOK();
virtual void OnCancel();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
+448
View File
@@ -0,0 +1,448 @@
#define DEF_CHAR 128
Char cmap_all[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
1,0,0,0,0, // 127 
1,0,0,0,0, // 128 €
1,0,0,0,0, // 129
1,0,0,0,0, // 130
1,0,0,0,0, // 131 ƒ
1,0,0,0,0, // 132 „
1,0,0,0,0, // 133 …
1,0,0,0,0, // 134 †
1,0,0,0,0, // 135 ‡
1,0,0,0,0, // 136 ˆ
1,0,0,0,0, // 137 ‰
1,0,0,0,0, // 138 Š
1,0,0,0,0, // 139
1,0,0,0,0, // 140 Œ
1,0,0,0,0, // 141
1,0,0,0,0, // 142 Ž
1,0,0,0,0, // 143
1,0,0,0,0, // 144
1,0,0,0,0, // 145
1,0,0,0,0, // 146
1,0,0,0,0, // 147 “
1,0,0,0,0, // 148 ”
1,0,0,0,0, // 149 •
1,0,0,0,0, // 150
1,0,0,0,0, // 151 —
1,0,0,0,0, // 152 ˜
1,0,0,0,0, // 153 ™
1,0,0,0,0, // 154 š
1,0,0,0,0, // 155
1,0,0,0,0, // 156 œ
1,0,0,0,0, // 157
1,0,0,0,0, // 158 ž
1,0,0,0,0, // 159 Ÿ
1,0,0,0,0, // 160  
1,0,0,0,0, // 161 ¡
1,0,0,0,0, // 162 ¢
1,0,0,0,0, // 163 £
1,0,0,0,0, // 164 ¤
1,0,0,0,0, // 165 ¥
1,0,0,0,0, // 166 ¦
1,0,0,0,0, // 167 §
1,0,0,0,0, // 168 ¨
1,0,0,0,0, // 169 ©
1,0,0,0,0, // 170 ª
1,0,0,0,0, // 171 «
1,0,0,0,0, // 172 ¬
1,0,0,0,0, // 173 ­
1,0,0,0,0, // 174 ®
1,0,0,0,0, // 175 ¯
1,0,0,0,0, // 176 °
1,0,0,0,0, // 177 ±
1,0,0,0,0, // 178 ²
1,0,0,0,0, // 179 ³
1,0,0,0,0, // 180 ´
1,0,0,0,0, // 181 µ
1,0,0,0,0, // 182 ¶
1,0,0,0,0, // 183 ·
1,0,0,0,0, // 184 ¸
1,0,0,0,0, // 185 ¹
1,0,0,0,0, // 186 º
1,0,0,0,0, // 187 »
1,0,0,0,0, // 188 ¼
1,0,0,0,0, // 189 ½
1,0,0,0,0, // 190 ¾
1,0,0,0,0, // 191 µ
1,0,0,0,0, // 192 À
1,0,0,0,0, // 193 Á
1,0,0,0,0, // 194 Â
1,0,0,0,0, // 195 Ã
1,0,0,0,0, // 196 Ä
1,0,0,0,0, // 197 Å
1,0,0,0,0, // 198 Æ
1,0,0,0,0, // 199 Ç
1,0,0,0,0, // 200 È
1,0,0,0,0, // 201 É
1,0,0,0,0, // 202 Ê
1,0,0,0,0, // 203 Ë
1,0,0,0,0, // 204 Ì
1,0,0,0,0, // 205 Í
1,0,0,0,0, // 206 Î
1,0,0,0,0, // 207 Ï
1,0,0,0,0, // 208 Ð
1,0,0,0,0, // 209 Ñ
1,0,0,0,0, // 210 Ò
1,0,0,0,0, // 211 Ó
1,0,0,0,0, // 212 Ô
1,0,0,0,0, // 213 Õ
1,0,0,0,0, // 214 Ö
1,0,0,0,0, // 215 ×
1,0,0,0,0, // 216 Ø
1,0,0,0,0, // 217 Ù
1,0,0,0,0, // 218 Ú
1,0,0,0,0, // 219 Û
1,0,0,0,0, // 220 Ü
1,0,0,0,0, // 221 Ý
1,0,0,0,0, // 222 Þ
1,0,0,0,0, // 223 ß
1,0,0,0,0, // 224 à
1,0,0,0,0, // 225 á
1,0,0,0,0, // 226 â
1,0,0,0,0, // 227 ã
1,0,0,0,0, // 228 ä
1,0,0,0,0, // 229 å
1,0,0,0,0, // 230 æ
1,0,0,0,0, // 231 ç
1,0,0,0,0, // 232 è
1,0,0,0,0, // 233 é
1,0,0,0,0, // 234 ê
1,0,0,0,0, // 235 ë
1,0,0,0,0, // 236 ì
1,0,0,0,0, // 237 í
1,0,0,0,0, // 238 î
1,0,0,0,0, // 239 ï
1,0,0,0,0, // 240 ð
1,0,0,0,0, // 241 ñ
1,0,0,0,0, // 242 ò
1,0,0,0,0, // 243 ó
1,0,0,0,0, // 244 ô
1,0,0,0,0, // 245 õ
1,0,0,0,0, // 246 ö
1,0,0,0,0, // 247 ÷
1,0,0,0,0, // 248 ø
1,0,0,0,0, // 249 ù
1,0,0,0,0, // 250 ú
1,0,0,0,0, // 251 û
1,0,0,0,0, // 252 ü
1,0,0,0,0, // 253 ý
1,0,0,0,0, // 254 þ
1,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,448 @@
#define DEF_CHAR 128
Char cmap_alphaonly[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
0,0,0,0,0, // 033 !
0,0,0,0,0, // 034 "
0,0,0,0,0, // 035 #
0,0,0,0,0, // 036 $
0,0,0,0,0, // 037 %
0,0,0,0,0, // 038 &
0,0,0,0,0, // 039 '
0,0,0,0,0, // 040 (
0,0,0,0,0, // 041 )
0,0,0,0,0, // 042 *
0,0,0,0,0, // 043 +
0,0,0,0,0, // 044 ,
0,0,0,0,0, // 045 -
0,0,0,0,0, // 046 .
0,0,0,0,0, // 047 /
0,0,0,0,0, // 048 0
0,0,0,0,0, // 049 1
0,0,0,0,0, // 040 2
0,0,0,0,0, // 051 3
0,0,0,0,0, // 052 4
0,0,0,0,0, // 053 5
0,0,0,0,0, // 054 6
0,0,0,0,0, // 055 7
0,0,0,0,0, // 056 8
0,0,0,0,0, // 057 9
0,0,0,0,0, // 058 :
0,0,0,0,0, // 059 ;
0,0,0,0,0, // 060 <
0,0,0,0,0, // 061 =
0,0,0,0,0, // 062 >
0,0,0,0,0, // 063 ?
0,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
0,0,0,0,0, // 091 [
0,0,0,0,0, // 092 "\"
0,0,0,0,0, // 093 ]
0,0,0,0,0, // 094 ^
0,0,0,0,0, // 095 _
0,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
0,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
0,0,0,0,0, // 125 }
0,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
0,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
0,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
0,0,0,0,0, // 145
0,0,0,0,0, // 146
0,0,0,0,0, // 147 “
0,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
0,0,0,0,0, // 154 š
0,0,0,0,0, // 155
0,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
0,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
0,0,0,0,0, // 161 ¡
0,0,0,0,0, // 162 ¢
0,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
0,0,0,0,0, // 165 ¥
0,0,0,0,0, // 166 ¦
0,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
0,0,0,0,0, // 169 ©
0,0,0,0,0, // 170 ª
0,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
0,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
0,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
0,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
0,0,0,0,0, // 186 º
0,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
0,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
0,0,0,0,0, // 191 µ
1,0,0,0,0, // 192 À
1,0,0,0,0, // 193 Á
1,0,0,0,0, // 194 Â
1,0,0,0,0, // 195 Ã
1,0,0,0,0, // 196 Ä
1,0,0,0,0, // 197 Å
1,0,0,0,0, // 198 Æ
1,0,0,0,0, // 199 Ç
1,0,0,0,0, // 200 È
1,0,0,0,0, // 201 É
1,0,0,0,0, // 202 Ê
1,0,0,0,0, // 203 Ë
1,0,0,0,0, // 204 Ì
1,0,0,0,0, // 205 Í
1,0,0,0,0, // 206 Î
1,0,0,0,0, // 207 Ï
1,0,0,0,0, // 208 Ð
1,0,0,0,0, // 209 Ñ
1,0,0,0,0, // 210 Ò
1,0,0,0,0, // 211 Ó
1,0,0,0,0, // 212 Ô
1,0,0,0,0, // 213 Õ
1,0,0,0,0, // 214 Ö
0,0,0,0,0, // 215 ×
1,0,0,0,0, // 216 Ø
1,0,0,0,0, // 217 Ù
1,0,0,0,0, // 218 Ú
1,0,0,0,0, // 219 Û
1,0,0,0,0, // 220 Ü
1,0,0,0,0, // 221 Ý
1,0,0,0,0, // 222 Þ
1,0,0,0,0, // 223 ß
1,0,0,0,0, // 224 à
1,0,0,0,0, // 225 á
1,0,0,0,0, // 226 â
1,0,0,0,0, // 227 ã
1,0,0,0,0, // 228 ä
1,0,0,0,0, // 229 å
1,0,0,0,0, // 230 æ
1,0,0,0,0, // 231 ç
1,0,0,0,0, // 232 è
1,0,0,0,0, // 233 é
1,0,0,0,0, // 234 ê
1,0,0,0,0, // 235 ë
1,0,0,0,0, // 236 ì
1,0,0,0,0, // 237 í
1,0,0,0,0, // 238 î
1,0,0,0,0, // 239 ï
1,0,0,0,0, // 240 ð
1,0,0,0,0, // 241 ñ
1,0,0,0,0, // 242 ò
1,0,0,0,0, // 243 ó
1,0,0,0,0, // 244 ô
1,0,0,0,0, // 245 õ
1,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
1,0,0,0,0, // 248 ø
1,0,0,0,0, // 249 ù
1,0,0,0,0, // 250 ú
1,0,0,0,0, // 251 û
1,0,0,0,0, // 252 ü
1,0,0,0,0, // 253 ý
1,0,0,0,0, // 254 þ
1,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,448 @@
#define DEF_CHAR 128
Char cmap_clubs[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
0,0,0,0,0, // 032 space
0,0,0,0,0, // 033 !
0,0,0,0,0, // 034 "
0,0,0,0,0, // 035 #
0,0,0,0,0, // 036 $
0,0,0,0,0, // 037 %
0,0,0,0,0, // 038 &
0,0,0,0,0, // 039 '
0,0,0,0,0, // 040 (
0,0,0,0,0, // 041 )
0,0,0,0,0, // 042 *
0,0,0,0,0, // 043 +
0,0,0,0,0, // 044 ,
0,0,0,0,0, // 045 -
0,0,0,0,0, // 046 .
0,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
0,0,0,0,0, // 058 :
0,0,0,0,0, // 059 ;
0,0,0,0,0, // 060 <
0,0,0,0,0, // 061 =
0,0,0,0,0, // 062 >
0,0,0,0,0, // 063 ?
0,0,0,0,0, // 064 @
0,0,0,0,0, // 065 A
0,0,0,0,0, // 066 B
0,0,0,0,0, // 067 C
0,0,0,0,0, // 068 D
0,0,0,0,0, // 069 E
0,0,0,0,0, // 070 F
0,0,0,0,0, // 071 G
0,0,0,0,0, // 072 H
0,0,0,0,0, // 073 I
0,0,0,0,0, // 074 J
0,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
0,0,0,0,0, // 077 M
0,0,0,0,0, // 078 N
0,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
0,0,0,0,0, // 081 Q
0,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
0,0,0,0,0, // 084 T
0,0,0,0,0, // 085 U
0,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
0,0,0,0,0, // 088 X
0,0,0,0,0, // 089 Y
0,0,0,0,0, // 090 Z
0,0,0,0,0, // 091 [
0,0,0,0,0, // 092 "\"
0,0,0,0,0, // 093 ]
0,0,0,0,0, // 094 ^
0,0,0,0,0, // 095 _
0,0,0,0,0, // 096 `
0,0,0,0,0, // 097 a
0,0,0,0,0, // 098 b
0,0,0,0,0, // 099 c
0,0,0,0,0, // 100 d
0,0,0,0,0, // 101 e
0,0,0,0,0, // 102 f
0,0,0,0,0, // 103 g
0,0,0,0,0, // 104 h
0,0,0,0,0, // 105 i
0,0,0,0,0, // 106 j
0,0,0,0,0, // 107 k
0,0,0,0,0, // 108 l
0,0,0,0,0, // 109 m
0,0,0,0,0, // 100 n
0,0,0,0,0, // 111 o
0,0,0,0,0, // 112 p
0,0,0,0,0, // 113 q
0,0,0,0,0, // 114 r
0,0,0,0,0, // 115 s
0,0,0,0,0, // 116 t
0,0,0,0,0, // 117 u
0,0,0,0,0, // 118 v
0,0,0,0,0, // 119 w
0,0,0,0,0, // 110 x
0,0,0,0,0, // 121 y
0,0,0,0,0, // 122 z
0,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
0,0,0,0,0, // 125 }
0,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
0,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
0,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
0,0,0,0,0, // 145
0,0,0,0,0, // 146
0,0,0,0,0, // 147 “
0,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
0,0,0,0,0, // 154 š
0,0,0,0,0, // 155
0,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
0,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
0,0,0,0,0, // 161 ¡
0,0,0,0,0, // 162 ¢
0,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
0,0,0,0,0, // 165 ¥
0,0,0,0,0, // 166 ¦
0,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
0,0,0,0,0, // 169 ©
0,0,0,0,0, // 170 ª
0,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
0,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
0,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
0,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
0,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
0,0,0,0,0, // 186 º
0,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
0,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
0,0,0,0,0, // 191 µ
0,0,0,0,0, // 192 À
0,0,0,0,0, // 193 Á
0,0,0,0,0, // 194 Â
0,0,0,0,0, // 195 Ã
0,0,0,0,0, // 196 Ä
0,0,0,0,0, // 197 Å
0,0,0,0,0, // 198 Æ
0,0,0,0,0, // 199 Ç
0,0,0,0,0, // 200 È
0,0,0,0,0, // 201 É
0,0,0,0,0, // 202 Ê
0,0,0,0,0, // 203 Ë
0,0,0,0,0, // 204 Ì
0,0,0,0,0, // 205 Í
0,0,0,0,0, // 206 Î
0,0,0,0,0, // 207 Ï
0,0,0,0,0, // 208 Ð
0,0,0,0,0, // 209 Ñ
0,0,0,0,0, // 210 Ò
0,0,0,0,0, // 211 Ó
0,0,0,0,0, // 212 Ô
0,0,0,0,0, // 213 Õ
0,0,0,0,0, // 214 Ö
0,0,0,0,0, // 215 ×
0,0,0,0,0, // 216 Ø
0,0,0,0,0, // 217 Ù
0,0,0,0,0, // 218 Ú
0,0,0,0,0, // 219 Û
0,0,0,0,0, // 220 Ü
0,0,0,0,0, // 221 Ý
0,0,0,0,0, // 222 Þ
0,0,0,0,0, // 223 ß
0,0,0,0,0, // 224 à
0,0,0,0,0, // 225 á
0,0,0,0,0, // 226 â
0,0,0,0,0, // 227 ã
0,0,0,0,0, // 228 ä
0,0,0,0,0, // 229 å
0,0,0,0,0, // 230 æ
0,0,0,0,0, // 231 ç
0,0,0,0,0, // 232 è
0,0,0,0,0, // 233 é
0,0,0,0,0, // 234 ê
0,0,0,0,0, // 235 ë
0,0,0,0,0, // 236 ì
0,0,0,0,0, // 237 í
0,0,0,0,0, // 238 î
0,0,0,0,0, // 239 ï
0,0,0,0,0, // 240 ð
0,0,0,0,0, // 241 ñ
0,0,0,0,0, // 242 ò
0,0,0,0,0, // 243 ó
0,0,0,0,0, // 244 ô
0,0,0,0,0, // 245 õ
0,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
0,0,0,0,0, // 248 ø
0,0,0,0,0, // 249 ù
0,0,0,0,0, // 250 ú
0,0,0,0,0, // 251 û
0,0,0,0,0, // 252 ü
0,0,0,0,0, // 253 ý
0,0,0,0,0, // 254 þ
0,0,0,0,0 // 255 ÿ
};
Binary file not shown.
@@ -0,0 +1,262 @@
# Microsoft Developer Studio Project File - Name="Fontedit" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=Fontedit - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "fontedit.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fontedit.mak" CFG="Fontedit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Fontedit - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "Fontedit - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Fontedit - Win32 Debug"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\WinDebug"
# PROP BASE Intermediate_Dir ".\WinDebug"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../../../dbg.bin"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# ADD BASE CPP /nologo /MT /W3 /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp1 /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD MTL /mktyplib203
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\WinRel"
# PROP BASE Intermediate_Dir ".\WinRel"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "../../../rel.bin"
# PROP Intermediate_Dir "Release"
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD MTL /mktyplib203
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "Fontedit - Win32 Debug"
# Name "Fontedit - Win32 Release"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\acwidths.cpp
# End Source File
# Begin Source File
SOURCE=.\ChooseDir.cpp
# End Source File
# Begin Source File
SOURCE=.\DeltaSpace.cpp
# End Source File
# Begin Source File
SOURCE=.\ExportTextures.cpp
# End Source File
# Begin Source File
SOURCE=.\FONT.CPP
# End Source File
# Begin Source File
SOURCE=.\FONTEDIT.CPP
# End Source File
# Begin Source File
SOURCE=.\FONTEDIT.RC
# End Source File
# Begin Source File
SOURCE=.\FONTEDOC.CPP
# End Source File
# Begin Source File
SOURCE=.\fontevw.cpp
# End Source File
# Begin Source File
SOURCE=.\FontProperties.cpp
# End Source File
# Begin Source File
SOURCE=.\lz.cpp
# End Source File
# Begin Source File
SOURCE=.\MAINFRM.CPP
# End Source File
# Begin Source File
SOURCE=.\README.TXT
# End Source File
# Begin Source File
SOURCE=.\STDAFX.CPP
# ADD BASE CPP /Yc"stdafx.h"
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\acwidths.h
# End Source File
# Begin Source File
SOURCE=.\all.h
# End Source File
# Begin Source File
SOURCE=.\alphaonly.h
# End Source File
# Begin Source File
SOURCE=.\ChooseDir.h
# End Source File
# Begin Source File
SOURCE=.\clubs.h
# End Source File
# Begin Source File
SOURCE=.\DeltaSpace.h
# End Source File
# Begin Source File
SOURCE=.\ENGLISH.H
# End Source File
# Begin Source File
SOURCE=.\ExportTextures.h
# End Source File
# Begin Source File
SOURCE=.\FONT.H
# End Source File
# Begin Source File
SOURCE=.\FONTEDIT.H
# End Source File
# Begin Source File
SOURCE=.\FONTEDOC.H
# End Source File
# Begin Source File
SOURCE=.\fontevw.h
# End Source File
# Begin Source File
SOURCE=.\FontProperties.h
# End Source File
# Begin Source File
SOURCE=.\FontProperties1.h
# End Source File
# Begin Source File
SOURCE=.\foreign.h
# End Source File
# Begin Source File
SOURCE=.\GLOBALS.H
# End Source File
# Begin Source File
SOURCE=.\lz.h
# End Source File
# Begin Source File
SOURCE=.\mac.h
# End Source File
# Begin Source File
SOURCE=.\MAINFRM.H
# End Source File
# Begin Source File
SOURCE=.\Prop.h
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\STDAFX.H
# End Source File
# Begin Source File
SOURCE=.\targa.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\RES\FONTEDIT.ICO
# End Source File
# Begin Source File
SOURCE=.\RES\FONTEDIT.RC2
# End Source File
# Begin Source File
SOURCE=.\RES\TOOLBAR.BMP
# End Source File
# End Group
# End Target
# End Project
@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Fontedit"=.\fontedit.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,414 @@
# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
!IF "$(CFG)" == ""
CFG=Fontedit - Win32 Debug
!MESSAGE No configuration specified. Defaulting to Fontedit - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "Fontedit - Win32 Debug" && "$(CFG)" !=\
"Fontedit - Win32 Release"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fontedit.mak" CFG="Fontedit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Fontedit - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "Fontedit - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
################################################################################
# Begin Project
# PROP Target_Last_Scanned "Fontedit - Win32 Debug"
MTL=mktyplib.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "Fontedit - Win32 Debug"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "WinDebug"
# PROP BASE Intermediate_Dir "WinDebug"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "WinDebug"
# PROP Intermediate_Dir "WinDebug"
OUTDIR=.\WinDebug
INTDIR=.\WinDebug
ALL : "$(OUTDIR)\fontedit.exe"
CLEAN :
-@erase "$(INTDIR)\acwidths.obj"
-@erase "$(INTDIR)\DeltaSpace.obj"
-@erase "$(INTDIR)\FONT.OBJ"
-@erase "$(INTDIR)\FONTEDIT.OBJ"
-@erase "$(INTDIR)\fontedit.pch"
-@erase "$(INTDIR)\FONTEDIT.res"
-@erase "$(INTDIR)\FONTEDOC.OBJ"
-@erase "$(INTDIR)\fontevw.obj"
-@erase "$(INTDIR)\MAINFRM.OBJ"
-@erase "$(INTDIR)\STDAFX.OBJ"
-@erase "$(INTDIR)\vc40.idb"
-@erase "$(INTDIR)\vc40.pdb"
-@erase "$(OUTDIR)\fontedit.exe"
-@erase "$(OUTDIR)\fontedit.ilk"
-@erase "$(OUTDIR)\fontedit.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MT /W3 /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp1 /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
# SUBTRACT CPP /Fr
CPP_PROJ=/nologo /Zp1 /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D\
"_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
CPP_OBJS=.\WinDebug/
CPP_SBRS=.\.
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/FONTEDIT.res" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/fontedit.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)/fontedit.pdb" /debug /machine:I386\
/out:"$(OUTDIR)/fontedit.exe"
LINK32_OBJS= \
"$(INTDIR)\acwidths.obj" \
"$(INTDIR)\DeltaSpace.obj" \
"$(INTDIR)\FONT.OBJ" \
"$(INTDIR)\FONTEDIT.OBJ" \
"$(INTDIR)\FONTEDIT.res" \
"$(INTDIR)\FONTEDOC.OBJ" \
"$(INTDIR)\fontevw.obj" \
"$(INTDIR)\MAINFRM.OBJ" \
"$(INTDIR)\STDAFX.OBJ"
"$(OUTDIR)\fontedit.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
# PROP BASE Use_MFC 5
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "WinRel"
# PROP BASE Intermediate_Dir "WinRel"
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "WinRel"
# PROP Intermediate_Dir "WinRel"
OUTDIR=.\WinRel
INTDIR=.\WinRel
ALL : "$(OUTDIR)\fontedit.exe"
CLEAN :
-@erase "$(INTDIR)\acwidths.obj"
-@erase "$(INTDIR)\DeltaSpace.obj"
-@erase "$(INTDIR)\FONT.OBJ"
-@erase "$(INTDIR)\FONTEDIT.OBJ"
-@erase "$(INTDIR)\fontedit.pch"
-@erase "$(INTDIR)\FONTEDIT.res"
-@erase "$(INTDIR)\FONTEDOC.OBJ"
-@erase "$(INTDIR)\fontevw.obj"
-@erase "$(INTDIR)\MAINFRM.OBJ"
-@erase "$(INTDIR)\STDAFX.OBJ"
-@erase "$(OUTDIR)\fontedit.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /c
# ADD CPP /nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
# SUBTRACT CPP /Fr
CPP_PROJ=/nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
"_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
CPP_OBJS=.\WinRel/
CPP_SBRS=.\.
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)/FONTEDIT.res" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
BSC32_FLAGS=/nologo /o"$(OUTDIR)/fontedit.bsc"
BSC32_SBRS= \
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)/fontedit.pdb" /machine:I386 /out:"$(OUTDIR)/fontedit.exe"
LINK32_OBJS= \
"$(INTDIR)\acwidths.obj" \
"$(INTDIR)\DeltaSpace.obj" \
"$(INTDIR)\FONT.OBJ" \
"$(INTDIR)\FONTEDIT.OBJ" \
"$(INTDIR)\FONTEDIT.res" \
"$(INTDIR)\FONTEDOC.OBJ" \
"$(INTDIR)\fontevw.obj" \
"$(INTDIR)\MAINFRM.OBJ" \
"$(INTDIR)\STDAFX.OBJ"
"$(OUTDIR)\fontedit.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
MTL_PROJ=
.c{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_OBJS)}.obj:
$(CPP) $(CPP_PROJ) $<
.c{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cpp{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
.cxx{$(CPP_SBRS)}.sbr:
$(CPP) $(CPP_PROJ) $<
################################################################################
# Begin Target
# Name "Fontedit - Win32 Debug"
# Name "Fontedit - Win32 Release"
!IF "$(CFG)" == "Fontedit - Win32 Debug"
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
!ENDIF
################################################################################
# Begin Source File
SOURCE=.\STDAFX.CPP
DEP_CPP_STDAF=\
".\STDAFX.H"\
!IF "$(CFG)" == "Fontedit - Win32 Debug"
# ADD BASE CPP /Yc"stdafx.h"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /Zp1 /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D\
"_WINDOWS" /D "_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c $(SOURCE) \
"$(INTDIR)\STDAFX.OBJ" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\fontedit.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
# ADD BASE CPP /Yc"stdafx.h"
# ADD CPP /Yc"stdafx.h"
BuildCmds= \
$(CPP) /nologo /Zp1 /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
"_MBCS" /Fp"$(INTDIR)/fontedit.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
"$(INTDIR)\STDAFX.OBJ" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
"$(INTDIR)\fontedit.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
$(BuildCmds)
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONTEDIT.CPP
DEP_CPP_FONTE=\
".\FONTEDIT.H"\
".\FONTEDOC.H"\
".\fontevw.h"\
".\GLOBALS.H"\
".\MAINFRM.H"\
".\STDAFX.H"\
"$(INTDIR)\FONTEDIT.OBJ" : $(SOURCE) $(DEP_CPP_FONTE) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\MAINFRM.CPP
DEP_CPP_MAINF=\
".\FONTEDIT.H"\
".\GLOBALS.H"\
".\MAINFRM.H"\
".\STDAFX.H"\
"$(INTDIR)\MAINFRM.OBJ" : $(SOURCE) $(DEP_CPP_MAINF) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONTEDOC.CPP
DEP_CPP_FONTED=\
".\FONT.H"\
".\FONTEDIT.H"\
".\FONTEDOC.H"\
".\fontevw.h"\
".\GLOBALS.H"\
".\MAINFRM.H"\
".\STDAFX.H"\
"$(INTDIR)\FONTEDOC.OBJ" : $(SOURCE) $(DEP_CPP_FONTED) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\fontevw.cpp
DEP_CPP_FONTEV=\
".\acwidths.h"\
".\DeltaSpace.h"\
".\FONTEDIT.H"\
".\FONTEDOC.H"\
".\fontevw.h"\
".\GLOBALS.H"\
".\STDAFX.H"\
"$(INTDIR)\fontevw.obj" : $(SOURCE) $(DEP_CPP_FONTEV) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONTEDIT.RC
DEP_RSC_FONTEDI=\
".\RES\FONTEDIT.ICO"\
".\RES\FONTEDIT.RC2"\
".\RES\TOOLBAR.BMP"\
"$(INTDIR)\FONTEDIT.res" : $(SOURCE) $(DEP_RSC_FONTEDI) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
# End Source File
################################################################################
# Begin Source File
SOURCE=.\README.TXT
!IF "$(CFG)" == "Fontedit - Win32 Debug"
!ELSEIF "$(CFG)" == "Fontedit - Win32 Release"
!ENDIF
# End Source File
################################################################################
# Begin Source File
SOURCE=.\FONT.CPP
DEP_CPP_FONT_=\
".\all.h"\
".\clubs.h"\
".\ENGLISH.H"\
".\fontevw.h"\
".\foreign.h"\
".\GLOBALS.H"\
".\mac.h"\
".\STDAFX.H"\
"$(INTDIR)\FONT.OBJ" : $(SOURCE) $(DEP_CPP_FONT_) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\acwidths.cpp
DEP_CPP_ACWID=\
".\acwidths.h"\
".\FONTEDIT.H"\
".\STDAFX.H"\
"$(INTDIR)\acwidths.obj" : $(SOURCE) $(DEP_CPP_ACWID) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
################################################################################
# Begin Source File
SOURCE=.\DeltaSpace.cpp
DEP_CPP_DELTA=\
".\DeltaSpace.h"\
".\FONTEDIT.H"\
".\STDAFX.H"\
"$(INTDIR)\DeltaSpace.obj" : $(SOURCE) $(DEP_CPP_DELTA) "$(INTDIR)"\
"$(INTDIR)\fontedit.pch"
# End Source File
# End Target
# End Project
################################################################################
@@ -0,0 +1,601 @@
// fontevw.cpp : implementation of the CFonteditView class
//
#include "stdafx.h"
#include "globals.h"
#include "fontedit.h"
#include "fontedoc.h"
#include "fontevw.h"
#include "acwidths.h"
#include "deltaspace.h"
#include "fontproperties.h"
#include "font.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFonteditView
IMPLEMENT_DYNCREATE(CFonteditView, CView)
BEGIN_MESSAGE_MAP(CFonteditView, CView)
//{{AFX_MSG_MAP(CFonteditView)
ON_COMMAND(ID_IMAGE_NEXT, OnImageNext)
ON_COMMAND(ID_IMAGE_PREV, OnImagePrev)
ON_COMMAND(ID_IMAGE_ZOOMIN, OnImageZoomin)
ON_COMMAND(ID_IMAGE_ZOOMOUT, OnImageZoomout)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_COMMAND(ID_IMAGE_UNDO, OnImageUndo)
ON_WM_CHAR()
ON_COMMAND(ID_OPTIONS_CLUBS, OnOptionsClubs)
ON_COMMAND(ID_OPTIONS_ENGLISH, OnOptionsEnglish)
ON_COMMAND(ID_OPTIONS_FOREIGN, OnOptionsForeign)
ON_COMMAND(ID_IMAGE_CHANGEACWIDTHS, OnImageChangeacwidths)
ON_COMMAND(ID_OPTIONS_MAC, OnOptionsMac)
ON_COMMAND(ID_OPTIONS_ALL, OnOptionsAll)
ON_COMMAND(IDM_GLOBALCHANGEAANDC, OnGlobalchangeaandc)
ON_COMMAND(IDM_VIEW_PROPERTIES, OnViewProperties)
ON_COMMAND(ID_OPTIONS_ALPHABETICCHARACTERSONLY, OnOptionsAlphabeticcharactersonly)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#define MAPHEIGHT 25
#define EDIT_OFFSET_X 0
#define EDIT_OFFSET_Y 35
#define GAP 10
#define SWIDTH 32
/////////////////////////////////////////////////////////////////////////////
// CFonteditView construction/destruction
CFonteditView::CFonteditView()
{
int n,m;
view = this;
nZoom = 5;
bCurChar = 65;
CurColor = 128;
bDownInColor = 0;
bDownInDraw = 0;
pWorkspace=0;
nWorkspaceSize = 0;
nWorkspaceWidth = 0;
nWorkspaceHeight = 0;
lp = (LOGPALETTE *)malloc(sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY)*256));
lp->palVersion = 0x300;
lp->palNumEntries = 256;
for (n=0; n<256; n++)
{
lp->palPalEntry[n].peRed = (BYTE)n;
lp->palPalEntry[n].peGreen = (BYTE)n;
lp->palPalEntry[n].peBlue = (BYTE)n;
lp->palPalEntry[n].peFlags = 0;
}
hPal = CreatePalette(lp);
bmi.bmiH.biSize = sizeof(bmi.bmiH);
bmi.bmiH.biPlanes = 1;
bmi.bmiH.biBitCount = 8;
bmi.bmiH.biCompression = BI_RGB;
bmi.bmiH.biSizeImage = 0;
bmi.bmiH.biClrUsed = 0;
bmi.bmiH.biClrImportant = 0;
for (n=0; n<256; n++)
{
bmi.colors.bmiC[n] = (WORD)n;
}
pScale = (BYTE *)malloc(MAPHEIGHT * 512);
pCurColor = (BYTE *)malloc(SWIDTH * SWIDTH);
memset(pCurColor,CurColor,SWIDTH*SWIDTH);
DWORD b;
for (n=0; n<256; n++)
{
b = n;
if (b>255)
b=255;
for (m=0; m<MAPHEIGHT; m++)
{
pScale[m*512 + n*2] = (BYTE)b;
pScale[m*512 + n*2 + 1] = (BYTE)b;
}
}
}
CFonteditView::~CFonteditView()
{
free(lp);
DeleteObject(hPal);
if (pWorkspace)
free(pWorkspace);
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditView drawing
void CFonteditView::OnDraw(CDC* pDC)
{
int nMainWidth;
int nMainHeight;
int nHeight;
int nWidth;
char szOut[256];
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!theFont)
return;
HPALETTE hOldPal = ::SelectPalette(pDC->m_hDC,hPal,FALSE);
RealizePalette(pDC->m_hDC);
// draw the grayscale gradient map of values to pick from
bmi.bmiH.biHeight = MAPHEIGHT;
bmi.bmiH.biWidth = 512;
HBRUSH hRedBrush= ::CreateSolidBrush(0x0000FF);
HBRUSH hOldBrush = (HBRUSH)::SelectObject(pDC->m_hDC,hRedBrush);
::PatBlt(pDC->m_hDC,0,0,518,MAPHEIGHT + 6,PATCOPY);
SetDIBitsToDevice(pDC->m_hDC,
3,
3,
512,
MAPHEIGHT,
0,0,
0,
MAPHEIGHT,
pScale,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS);
nWidth = nWorkspaceWidth;
nHeight = nWorkspaceHeight;
nMainWidth = theFont->GetCharWidth(bCurChar) * nZoom;
nMainHeight = theFont->GetCharHeight(bCurChar) * nZoom;
bmi.bmiH.biWidth = nWidth;
bmi.bmiH.biHeight = nHeight;
rCurChar.left = EDIT_OFFSET_X;
rCurChar.top = EDIT_OFFSET_Y;
rCurChar.right = rCurChar.left + theFont->GetCharWidth(bCurChar) * nZoom;
rCurChar.bottom = rCurChar.top + theFont->GetCharHeight(bCurChar) * nZoom;
if (!pWorkspace)
GetCurImage();
StretchDIBits(pDC->m_hDC,EDIT_OFFSET_X,EDIT_OFFSET_Y,
theFont->GetCharWidth(bCurChar) * nZoom,
theFont->GetCharHeight(bCurChar) * nZoom,
0,0,
theFont->GetCharWidth(bCurChar),
theFont->GetCharHeight(bCurChar),
pWorkspace,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS,
SRCCOPY);
rCurSmallChar.left = EDIT_OFFSET_X + nMainWidth + GAP;
rCurSmallChar.top = EDIT_OFFSET_Y;
rCurSmallChar.right = rCurSmallChar.left + theFont->GetCharWidth(bCurChar);
rCurSmallChar.bottom = rCurSmallChar.top + theFont->GetCharHeight(bCurChar);
SetDIBitsToDevice(pDC->m_hDC,
EDIT_OFFSET_X + nMainWidth + GAP,
EDIT_OFFSET_Y,
theFont->GetCharWidth(bCurChar),
theFont->GetCharHeight(bCurChar),
0,0,
0,
theFont->GetCharHeight(bCurChar),
pWorkspace,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS);
bmi.bmiH.biWidth = bmi.bmiH.biHeight = SWIDTH;
rCurColor.top = EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) + GAP;
rCurColor.left = EDIT_OFFSET_X + nMainWidth + GAP;
rCurColor.right = rCurColor.left + SWIDTH + SWIDTH + SWIDTH;
rCurColor.bottom = rCurColor.top + SWIDTH;
::PatBlt(pDC->m_hDC,rCurColor.left - 3,rCurColor.top - 3
,SWIDTH+6,SWIDTH+6,PATCOPY);
SetDIBitsToDevice(pDC->m_hDC,
EDIT_OFFSET_X + nMainWidth + GAP,
EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) + GAP,
SWIDTH,
SWIDTH,
0,0,
0,
SWIDTH,
pCurColor,
(BITMAPINFO *)&bmi,
DIB_PAL_COLORS);
wsprintf(szOut,"%d ",((int)CurColor)>>ALIAS_SHIFT);
pDC->TextOut(
EDIT_OFFSET_X + nMainWidth + GAP + SWIDTH + GAP,
EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) + GAP,
szOut,lstrlen(szOut));
wsprintf(szOut,"%c:%d ",bCurChar,(int)bCurChar);
pDC->TextOut(0,EDIT_OFFSET_Y + nMainHeight + GAP,szOut,lstrlen(szOut));
::SelectPalette(pDC->m_hDC,hOldPal,FALSE);
::SelectObject(pDC->m_hDC,hOldBrush);
::DeleteObject(hRedBrush);
int iTextureY = EDIT_OFFSET_Y + nMainHeight + GAP + 50;
int iTextureCount = theFont->GetTextureCount();
for (int i=0; i<iTextureCount; i++)
{
theFont->DrawTexture(pDC->m_hDC,i,i*260,iTextureY);
}
}
/////////////////////////////////////////////////////////////////////////////
// CFonteditView diagnostics
#ifdef _DEBUG
void CFonteditView::AssertValid() const
{
CView::AssertValid();
}
void CFonteditView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CFonteditDoc* CFonteditView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFonteditDoc)));
return (CFonteditDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFonteditView message handlers
void CFonteditView::NewFont(void)
{
GetCurImage();
}
void CFonteditView::UpdateFont(void)
{
SetCurImage();
}
void CFonteditView::OnImageNext()
{
if (!theFont)
return;
SetCurImage();
bCurChar++;
GetCurImage();
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnImagePrev()
{
if (!theFont)
return;
SetCurImage();
bCurChar--;
GetCurImage();
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnImageZoomin()
{
if (!theFont)
return;
if (nZoom <24)
nZoom++;
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnImageZoomout()
{
if (!theFont)
return;
if (nZoom > 1)
nZoom --;
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnMouseMove(UINT nFlags, CPoint point)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (bDownInColor && point.y > 3 && point.y <= 3 + MAPHEIGHT &&
point.x > 3 && point.x <= 515)
{
CurColor = (BYTE)((point.x - 3)/2);
memset(pCurColor,CurColor,SWIDTH * SWIDTH);
InvalidateRect(&rCurColor,FALSE);
}
if (bDownInDraw && point.y > EDIT_OFFSET_Y &&
point.y < EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) * nZoom &&
point.x > EDIT_OFFSET_X &&
point.x < EDIT_OFFSET_X + theFont->GetCharWidth(bCurChar) * nZoom)
{ // we're drawing on the bmp
bDownInDraw = 1;
point.y -= EDIT_OFFSET_Y;
point.x -= EDIT_OFFSET_X;
int x = point.x/nZoom;
int y = point.y/nZoom;
pWorkspace[(nWorkspaceHeight-1-y) * nWorkspaceWidth + x] = CurColor;
InvalidateRect(&rCurChar,FALSE);
InvalidateRect(&rCurSmallChar,FALSE);
return;
}
}
void CFonteditView::OnLButtonDown(UINT nFlags, CPoint point)
{
if (!theFont)
return;
GetCapture();
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (point.y > 3 && point.y <= 3 + MAPHEIGHT &&
point.x > 3 && point.x <= 515)
{
CurColor = (BYTE)((point.x - 3));
memset(pCurColor,CurColor,SWIDTH * SWIDTH);
InvalidateRect(&rCurColor,FALSE);
bDownInColor = TRUE;
return;
}
if (point.y > EDIT_OFFSET_Y &&
point.y < EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) * nZoom &&
point.x > EDIT_OFFSET_X &&
point.x < EDIT_OFFSET_X + theFont->GetCharWidth(bCurChar) * nZoom)
{ // we're drawing on the bmp
bDownInDraw = 1;
point.y -= EDIT_OFFSET_Y;
point.x -= EDIT_OFFSET_X;
int x = point.x/nZoom;
int y = point.y/nZoom;
pWorkspace[(nWorkspaceHeight-1-y) * nWorkspaceWidth + x] = CurColor;
InvalidateRect(&rCurChar,FALSE);
InvalidateRect(&rCurSmallChar,FALSE);
pDoc->SetModifiedFlag(TRUE);
return;
}
}
void CFonteditView::OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
bDownInColor = FALSE;
bDownInDraw = FALSE;
}
void CFonteditView::OnRButtonDown(UINT nFlags, CPoint point)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (point.y > EDIT_OFFSET_Y &&
point.y < EDIT_OFFSET_Y + theFont->GetCharHeight(bCurChar) * nZoom &&
point.x > EDIT_OFFSET_X &&
point.x < EDIT_OFFSET_X + theFont->GetCharWidth(bCurChar) * nZoom)
{ // we're drawing on the bmp
point.y -= EDIT_OFFSET_Y;
point.x -= EDIT_OFFSET_X;
int x = point.x/nZoom;
int y = point.y/nZoom;
CurColor = pWorkspace[(nWorkspaceHeight-1-y) * nWorkspaceWidth + x];
memset(pCurColor,CurColor,SWIDTH * SWIDTH);
InvalidateRect(&rCurColor,FALSE);
return;
}
}
void CFonteditView::GetCurImage(void)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int nHeight = theFont->GetCharHeight(bCurChar);
int nWidth = theFont->GetCharWidth(bCurChar);
int nInternalWidth = nWidth;
if (nInternalWidth & 0x3)
nInternalWidth += 4 - (nInternalWidth&0x03);
if (!pWorkspace || nWorkspaceSize < nInternalWidth * nHeight)
{
if (pWorkspace)
{
free(pWorkspace);
}
nWorkspaceSize = nInternalWidth * nHeight;
pWorkspace = (BYTE *)malloc(nWorkspaceSize);
}
memset(pWorkspace,0,nWorkspaceSize);
nWorkspaceWidth = nInternalWidth;
nWorkspaceHeight = nHeight;
BYTE *pSource = theFont->GetCharMap(bCurChar);
for (int n=0; n<nHeight; n++)
{ // flip the image to display DIB
memcpy(pWorkspace + (nHeight-1-n)*nInternalWidth,pSource + (n*nWidth),nWidth);
}
delete pSource;
}
void CFonteditView::SetCurImage(void)
{
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int nHeight = theFont->GetCharHeight(bCurChar);
int nWidth = theFont->GetCharWidth(bCurChar);
if (!pWorkspace)
return;
BYTE *pDest = new BYTE[nHeight * nWidth];
for (int n=0; n<nHeight; n++)
{ // flip the image to set back to font
memcpy(pDest + (n*nWidth),pWorkspace + (nHeight-1-n)*nWorkspaceWidth,nWidth);
}
theFont->SetCharMap(bCurChar,pDest);
delete pDest;
}
void CFonteditView::OnImageUndo()
{
if (!theFont)
return;
GetCurImage();
InvalidateRect(&rCurChar,FALSE);
InvalidateRect(&rCurSmallChar,FALSE);
}
void CFonteditView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CView::OnChar(nChar, nRepCnt, nFlags);
SetCurImage();
bCurChar = nChar;
GetCurImage();
InvalidateRect(NULL,TRUE);
}
void CFonteditView::OnOptionsClubs()
{
nLanguage = 1;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnOptionsEnglish()
{
nLanguage = 0;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnOptionsForeign()
{
nLanguage = 2;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnImageChangeacwidths()
{
if (!theFont)
return;
ACWidths dlg;
CFonteditDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
dlg.nAWidth = theFont->GetCharAWidth(bCurChar);
dlg.nCWidth = theFont->GetCharCWidth(bCurChar);
if (dlg.DoModal() != IDOK)
return;
theFont->SetCharAWidth(bCurChar,dlg.nAWidth);
theFont->SetCharCWidth(bCurChar,dlg.nCWidth);
}
void CFonteditView::OnOptionsMac()
{
nLanguage = 3;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_CHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_UNCHECKED);
}
void CFonteditView::OnOptionsAll()
{
nLanguage = 4;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_CLUBS,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ENGLISH,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_FOREIGN,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_MAC,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALL,MF_BYCOMMAND|MF_CHECKED);
}
void CFonteditView::OnGlobalchangeaandc()
{
if (!theFont)
return;
CDeltaSpace dlg;
if (dlg.DoModal()!= IDOK)
return;
CFonteditDoc* pDoc = GetDocument();
for (int n=0; n<256; n++)
{
int a = theFont->GetCharAWidth(n);
int c = theFont->GetCharCWidth(n);
theFont->SetCharAWidth(n,a + dlg.m_DeltaA);
theFont->SetCharCWidth(n,c + dlg.m_DeltaC);
}
}
void CFonteditView::OnViewProperties()
{
FontProperties dlg;
if (!theFont)
return;
dlg.DoModal();
}
void CFonteditView::OnOptionsAlphabeticcharactersonly()
{
if (nLanguage == 100)
{
nLanguage = 0;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALPHABETICCHARACTERSONLY,MF_BYCOMMAND|MF_UNCHECKED);
}
else
{
nLanguage = 100;
HMENU hMainMenu = ::GetMenu(AfxGetMainWnd()->m_hWnd);
HMENU hOptionsMenu = ::GetSubMenu(hMainMenu,3);
CheckMenuItem(hOptionsMenu,ID_OPTIONS_ALPHABETICCHARACTERSONLY,MF_BYCOMMAND|MF_CHECKED);
}
}
@@ -0,0 +1,90 @@
// fontevw.h : interface of the CFonteditView class
//
/////////////////////////////////////////////////////////////////////////////
class CFonteditView : public CView
{
protected: // create from serialization only
CFonteditView();
DECLARE_DYNCREATE(CFonteditView)
BYTE bCurChar;
int nZoom;
HPALETTE hPal;
LOGPALETTE *lp;
BYTE *pWorkspace;
int nWorkspaceSize;
int nWorkspaceWidth;
int nWorkspaceHeight;
BitMapInfo bmi;
BYTE *pScale;
BYTE *pCurColor;
BYTE CurColor;
RECT rCurColor;
RECT rCurChar;
RECT rCurSmallChar;
BOOL bDownInColor;
BOOL bDownInDraw;
bool bForce256x256;
void GetCurImage(void);
void SetCurImage(void);
// Attributes
public:
CFonteditDoc* GetDocument();
void NewFont(void);
void UpdateFont(void);
BYTE CurrChar(void) {return bCurChar;}
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFonteditView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CFonteditView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFonteditView)
afx_msg void OnImageNext();
afx_msg void OnImagePrev();
afx_msg void OnImageZoomin();
afx_msg void OnImageZoomout();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnImageUndo();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnOptionsClubs();
afx_msg void OnOptionsEnglish();
afx_msg void OnOptionsForeign();
afx_msg void OnImageChangeacwidths();
afx_msg void OnOptionsMac();
afx_msg void OnOptionsAll();
afx_msg void OnGlobalchangeaandc();
afx_msg void OnViewProperties();
afx_msg void OnOptionsAlphabeticcharactersonly();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in fontevw.cpp
inline CFonteditDoc* CFonteditView::GetDocument()
{ return (CFonteditDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,448 @@
#define DEF_CHAR 128
Char cmap_foreign[256] =
{
1,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
0,0,0,0,0, // 017
0,0,0,0,0, // 018
0,0,0,0,0, // 019
0,0,0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
0,0,0,0,0, // 128 €
0,0,0,0,0, // 129
0,0,0,0,0, // 130
0,0,0,0,0, // 131 ƒ
0,0,0,0,0, // 132 „
0,0,0,0,0, // 133 …
0,0,0,0,0, // 134 †
0,0,0,0,0, // 135 ‡
0,0,0,0,0, // 136 ˆ
0,0,0,0,0, // 137 ‰
1,0,0,0,0, // 138 Š
0,0,0,0,0, // 139
1,0,0,0,0, // 140 Œ
0,0,0,0,0, // 141
0,0,0,0,0, // 142 Ž
0,0,0,0,0, // 143
0,0,0,0,0, // 144
1,0,0,0,0, // 145
0,0,0,0,0, // 146
0,0,0,0,0, // 147 “
0,0,0,0,0, // 148 ”
0,0,0,0,0, // 149 •
0,0,0,0,0, // 150
0,0,0,0,0, // 151 —
0,0,0,0,0, // 152 ˜
0,0,0,0,0, // 153 ™
1,0,0,0,0, // 154 š
0,0,0,0,0, // 155
1,0,0,0,0, // 156 œ
0,0,0,0,0, // 157
0,0,0,0,0, // 158 ž
1,0,0,0,0, // 159 Ÿ
0,0,0,0,0, // 160  
1,0,0,0,0, // 161 ¡
1,0,0,0,0, // 162 ¢
1,0,0,0,0, // 163 £
0,0,0,0,0, // 164 ¤
1,0,0,0,0, // 165 ¥
1,0,0,0,0, // 166 ¦
1,0,0,0,0, // 167 §
0,0,0,0,0, // 168 ¨
1,0,0,0,0, // 169 ©
1,0,0,0,0, // 170 ª
1,0,0,0,0, // 171 «
0,0,0,0,0, // 172 ¬
0,0,0,0,0, // 173 ­
1,0,0,0,0, // 174 ®
0,0,0,0,0, // 175 ¯
1,0,0,0,0, // 176 °
0,0,0,0,0, // 177 ±
1,0,0,0,0, // 178 ²
0,0,0,0,0, // 179 ³
0,0,0,0,0, // 180 ´
1,0,0,0,0, // 181 µ
0,0,0,0,0, // 182 ¶
0,0,0,0,0, // 183 ·
0,0,0,0,0, // 184 ¸
0,0,0,0,0, // 185 ¹
1,0,0,0,0, // 186 º
1,0,0,0,0, // 187 »
0,0,0,0,0, // 188 ¼
1,0,0,0,0, // 189 ½
0,0,0,0,0, // 190 ¾
1,0,0,0,0, // 191 µ
1,0,0,0,0, // 192 À
1,0,0,0,0, // 193 Á
1,0,0,0,0, // 194 Â
1,0,0,0,0, // 195 Ã
1,0,0,0,0, // 196 Ä
1,0,0,0,0, // 197 Å
1,0,0,0,0, // 198 Æ
1,0,0,0,0, // 199 Ç
1,0,0,0,0, // 200 È
1,0,0,0,0, // 201 É
1,0,0,0,0, // 202 Ê
1,0,0,0,0, // 203 Ë
1,0,0,0,0, // 204 Ì
1,0,0,0,0, // 205 Í
1,0,0,0,0, // 206 Î
1,0,0,0,0, // 207 Ï
1,0,0,0,0, // 208 Ð
1,0,0,0,0, // 209 Ñ
1,0,0,0,0, // 210 Ò
1,0,0,0,0, // 211 Ó
1,0,0,0,0, // 212 Ô
1,0,0,0,0, // 213 Õ
1,0,0,0,0, // 214 Ö
1,0,0,0,0, // 215 ×
1,0,0,0,0, // 216 Ø
1,0,0,0,0, // 217 Ù
1,0,0,0,0, // 218 Ú
1,0,0,0,0, // 219 Û
1,0,0,0,0, // 220 Ü
1,0,0,0,0, // 221 Ý
1,0,0,0,0, // 222 Þ
1,0,0,0,0, // 223 ß
1,0,0,0,0, // 224 à
1,0,0,0,0, // 225 á
1,0,0,0,0, // 226 â
1,0,0,0,0, // 227 ã
1,0,0,0,0, // 228 ä
1,0,0,0,0, // 229 å
1,0,0,0,0, // 230 æ
1,0,0,0,0, // 231 ç
1,0,0,0,0, // 232 è
1,0,0,0,0, // 233 é
1,0,0,0,0, // 234 ê
1,0,0,0,0, // 235 ë
1,0,0,0,0, // 236 ì
1,0,0,0,0, // 237 í
1,0,0,0,0, // 238 î
1,0,0,0,0, // 239 ï
1,0,0,0,0, // 240 ð
1,0,0,0,0, // 241 ñ
1,0,0,0,0, // 242 ò
1,0,0,0,0, // 243 ó
1,0,0,0,0, // 244 ô
1,0,0,0,0, // 245 õ
1,0,0,0,0, // 246 ö
1,0,0,0,0, // 247 ÷
1,0,0,0,0, // 248 ø
1,0,0,0,0, // 249 ù
1,0,0,0,0, // 250 ú
1,0,0,0,0, // 251 û
1,0,0,0,0, // 252 ü
1,0,0,0,0, // 253 ý
1,0,0,0,0, // 254 þ
1,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,437 @@
// THIS CODE IS COPYRIGHT ACCESS SOFTWARE INC. ALL RIGHTS RESERVED
// THE ORIGINAL CODE IS BY PAUL JOHNSTON, MODIFIED BY MATT DAWSON 8/4/97
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <windef.h>
#include <winbase.h>
#include "lz.h"
ComDecEngine::ComDecEngine()
{
input_code_size=8;
bEncrypt = 0;
}
void ComDecEngine::ReInitLZW (void)
/* (Re)initialize LZW state; shared code for startup and Clear processing */
{
code_size = input_code_size+1;
limit_code = clear_code << 1; /* 2^code_size */
max_code = clear_code + 2; /* first unused code value */
sp = symbol_stack; /* init stack to empty */
}
void ComDecEngine::InitLZWCode (void)
/* Initialize for a series of LZWReadByte (and hence GetCode) calls */
{
/* GetCode initialization */
last_byte = 2; /* make safe to "recopy last two bytes" */
last_bit = 0; /* nothing in the buffer */
cur_bit = 0; /* force buffer load on first call */
out_of_blocks = FALSE;
/* LZWReadByte initialization */
clear_code = 1 << input_code_size; /* compute special code values */
end_code = clear_code + 1; /* note that these do not change */
first_time = TRUE;
ReInitLZW();
}
int ComDecEngine::GetDataBlock(void)
{
int i,count;
count=min(SrcLeft,READ_MAX);
//if (InputType)
//{
// Buffer=SrcPtr-2;
// SrcPtr+=count;
//}
//else
count=_lread(hInFile,Buffer+2,count);
SrcLeft-=count;
if (bEncrypt)
{
//do unencryption
for (i=0; i<count; i++)
Buffer[i+2]^=5;
}
return count;
}
int ComDecEngine::GetCode (void)
/* Fetch the next code_size bits from the GIF data */
/* We assume code_size is less than 16 */
{
register int accum;
int offs, ret, count;
if ( (cur_bit+code_size) > last_bit)
{
/* Time to reload the buffer */
/* preserve last two bytes of what we have -- assume code_size <= 16 */
if (!InputType)
{
Buffer[0] = Buffer[last_byte-2];
Buffer[1] = Buffer[last_byte-1];
}
/* Load more bytes; set flag if we reach the terminator block */
count = GetDataBlock();
/* Reset counters */
cur_bit = (cur_bit - last_bit) + 16;
last_byte = 2 + count;
last_bit = last_byte * 8;
}
/* Form up next 24 bits in accum */
offs = cur_bit >> 3; /* byte containing cur_bit */
accum = Buffer[offs+2] & 0xFF;
accum <<= 8;
accum |= Buffer[offs+1] & 0xFF;
accum <<= 8;
accum |= Buffer[offs] & 0xFF;
/* Right-align cur_bit in accum, then mask off desired number of bits */
accum >>= (cur_bit & 7);
ret = ((int) accum) & ((1 << code_size) - 1);
cur_bit += code_size;
return ret;
}
int ComDecEngine::LZWReadByte (void)
/* Read an LZW-compressed byte */
{
int code; /* current working code */
int incode; /* saves actual input code */
/* First time, just eat the expected Clear code(s) and return next code, */
/* which is assumed to be a raw byte. */
if (first_time) {
first_time = FALSE;
do {
code = GetCode();
} while (code == clear_code);
firstcode = oldcode = code; /* make firstcode, oldcode valid! */
return code;
}
/* If any codes are stacked from a previously read symbol, return them */
if (sp > symbol_stack)
return (int) *(--sp);
code = GetCode();
if (code == clear_code) {
/* Reinit static state, swallow any extra Clear codes, and return */
ReInitLZW();
do {
code = GetCode();
} while (code == clear_code);
firstcode = oldcode = code; /* gotta reinit these too */
return code;
}
if (code == end_code)
return -1;
/* Normal raw byte or LZW symbol */
incode = code; /* save for a moment */
if (code >= max_code) { /* special case for not-yet-defined symbol */
*sp++ = (UINT8) firstcode; /* it will be defined as oldcode/firstcode */
code = oldcode;
}
/* If it's a symbol, expand it into the stack */
while (code >= clear_code) {
*sp++ = symbol_tail[code]; /* tail of symbol: a simple byte value */
code = symbol_head[code]; /* head of symbol: another LZW symbol */
}
/* At this point code just represents a raw byte */
firstcode = code; /* save for possible future use */
/* If there's room in table, */
if ((code = max_code) < LZW_TABLE_SIZE) {
/* Define a new symbol = prev sym + head of this sym's expansion */
symbol_head[code] = oldcode;
symbol_tail[code] = (UINT8) firstcode;
max_code++;
/* Is it time to increase code_size? */
if ((max_code >= limit_code) && (code_size < MAX_LZW_BITS)) {
code_size++;
limit_code <<= 1; /* keep equal to 2^code_size */
}
}
oldcode = incode; /* save last input symbol for future use */
return firstcode; /* return first byte of symbol's expansion */
}
int ComDecEngine::DecompressLZW(HFILE hSrcFile,DWORD dwCompressedSize,BYTE* OutputBuffer)
{
int nextbyte;
hInFile = hSrcFile; //input_file=SrcHandle;
SrcLeft = dwCompressedSize;//(int)GetFileSize((void *)hInFile,NULL);
InputType=0;//SrcType;
DestPtr=OutputBuffer;
symbol_head=(UINT16 *)hash_prefix;
symbol_tail=(UINT8 *)hash_suffix;
InitLZWCode();
do {
nextbyte=LZWReadByte();
if (nextbyte>=0)
*DestPtr++=nextbyte;
} while (nextbyte!=-1);
return DestPtr-OutputBuffer;
}
/******************************/
/* this is the LZW write code */
/******************************/
void ComDecEngine::flush_packet (void)
/* flush any accumulated data */
{
if (bytesinpkt > 0) { /* never write zero-length packet */
//packetbuf[0] = (char) bytesinpkt++;
if (_lwrite(hOutFile,packetbuf, bytesinpkt)
!= (size_t) bytesinpkt) {
printf("Output file write error");
exit(1);
}
bytesinpkt = 0;
}
}
/* Add a character to current packet; flush to disk if necessary */
#define CHAR_OUT(c) \
{ packetbuf[bytesinpkt++] = (char) (c); \
if (bytesinpkt >= 255) \
flush_packet(); \
}
#define ENCR_CHAR_OUT(c) \
{ packetbuf[bytesinpkt++] = (char) ((c)^5); \
if (bytesinpkt >= 255) \
flush_packet(); \
}
/* Routine to convert variable-width codes into a byte stream */
void ComDecEngine::output (short code)
/* Emit a code of n_bits bits */
/* Uses cur_accum and cur_bits to reblock into 8-bit bytes */
{
cur_accum |= ((int) code) << cur_bits;
cur_bits += n_bits;
if (bEncrypt)
{
while (cur_bits >= 8) {
ENCR_CHAR_OUT(cur_accum & 0xFF);
cur_accum >>= 8;
cur_bits -= 8;
}
}
else
{
while (cur_bits >= 8) {
CHAR_OUT(cur_accum & 0xFF);
cur_accum >>= 8;
cur_bits -= 8;
}
}
/*
* If the next entry is going to be too big for the code size,
* then increase it, if possible. We do this here to ensure
* that it's done in sync with the decoder's codesize increases.
*/
if (free_code > maxcode) {
n_bits++;
if (n_bits == MAX_LZW_BITS)
maxcode = LZW_TABLE_SIZE; /* free_code will never exceed this */
else
maxcode = MAXCODE(n_bits);
}
}
/* The LZW algorithm proper */
void ComDecEngine::clear_hash (void)
/* Fill the hash table with empty entries */
{
/* It's sufficient to zero hash_code[] */
memset((void *) hash_code, 0, HSIZE * sizeof(short));
}
void ComDecEngine::clear_block (void)
/* Reset compressor and issue a Clear code */
{
clear_hash(); /* delete all the symbols */
free_code = ClearCode + 2;
output(ClearCode); /* inform decoder */
n_bits = init_bits; /* reset code size */
maxcode = MAXCODE(n_bits);
}
void ComDecEngine::compress_init (short i_bits)
/* Initialize LZW compressor */
{
/* init all the static variables */
n_bits = init_bits = i_bits;
maxcode = MAXCODE(n_bits);
ClearCode = ((int) 1 << (init_bits - 1));
EOFCode = ClearCode + 1;
free_code = ClearCode + 2;
first_byte = 1; /* no waiting symbol yet */
/* init output buffering vars */
bytesinpkt = 0;
cur_accum = 0;
cur_bits = 0;
/* clear hash table */
clear_hash();
/* GIF specifies an initial Clear code */
output(ClearCode);
}
void ComDecEngine::compress_byte (short c)
/* Accept and compress one 8-bit byte */
{
register short i;
register short disp;
if (first_byte) { /* need to initialize waiting_code */
waiting_code = c;
first_byte = 0;
return;
}
/* Probe hash table to see if a symbol exists for
* waiting_code followed by c.
* If so, replace waiting_code by that symbol and return.
*/
i = ((short) c << (MAX_LZW_BITS-8)) + waiting_code;
/* i is less than twice 2**MAX_LZW_BITS, therefore less than twice HSIZE */
if (i >= LZW_TABLE_SIZE)
i -= LZW_TABLE_SIZE;
if (hash_code[i] != 0)
{ /* is first probed slot empty? */
if (hash_prefix[i] == waiting_code && hash_suffix[i] == (UINT8) c)
{
waiting_code = hash_code[i];
return;
}
if (i == 0) /* secondary hash (after G. Knott) */
disp = 1;
else
disp = HSIZE - i;
while (1)
{
i -= disp;
if (i < 0)
i += HSIZE;
if (hash_code[i] == 0)
break; /* hit empty slot */
if (hash_prefix[i] == waiting_code && hash_suffix[i] == (UINT8) c)
{
waiting_code = hash_code[i];
return;
}
}
}
/* here when hashtable[i] is an empty slot; desired symbol not in table */
output(waiting_code);
if (free_code < LZW_TABLE_SIZE) {
hash_code[i] = free_code++; /* add symbol to hashtable */
hash_prefix[i] = waiting_code;
hash_suffix[i] = (UINT8) c;
} else
clear_block();
waiting_code = c;
}
void ComDecEngine::compress_term (void)
/* Clean up at end */
{
/* Flush out the buffered code */
if (! first_byte)
output(waiting_code);
/* Send an EOF code */
output(EOFCode);
/* Flush the bit-packing buffer */
if (bEncrypt)
{
if (cur_bits > 0) {
ENCR_CHAR_OUT(cur_accum & 0xFF);
}
}
else
{
if (cur_bits > 0) {
CHAR_OUT(cur_accum & 0xFF);
}
}
/* Flush the packet buffer */
flush_packet();
}
#define MAX_DATA 4096
BOOL ComDecEngine::CompressFile(BYTE *pData,DWORD dwSize, HFILE hOut)
{
DWORD dwPos = 0;
hOutFile = hOut;
compress_init(9);
while (dwPos < dwSize)
{
compress_byte(pData[dwPos]);
dwPos++;
}
compress_term();
return TRUE;
}
+131
View File
@@ -0,0 +1,131 @@
#ifndef engine_h
#define engine_h
#define MAX_LZW_BITS 13 /* maximum LZW code size (8192 symbols) */
#define LZW_TABLE_SIZE ((int) 1 << MAX_LZW_BITS)
#define HSIZE 10009 /* hash table size for 80% occupancy THIS MUST BE PRIME*/
#define MAXCODE(n_bits) (((int) 1 << (n_bits)) - 1)
/* Macros for extracting header data --- note we assume chars may be signed */
#define UINT8 unsigned char
typedef unsigned char byte;
#define UINT16 unsigned short
#define READ_MAX 8192
class ComDecEngine
{
private:
/* vars used by both comrpession and decression */
BOOL bEncrypt;
/* FOR DECOMPRESSION */
HFILE hInFile;
BYTE *SrcPtr;
int SrcLeft;
int InputType;
unsigned char Buffer[READ_MAX+2];
unsigned char *DestPtr;
int last_byte; /* # of bytes in code_buf */
int last_bit; /* # of bits in code_buf */
int cur_bit; /* next bit index to read */
int out_of_blocks; /* TRUE if hit terminator data block */
int input_code_size; /* codesize given in GIF file */
int clear_code,end_code; /* values for Clear and End codes */
int code_size; /* current actual code size */
int limit_code; /* 2^code_size */
int max_code; /* first unused code value */
int first_time; /* flags first call to LZWReadByte */
int oldcode; /* previous LZW symbol */
int firstcode; /* first byte of oldcode's expansion */
UINT16 *symbol_head; /* => table of prefix symbols */
UINT8 *symbol_tail; /* => table of suffix bytes */
UINT8 symbol_stack[8192]; /* stack for symbol expansions */
UINT8 *sp; /* stack pointer */
/* FOR COMPRESSION */
HFILE hOutFile;
short n_bits; /* current number of bits/code */
short maxcode; /* maximum code, given n_bits */
short init_bits; /* initial n_bits ... restored after clear */
short ClearCode; /* clear code (doesn't change) */
short EOFCode; /* EOF code (ditto) */
short free_code; /* first not-yet-used symbol code */
short hash_code[HSIZE]; /* => hash table of symbol codes */
short hash_prefix[HSIZE]; /* => hash table of prefix symbols */
UINT8 hash_suffix[HSIZE]; /* => hash table of suffix bytes */
short bytesinpkt; /* # of bytes in current packet */
char packetbuf[256]; /* workspace for accumulating packet */
int cur_accum; /* holds bits not yet output */
short cur_bits; /* # of bits in cur_accum */
short waiting_code; /* symbol not yet output; may be extendable */
int first_byte; /* if TRUE, waiting_code is not valid */
/* internal methods for decompression */
void ReInitLZW(void);
void InitLZWCode(void);
int GetDataBlock(void);
int GetCode(void);
int LZWReadByte(void);
/* internal methods for compression */
void flush_packet(void);
void output(short code);
void clear_hash(void);
void clear_block(void);
void compress_init(short i_bits);
void compress_byte(short c);
void compress_term(void);
public:
ComDecEngine();
DecompressLZW(HFILE hSrcFile,DWORD dwCompressedSize,BYTE *OutputBuffer);
BOOL CompressFile(BYTE *pData,DWORD dwSize, HFILE hOut);
void SetEncrypt(BOOL bEncrypt) {this->bEncrypt = bEncrypt;}
};
/* LZW decompression tables:
* symbol_head[K] = prefix symbol of any LZW symbol K (0..LZW_TABLE_SIZE-1)
* symbol_tail[K] = suffix byte of any LZW symbol K (0..LZW_TABLE_SIZE-1)
* Note that entries 0..end_code of the above tables are not used,
* since those symbols represent raw bytes or special codes.
*
* The stack represents the not-yet-used expansion of the last LZW symbol.
* In the worst case, a symbol could expand to as many bytes as there are
* LZW symbols, so we allocate LZW_TABLE_SIZE bytes for the stack.
* (This is conservative since that number includes the raw-byte symbols.)
*/
/* COMPRESSION info
* The LZW hash table consists of three parallel arrays:
* hash_code[i] code of symbol in slot i, or 0 if empty slot
* hash_prefix[i] symbol's prefix code; undefined if empty slot
* hash_suffix[i] symbol's suffix character; undefined if empty slot
* where slot values (i) range from 0 to HSIZE-1.
*
* Algorithm: use open addressing double hashing (no chaining) on the
* prefix code / suffix character combination. We do a variant of Knuth's
* algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
* secondary probe.
*
* The hash tables are allocated from heap space since they would use up
* rather a lot of the near data space in a PC.
*/
#endif
+448
View File
@@ -0,0 +1,448 @@
#define DEF_CHAR 128
Char cmap_mac[256] =
{
0,0,0,0,0, // 000
0,0,0,0,0, // 001
0,0,0,0,0, // 002
0,0,0,0,0, // 003
0,0,0,0,0, // 004
0,0,0,0,0, // 005
0,0,0,0,0, // 006
0,0,0,0,0, // 007
0,0,0,0,0, // 008
0,0,0,0,0, // 009
0,0,0,0,0, // 010
0,0,0,0,0, // 011
0,0,0,0,0, // 012
0,0,0,0,0, // 013
0,0,0,0,0, // 014
0,0,0,0,0, // 015
0,0,0,0,0, // 016
1,'@',0,0,0, // 017
1,'@',0,0,0, // 018
1,'@',0,0,0, // 019
1,'@',0,0,0, // 020
0,0,0,0,0, // 021
0,0,0,0,0, // 022
0,0,0,0,0, // 023
0,0,0,0,0, // 024
0,0,0,0,0, // 025
0,0,0,0,0, // 026
0,0,0,0,0, // 027
0,0,0,0,0, // 028
0,0,0,0,0, // 029
0,0,0,0,0, // 030
0,0,0,0,0, // 031
1,0,0,0,0, // 032 space
1,0,0,0,0, // 033 !
1,0,0,0,0, // 034 "
1,0,0,0,0, // 035 #
1,0,0,0,0, // 036 $
1,0,0,0,0, // 037 %
1,0,0,0,0, // 038 &
1,0,0,0,0, // 039 '
1,0,0,0,0, // 040 (
1,0,0,0,0, // 041 )
1,0,0,0,0, // 042 *
1,0,0,0,0, // 043 +
1,0,0,0,0, // 044 ,
1,0,0,0,0, // 045 -
1,0,0,0,0, // 046 .
1,0,0,0,0, // 047 /
1,0,0,0,0, // 048 0
1,0,0,0,0, // 049 1
1,0,0,0,0, // 040 2
1,0,0,0,0, // 051 3
1,0,0,0,0, // 052 4
1,0,0,0,0, // 053 5
1,0,0,0,0, // 054 6
1,0,0,0,0, // 055 7
1,0,0,0,0, // 056 8
1,0,0,0,0, // 057 9
1,0,0,0,0, // 058 :
1,0,0,0,0, // 059 ;
1,0,0,0,0, // 060 <
1,0,0,0,0, // 061 =
1,0,0,0,0, // 062 >
1,0,0,0,0, // 063 ?
1,0,0,0,0, // 064 @
1,0,0,0,0, // 065 A
1,0,0,0,0, // 066 B
1,0,0,0,0, // 067 C
1,0,0,0,0, // 068 D
1,0,0,0,0, // 069 E
1,0,0,0,0, // 070 F
1,0,0,0,0, // 071 G
1,0,0,0,0, // 072 H
1,0,0,0,0, // 073 I
1,0,0,0,0, // 074 J
1,0,0,0,0, // 075 K
1,0,0,0,0, // 076 L
1,0,0,0,0, // 077 M
1,0,0,0,0, // 078 N
1,0,0,0,0, // 079 O
1,0,0,0,0, // 080 P
1,0,0,0,0, // 081 Q
1,0,0,0,0, // 082 R
1,0,0,0,0, // 083 S
1,0,0,0,0, // 084 T
1,0,0,0,0, // 085 U
1,0,0,0,0, // 086 V
1,0,0,0,0, // 087 W
1,0,0,0,0, // 088 X
1,0,0,0,0, // 089 Y
1,0,0,0,0, // 090 Z
1,0,0,0,0, // 091 [
1,0,0,0,0, // 092 "\"
1,0,0,0,0, // 093 ]
1,0,0,0,0, // 094 ^
1,0,0,0,0, // 095 _
1,0,0,0,0, // 096 `
1,0,0,0,0, // 097 a
1,0,0,0,0, // 098 b
1,0,0,0,0, // 099 c
1,0,0,0,0, // 100 d
1,0,0,0,0, // 101 e
1,0,0,0,0, // 102 f
1,0,0,0,0, // 103 g
1,0,0,0,0, // 104 h
1,0,0,0,0, // 105 i
1,0,0,0,0, // 106 j
1,0,0,0,0, // 107 k
1,0,0,0,0, // 108 l
1,0,0,0,0, // 109 m
1,0,0,0,0, // 100 n
1,0,0,0,0, // 111 o
1,0,0,0,0, // 112 p
1,0,0,0,0, // 113 q
1,0,0,0,0, // 114 r
1,0,0,0,0, // 115 s
1,0,0,0,0, // 116 t
1,0,0,0,0, // 117 u
1,0,0,0,0, // 118 v
1,0,0,0,0, // 119 w
1,0,0,0,0, // 110 x
1,0,0,0,0, // 121 y
1,0,0,0,0, // 122 z
1,0,0,0,0, // 123 {
0,0,0,0,0, // 124 
1,0,0,0,0, // 125 }
1,0,0,0,0, // 126 ~
0,0,0,0,0, // 127 
1,'Ä'',0,0,0, // 128 €
1,'Ä'',0,0,0, // 129
1,'Ç'',0,0,0, // 130
1,'É'',0,0,0, // 131 ƒ
1,'Ñ'',0,0,0, // 132 „
1,'Ö'',0,0,0, // 133 …
1,'Ü'',0,0,0, // 134 †
1,'á'',0,0,0, // 135 ‡
1,'à'',0,0,0, // 136 ˆ
1,'â'',0,0,0, // 137 ‰
1,'ä'',0,0,0, // 138 Š
1,'ã'',0,0,0, // 139
1,'å'',0,0,0, // 140 Œ
1,'ç'',0,0,0, // 141
1,'é'',0,0,0, // 142 Ž
1,'è'',0,0,0, // 143
1,'ê'',0,0,0, // 144
1,'ë'',0,0,0, // 145
1,'í'',0,0,0, // 146
1,'ì'',0,0,0, // 147 “
1,'î'',0,0,0, // 148 ”
1,'ï'',0,0,0, // 149 •
1,'ñ'',0,0,0, // 150
1,'ó'',0,0,0, // 151 —
1,'ò'',0,0,0, // 152 ˜
1,'ô'',0,0,0, // 153 ™
1,'ö'',0,0,0, // 154 š
1,'õ'',0,0,0, // 155
1,'ú'',0,0,0, // 156 œ
1,'ù'',0,0,0, // 157
1,'û'',0,0,0, // 158 ž
1,'ü'',0,0,0, // 159 Ÿ
1,''',0,0,0, // 160  
1,'º'',0,0,0, // 161 ¡
1,'¢'',0,0,0, // 162 ¢
1,'£'',0,0,0, // 163 £
1,'§'',0,0,0, // 164 ¤
1,'©'',0,0,0, // 165 ¥
1,''',0,0,0, // 166 ¦
1,'ß'',0,0,0, // 167 §
1,'®'',0,0,0, // 168 ¨
1,'©'',0,0,0, // 169 ©
1,''',0,0,0, // 170 ª
1,'´'',0,0,0, // 171 «
1,'¨'',0,0,0, // 172 ¬
1,'=',0,0,0, // 173 ­
1,'Æ'',0,0,0, // 174 ®
1,'Ø'',0,0,0, // 175 ¯
1,''',0,0,0, // 176 °
1,'±'',0,0,0, // 177 ±
1,'«'',0,0,0, // 178 ²
1,'»'',0,0,0, // 179 ³
1,'¥'',0,0,0, // 180 ´
1,'µ'',0,0,0, // 181 µ
1,'ð'',0,0,0, // 182 ¶
1,'E',0,0,0, // 183 ·
1,'P',0,0,0, // 184 ¸
1,'p',0,0,0, // 185 ¹
1,'ƒ'',0,0,0, // 186 º
1,'a',0,0,0, // 187 »
1,'o',0,0,0, // 188 ¼
1,'O',0,0,0, // 189 ½
1,'æ'',0,0,0, // 190 ¾
1,'ø'',0,0,0, // 191 µ
1,'¿'',0,0,0, // 192 À
1,'¡'',0,0,0, // 193 Á
1,'¬'',0,0,0, // 194 Â
1,'Œ'',0,0,0, // 195 Ã
1,'ƒ'',0,0,0, // 196 Ä
1,'=',0,0,0, // 197 Å
1,'D',0,0,0, // 198 Æ
1,'«'',0,0,0, // 199 Ç
1,'»'',0,0,0, // 200 È
1,''',0,0,0, // 201 É
1,' ',0,0,0, // 202 Ê
1,'À'',0,0,0, // 203 Ë
1,'Ã'',0,0,0, // 204 Ì
1,'Õ'',0,0,0, // 205 Í
1,'Œ'',0,0,0, // 206 Î
1,'œ'',0,0,0, // 207 Ï
1,''',0,0,0, // 208 Ð
1,''',0,0,0, // 209 Ñ
1,''',0,0,0, // 210 Ò
1,''',0,0,0, // 211 Ó
1,''',0,0,0, // 212 Ô
1,''',0,0,0, // 213 Õ
1,'÷'',0,0,0, // 214 Ö
1,'¤'',0,0,0, // 215 ×
1,'ÿ',0,0,0, // 216 Ø
0,0,0,0,0, // 217 Ù
0,0,0,0,0, // 218 Ú
0,0,0,0,0, // 219 Û
0,0,0,0,0, // 220 Ü
0,0,0,0,0, // 221 Ý
0,0,0,0,0, // 222 Þ
0,0,0,0,0, // 223 ß
0,0,0,0,0, // 224 à
0,0,0,0,0, // 225 á
0,0,0,0,0, // 226 â
0,0,0,0,0, // 227 ã
0,0,0,0,0, // 228 ä
0,0,0,0,0, // 229 å
0,0,0,0,0, // 230 æ
0,0,0,0,0, // 231 ç
0,0,0,0,0, // 232 è
0,0,0,0,0, // 233 é
0,0,0,0,0, // 234 ê
0,0,0,0,0, // 235 ë
0,0,0,0,0, // 236 ì
0,0,0,0,0, // 237 í
0,0,0,0,0, // 238 î
0,0,0,0,0, // 239 ï
0,0,0,0,0, // 240 ð
0,0,0,0,0, // 241 ñ
0,0,0,0,0, // 242 ò
0,0,0,0,0, // 243 ó
0,0,0,0,0, // 244 ô
0,0,0,0,0, // 245 õ
0,0,0,0,0, // 246 ö
0,0,0,0,0, // 247 ÷
0,0,0,0,0, // 248 ø
0,0,0,0,0, // 249 ù
0,0,0,0,0, // 250 ú
0,0,0,0,0, // 251 û
0,0,0,0,0, // 252 ü
0,0,0,0,0, // 253 ý
0,0,0,0,0, // 254 þ
0,0,0,0,0 // 255 ÿ
};
@@ -0,0 +1,62 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Fontedit.RC
//
#define IDD_ABOUTBOX 100
#define IDR_MAINFRAME 128
#define IDD_ACWIDTH 130
#define IDD_DELTASPACE 131
#define IDD_FONTPROPERTIES 132
#define IDD_EXPORT 133
#define IDD_CHOOSEDIR 135
#define IDC_AWIDTH 1000
#define IDC_CWIDTH 1001
#define IDC_DELTA_A 1001
#define IDC_DIRLIST 1001
#define IDC_DELTA_C 1002
#define IDC_FONTNAME 1002
#define IDC_DIRPATH 1002
#define IDC_FONTSIZE 1003
#define IDC_DRIVES 1003
#define IDC_FILETAG 1003
#define IDC_FONTBOLD 1004
#define IDC_FILELIST 1004
#define IDC_OUPUTDIR 1004
#define IDC_FONTITALIC 1005
#define IDC_BROWSE 1005
#define ID_IMAGE_NEXT 32771
#define ID_IMAGE_PREV 32772
#define ID_IMAGE_ZOOMIN 32773
#define ID_IMAGE_ZOOMOUT 32774
#define ID_IMAGE_UNDO 32775
#define ID_IMAGE_SHORTEN 32776
#define ID_OPTIONS_ENGLISH 32777
#define ID_OPTIONS_CLUBS 32778
#define ID_OPTIONS_FOREIGN 32779
#define ID_IMAGE_CHANGEACWIDTHS 32780
#define ID_OPTIONS_MAC 32781
#define ID_OPTIONS_ALL 32782
#define IDM_GLOBALCHANGEAANDC 32783
#define IDM_SAVEFORD3D 32784
#define IDM_VIEW_PROPERTIES 32785
#define ID_FILE_NEWNONANTIALIASED 32786
#define ID_FILE_IMPORTTEXTURESFROMTGAS 32788
#define ID_OPTIONS_FORCE256X256TEXTURES 32789
#define ID_OPTIONS_MINIMIZETEXTURECOUNT 32790
#define ID_OPTIONS_MINIMIZETEXTURESPACE 32791
#define ID_FILE_EXPORTTEXTURES 32792
#define ID_FILE_IMPORTTEXTURES 32793
#define ID_OPTIONS_ALPHABETICCHARACTERSONLY 32794
#define ID_IMAGE_SHORTENFROMBOTTOM 32795
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 32796
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
@@ -0,0 +1,48 @@
//===========================================================================//
// File: targa.h //
// Project: Window Library //
// Contents: Code to make basic button workd //
//---------------------------------------------------------------------------//
// Copyright (C) 1999 Microsoft Corp. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#ifndef TARGA_H
#define TARGA_H
#define TGA_SIZE 18
typedef struct tgaheader { /* Offset Meaning */
BYTE IdSize; /* 0 id field size at end of header */
BYTE ColMapType; /* 1 0=>no color map, 1=>color map */
BYTE TypeCode; /* 2 1=>type 1, 2=>type 2 images,... */
WORD ColMapOrigin; /* 3 index of first color map entry */
WORD ColMapLength; /* 5 number of entries in color map */
BYTE ColMapBits; /* 7 number of bits/color map entry */
WORD XOrigin; /* 8 lower left corner of image */
WORD YOrigin; /* 10 lower left corner of image */
WORD Width; /* 12 width of image in pixels */
WORD Height; /* 14 height of image in pixels */
BYTE BitsPerPixel; /* 16 see note 1: below */
BYTE Descriptor; /* 17 see note 2: below */
/* */
/* Note 1: The "BitsPerPixel" field depends of the type of */
/* Targa file. For Targa type 1 images, it is the */
/* number of bits per pixel index. For a true- */
/* color Targa image this is 24, since pixels need */
/* 1 byte each for r, g, and b. */
/* Note 2: Individual bits have meaning here. For example, */
/* toggling bit 5 flips the image upside down. */
} TGAHeader;
#define TGA_FILE 1 //Display from a file
#define TGA_RESOURCE 2 //Display from resource ID
#define TGA_MATTE 4 //Don't show black (0,0,0) areas
#define TGA_OPAQUE 8 //Show completely
#define TGA_LZ 16 //Comes from graphics.lz
class FileType;
extern FileType *gLZGraphics;
//Modes for displaying
#endif