Commits

Anton Stuk committed 15bc1a6

conversion to vs 2008

Comments (0)

Files changed (1435)

+syntax:glob
+*.user
+*.tmp
+*.pcb
+*.ncb
+*.obj
+*.suo
+*.o
+*.pch
+*.obj
+*.bak
+*.ncb
+*.opt
+*.aps
+*.sbr
+*.tmp
+*.idb
+*.pdb
+*.lib
+*.exp
+*.ilk
+*.res
+*.pch
+*.pchi
+*.dll
+*.exe
+*.tmp
+*.log
+*.bsc
+*.positions
+*.manifest
+/Release/*
+/Debug/*
+/Dev/*
+/CVS/*
+/Libs/*
+BuildLog.htm
+mt.dep

Apps/FontBuilder/FontBuilder.dsp

+# Microsoft Developer Studio Project File - Name="FontBuilder" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=FontBuilder - 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 "FontBuilder.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 "FontBuilder.mak" CFG="FontBuilder - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "FontBuilder - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "FontBuilder - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "FontBuilder - 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 "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x419 /d "NDEBUG"
+# ADD RSC /l 0x419 /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:console /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:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "FontBuilder - 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 "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\Include" /I "..\..\Modules\KernelRuntime\Inc" /I "..\..\SharedLibs\Freetype\inc" /I "..\..\Modules\ImageCore\Inc" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x419 /d "_DEBUG"
+# ADD RSC /l 0x419 /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:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib KernelRuntime.Dbg.lib freetype.Dbg.lib ImageCore.Dbg.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../Bin/FontBuilder.exe" /pdbtype:sept /libpath:"..\..\Libs" /libpath:"..\..\SharedLibs\Libs"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "FontBuilder - Win32 Release"
+# Name "FontBuilder - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\fontBuilder.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Apps/FontBuilder/FontBuilder.dsw

+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "FontBuilder"=".\FontBuilder.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name Freetype
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "Freetype"="..\..\SharedLibs\Freetype\Freetype.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+

Apps/FontBuilder/fontBuilder.cpp

+// Font builder app
+// 16/09/2001 SiGMan
+//
+// Based on the Gaffer source and freeType2 lib
+// TODO: Add support for Cyrillic characters
+
+#include "Std.h"
+#include "Str.h"
+#include "Options.h"
+#include "File.h"
+#include "2DTypes.h"
+#include "Image.h"
+
+#include "freetype\freetype.h"
+
+
+USING_NAMESPACE_LIB
+
+//////////////////////////////////////
+
+enum { SORT_BY_CODE, SORT_BY_SIZE };
+
+struct TextureGlyph 
+{
+	WORD		charCode;	// character code
+	WORD		advance;	// horizontal distance to next glyph origin
+	WORD		width;		// width of glyph
+	WORD		height;		// height of glyph
+	SWORD		left;		// offset from origin to left of character
+	SWORD		top;		// offset from origin to top of character
+	WORD		x,y;		// glyph location
+};
+
+struct SortableGlyph : public TextureGlyph
+{
+	static INT sortMode;
+
+	inline BOOL operator < ( const SortableGlyph& other ) const
+	{
+		if ( sortMode == SORT_BY_CODE )
+			return ( charCode < other.charCode );
+		else
+			return ( other.width * other.height < width * height );
+	}
+};
+
+typedef DynamicArray<SortableGlyph> GlyphList;
+
+struct Request
+{
+	String			fontFile;
+	String			chars;
+	INT				pixelSize;
+	INT				maxTextureSize;
+	String			outputFile;
+};
+
+struct TexBuf
+{
+	GlyphList glyphs;
+	INT		height;
+	Image	tex;
+	Image	used;
+	INT		usedWidth;
+	INT		usedHeight;
+};
+
+INT SortableGlyph::sortMode;
+
+//////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////
+
+BOOL PlaceGlyph( TexBuf* buf, TextureGlyph* g, FT_Face face )
+{
+	// Leave one pixel border
+	INT reqWidth = g->width + 1;
+	INT reqHeight= g->height + 1;
+
+	// Try to find the place so far
+	for ( INT y = 0; y < (buf->usedHeight - reqHeight); y++ ) {
+		for ( INT x = 0; x < (buf->usedWidth - reqWidth); x++ ) {
+			INT cx, cy;
+			for( cy = y; cy < y + reqHeight; cy++ ) {
+				for ( cx = x; cx < x + reqWidth; cx++ ) {
+					BYTE* ptr = (BYTE*)(buf->used.GetPtr(Point(cx,cy)));
+					if ( *ptr != 0 ) {
+						cy = 9999;
+						break;
+					}
+				}
+			}
+
+			//
+			if ( cy < 9999 ) {
+				g->x = x + 1;
+				g->y = y + 1;
+				return TRUE;
+			}
+		}
+	}
+
+	// If no space was found expand smallest edge of the used box,
+	// which will keep texture close to square
+	if ( buf->usedHeight < buf->usedWidth ) {
+		if ( buf->usedHeight == buf->used.h - 1 )
+			return FALSE;
+
+		buf->usedHeight += reqHeight;
+		if ( buf->usedHeight >= buf->used.h )
+			buf->usedHeight = buf->used.h - 1;
+	} else {
+		if ( buf->usedWidth == buf->used.w - 1 )
+			return FALSE;
+
+		buf->usedWidth += reqWidth;
+		if ( buf->usedWidth >= buf->used.w )
+			buf->usedWidth = buf->used.w - 1;
+	}
+
+	return PlaceGlyph( buf, g, face );
+
+}
+
+INT GenFont( Request& req, TexBuf& buf )
+{
+	// Init ft
+	FT_Library FT;
+	if ( FT_Init_FreeType( &FT ) )
+		return -1;
+
+	// Load font
+	FT_Face face;
+	if ( FT_New_Face( FT, req.fontFile, 0, &face ) )
+		return -2;
+
+	// Set font size
+	if ( FT_Set_Pixel_Sizes( face, 0, req.pixelSize ) )
+		return -1;
+
+	// Load glyphs
+	for ( UINT chr = 0; chr < req.chars.Length(); chr++ ) {
+		TCHAR ch = req.chars[ chr ];
+
+		// Look if glyph exists