forked from 0ad/0ad
Finally, a mostly-working font builder on Linux
This was SVN commit r549.
This commit is contained in:
parent
ed65f4ba96
commit
0e664237b6
20
source/tools/fontbuilder/Construct
Executable file
20
source/tools/fontbuilder/Construct
Executable file
@ -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>, <platform/linux/*.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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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; i<PreviewText.Length(); ++i)
|
||||
{
|
||||
wchar_t b[5];
|
||||
swprintf(b, wxT("%04x"), PreviewText[i]);
|
||||
swprintf(b, 5, wxT("%04x"), PreviewText[i]);
|
||||
PreviewTextHex += wxString(b, 4);
|
||||
}
|
||||
Settings->AddAttributeValueString(wxT("PreviewText"), PreviewTextHex);
|
||||
|
||||
|
||||
db.Append(Settings);
|
||||
|
||||
db.Write(filename);
|
||||
|
Loading…
Reference in New Issue
Block a user