From 0e664237b6c2bb74a1820123b2dfd23d89a3e848 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 19 Jun 2004 13:46:11 +0000 Subject: [PATCH] Finally, a mostly-working font builder on Linux This was SVN commit r549. --- source/tools/fontbuilder/Construct | 20 +++++++++++++++++ source/tools/fontbuilder/filemanip.cpp | 12 ++++++---- .../tools/fontbuilder/platform/fontselect.h | 3 ++- source/tools/fontbuilder/stdafx.h | 4 ++-- source/tools/fontbuilder/wxconfig.cpp | 22 ++++++++++++++----- source/tools/fontbuilder/wxframe.cpp | 5 ++--- 6 files changed, 51 insertions(+), 15 deletions(-) create mode 100755 source/tools/fontbuilder/Construct diff --git a/source/tools/fontbuilder/Construct b/source/tools/fontbuilder/Construct new file mode 100755 index 0000000000..e420da453b --- /dev/null +++ b/source/tools/fontbuilder/Construct @@ -0,0 +1,20 @@ +# Install cons (www.dsmit.com/cons), then run it in this directory +# to attempt to compile. Update paths as appropriate. It still won't +# work though - wxexpr.cpp dies if you use Unicode, so I had to +# alter it a little. If anybody cares, let me know and I'll make +# some more useful instructions. + +use strict; +use warnings; + +Default '.'; + +my $env = new cons ( + CFLAGS => '-O0 -g -Wall -I/usr/local/lib/wx/include/gtk2ud-2.4 -D__WXDEBUG__ -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUNICODE -D_UNICODE -DwxUSE_UNICODE=1', +# CFLAGS => '-O0 -g -W3 -I/usr/local/lib/wx/include/gtk2ud-2.4 -D__WXDEBUG__ -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUNICODE -D_UNICODE -DwxUSE_UNICODE=1', +# CC => '/opt/intel/compiler80/bin/icc', + LIBPATH => ['/home/philip/wxGTK-2.4.2/lib'], + LIBS => '-lwx_gtk2ud-2.4', + CPPPATH => ['.', '/usr/include/freetype2', '/home/philip/wxGTK-2.4.2/include', '/home/philip/wxGTK-2.4.2/lib/wx/include/gtk2ud-2.4'], +); +Program $env 'FontBuilder', <*.cpp>, ; diff --git a/source/tools/fontbuilder/filemanip.cpp b/source/tools/fontbuilder/filemanip.cpp index 20f5f89533..4c120e5dc0 100755 --- a/source/tools/fontbuilder/filemanip.cpp +++ b/source/tools/fontbuilder/filemanip.cpp @@ -1,4 +1,4 @@ -// $Id: filemanip.cpp,v 1.1 2004/06/17 19:32:04 philip Exp $ +// $Id: filemanip.cpp,v 1.2 2004/06/19 13:46:11 philip Exp $ #include "stdafx.h" @@ -6,9 +6,10 @@ // Ensure there's no padding added into the struct, // in a very non-portable way +#ifdef _WIN32 #pragma pack(push) #pragma pack(1) -// For gcc, use "} TGA_HEADER __attribute__ ((packed));" instead of this +#endif typedef struct { @@ -26,9 +27,12 @@ typedef struct short height; // image height in pixels char bits; // image bits per pixel 8,16,24,32 char descriptor; // image descriptor bits (vh flip bits) +#ifdef _WIN32 } TGA_HEADER; - -#pragma pack(pop) +# pragma pack(pop) +#else +} __attribute__ ((packed)) TGA_HEADER; +#endif // Convert the RGB image to 8-bit greyscale and output void RGB_OutputGreyscaleTGA(unsigned char* image_data, int width, int height, int pitch, wxFFile& file) diff --git a/source/tools/fontbuilder/platform/fontselect.h b/source/tools/fontbuilder/platform/fontselect.h index 6c1087e403..9b3115846b 100755 --- a/source/tools/fontbuilder/platform/fontselect.h +++ b/source/tools/fontbuilder/platform/fontselect.h @@ -1,6 +1,7 @@ -// $Id: fontselect.h,v 1.4 2004/06/19 12:56:09 philip Exp $ +// $Id: fontselect.h,v 1.5 2004/06/19 13:46:11 philip Exp $ #include "wx/dialog.h" +#include "wx/filedlg.h" #ifdef _WIN32 class FontSelectorDialog : public wxDialog diff --git a/source/tools/fontbuilder/stdafx.h b/source/tools/fontbuilder/stdafx.h index 4151b4a8e4..ba174195cd 100755 --- a/source/tools/fontbuilder/stdafx.h +++ b/source/tools/fontbuilder/stdafx.h @@ -1,4 +1,4 @@ -// $Id: stdafx.h,v 1.4 2004/06/19 12:56:09 philip Exp $ +// $Id: stdafx.h,v 1.5 2004/06/19 13:46:11 philip Exp $ // Precompiled headers @@ -64,4 +64,4 @@ #endif // HAVE_PCH -#include "wx/defs.h" \ No newline at end of file +#include "wx/defs.h" diff --git a/source/tools/fontbuilder/wxconfig.cpp b/source/tools/fontbuilder/wxconfig.cpp index 7251764146..6a09b58800 100755 --- a/source/tools/fontbuilder/wxconfig.cpp +++ b/source/tools/fontbuilder/wxconfig.cpp @@ -1,4 +1,4 @@ -// $Id: wxconfig.cpp,v 1.2 2004/06/19 12:56:09 philip Exp $ +// $Id: wxconfig.cpp,v 1.3 2004/06/19 13:46:11 philip Exp $ #include "stdafx.h" @@ -7,6 +7,12 @@ #include "wxconfig.h" +#ifdef _WIN32 +const wxString PathSep = wxT("\\"); +#else +const wxString PathSep = wxT("/"); +#endif + void ConfigInit() { wxConfig* cfg = new wxConfig(wxT("WFG Font Builder")); @@ -15,24 +21,30 @@ void ConfigInit() // Default paths, for the first time program is run: // Get "x:\wherever\etc\binaries\" - wxFileName cwd = wxFileName::GetCwd()+wxT("\\"); + wxFileName cwd = wxFileName::GetCwd()+PathSep; cwd.RemoveDir((int)cwd.GetDirCount()-1); +#define DIR(a) dir.AppendDir(wxT(a)) + + cwd.AppendDir(wxT("data")); if (!ConfigGet(wxT("FSF path"))) { - wxFileName dir = cwd; dir.AppendDir(wxT("data\\tools\\fontbuilder\\settings")); + wxFileName dir = cwd; + DIR("tools"); DIR("fontbuilder"); DIR("settings"); ConfigSet(wxT("FSF path"), dir.GetPath(wxPATH_GET_VOLUME)); } if (!ConfigGet(wxT("FNT path"))) { - wxFileName dir = cwd; dir.AppendDir(wxT("data\\mods\\official\\fonts")); + wxFileName dir = cwd; + DIR("mods"); DIR("official"); DIR("fonts"); ConfigSet(wxT("FNT path"), dir.GetPath(wxPATH_GET_VOLUME)); } if (!ConfigGet(wxT("Charset path"))) { - wxFileName dir = cwd; dir.AppendDir(wxT("data\\tools\\fontbuilder\\charsets")); + wxFileName dir = cwd; + DIR("tools"); DIR("fontbuilder"); DIR("charsets"); ConfigSet(wxT("Charset path"), dir.GetPath(wxPATH_GET_VOLUME)); } } diff --git a/source/tools/fontbuilder/wxframe.cpp b/source/tools/fontbuilder/wxframe.cpp index 81d3eb4b3c..9ad555325c 100755 --- a/source/tools/fontbuilder/wxframe.cpp +++ b/source/tools/fontbuilder/wxframe.cpp @@ -1,4 +1,4 @@ -// $Id: wxframe.cpp,v 1.4 2004/06/19 12:56:09 philip Exp $ +// $Id: wxframe.cpp,v 1.5 2004/06/19 13:46:11 philip Exp $ #include "stdafx.h" @@ -314,12 +314,11 @@ void MainFrame::SaveSettings(wxString& filename) for (size_t i=0; iAddAttributeValueString(wxT("PreviewText"), PreviewTextHex); - db.Append(Settings); db.Write(filename);