This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
File diff suppressed because it is too large Load Diff
Binary file not shown.
+145
View File
@@ -0,0 +1,145 @@
//-----------------------------------------------------------------------------
// Name: FontMaker.h
//
// Desc: Defines the class behaviors for the application.
//
// Hist: 09.06.02 - Revised Fontmaker sample
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef FONTMAKER_H
#define FONTMAKER_H
#include "resource.h"
#include "BitmapFontFile.h"
#include <math.h>
#include "..\toollib\toollib.h"
#include "..\toollib\scriplib.h"
#include "..\toollib\piclib.h"
//-----------------------------------------------------------------------------
// Name: class CFontMakerView
// Desc: The scroll view class for viewing the font texture image
//-----------------------------------------------------------------------------
class CFontMakerView : public CScrollView
{
protected:
CFontMakerView() {}
DECLARE_DYNCREATE(CFontMakerView)
CDC m_memDC;
public:
VOID OnNewFontGlyphs();
virtual ~CFontMakerView();
public:
// Overridden functions
//{{AFX_VIRTUAL(CFontMakerView)
public:
virtual void OnDraw(CDC* pDC);
virtual void OnInitialUpdate();
protected:
//}}AFX_VIRTUAL
protected:
// Message map functions
//{{AFX_MSG(CFontMakerView)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//-----------------------------------------------------------------------------
// Name: class CFontMakerFrameWnd
// Desc: The main frame window class for the app, which contains the dialog bar
// full of controls and the scroll view to view the font texture image.
//-----------------------------------------------------------------------------
class CFontMakerFrameWnd : public CFrameWnd
{
public:
CFontMakerFrameWnd() {}
virtual ~CFontMakerFrameWnd() {}
CDialogBar m_wndDialogBar;
CDialogBar* GetDialogBar() { return &m_wndDialogBar; }
protected:
DECLARE_DYNCREATE(CFontMakerFrameWnd)
// Message map functions
//{{AFX_MSG(CFontMakerFrameWnd)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//-----------------------------------------------------------------------------
// Name: class CFontMakerApp
// Desc: The main app class
//-----------------------------------------------------------------------------
class CFontMakerApp : public CWinApp
{
CDialogBar* m_pDialogBar;
CFontMakerView* m_pView;
HCURSOR m_hWaitCursor;
public:
CFontMakerApp() {}
~CFontMakerApp() {}
VOID UpdateSelectedGlyph( BOOL bGlyphSelected, int iSelectedGlyph = 0 );
HRESULT CalculateAndRenderGlyphs();
VOID InsertGlyph();
void SetTextureSize( int width, int height );
// Overrides
//{{AFX_VIRTUAL(CFontMakerApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CFontMakerApp)
afx_msg void OnNewFontButton();
afx_msg void OnEffectsCheck();
afx_msg void OnGlyphsFromRangeRadio();
afx_msg void OnChangeGlpyhsRangeEdit();
afx_msg void OnGlyphsFromFileRadio();
afx_msg void OnChangeGlyphsFileEdit();
afx_msg void OnGlyphsFileSelectorButton();
afx_msg void OnTextureSizeButton();
afx_msg void OnMagnifyButton();
afx_msg void OnGlyphSpecial();
afx_msg void OnUpdateButton( CCmdUI* pCmdUI );
afx_msg void OnSaveButton();
afx_msg void OnExit();
afx_msg void OnAbout();
afx_msg void OnHelp();
afx_msg void OnGlyphsCustom();
afx_msg void OnLoadButton();
afx_msg void OnLoadCustomFontButton();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// External reference to the unique application instance
extern CFontMakerApp theApp;
#endif // FONTMAKER_H
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+314
View File
@@ -0,0 +1,314 @@
// Microsoft Visual C++ 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
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#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"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\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 "FontMaker.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOGBAR DIALOGEX 0, 0, 142, 418
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Font",IDC_FONT_GROUPBOX,5,5,130,142,WS_DISABLED
LTEXT "Name",IDC_FONTNAME_LABEL,10,15,24,15,SS_CENTERIMAGE |
WS_DISABLED
LTEXT "",IDC_FONTNAME_STATIC,35,15,90,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
LTEXT "Style",IDC_FONTSTYLE_LABEL,10,30,20,15,SS_CENTERIMAGE |
WS_DISABLED
LTEXT "",IDC_FONTSTYLE_STATIC,35,30,90,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
LTEXT "Size",IDC_FONTSIZE_LABEL,10,45,20,15,SS_CENTERIMAGE |
WS_DISABLED
LTEXT "",IDC_FONTSIZE_STATIC,35,45,30,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CONTROL "Outlined",IDC_EFFECTSOUTLINED_CHECK,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,65,42,10
CONTROL "Shadowed",IDC_EFFECTSSHADOWED_CHECK,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,80,50,10
PUSHBUTTON "Magnify...",IDC_MAGNIFY_BUTTON,75,70,50,14,WS_DISABLED
GROUPBOX "Texture properties",IDC_TEXTURE_GROUPBOX,5,149,130,40,
WS_DISABLED
LTEXT "Insert Glyph:",IDC_INSERTGLYPH_LABEL,10,375,63,10,
SS_CENTERIMAGE | WS_DISABLED
CTEXT "",IDC_TEXTUREWIDTH_STATIC,9,170,30,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "Height",IDC_TEXTUREHEIGHT_LABEL,45,159,30,10,
SS_CENTERIMAGE | WS_DISABLED
CTEXT "",IDC_TEXTUREHEIGHT_STATIC,45,170,30,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
PUSHBUTTON "Size...",IDC_TEXTURESIZE_BUTTON,80,165,50,14,
WS_DISABLED
GROUPBOX "Glyphs",IDC_GLYPHS_GROUPBOX,5,189,130,95,WS_DISABLED
CONTROL "From range:",IDC_GLYPHSFROMRANGE_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP,10,199,53,10
RTEXT "From:",IDC_GLYPHSRANGEFROM_LABEL,25,215,20,15,
SS_CENTERIMAGE | WS_DISABLED
EDITTEXT IDC_GLYPHSRANGEFROM_EDIT,50,215,25,12,ES_CENTER |
ES_AUTOHSCROLL | WS_DISABLED
RTEXT "To:",IDC_GLYPHSRANGETO_LABEL,85,215,15,15,
SS_CENTERIMAGE | WS_DISABLED
EDITTEXT IDC_GLYPHSRANGETO_EDIT,105,215,25,12,ES_CENTER |
ES_AUTOHSCROLL | WS_DISABLED
CONTROL "From file:",IDC_GLYPHSFROMFILE_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_DISABLED,10,233,44,10
EDITTEXT IDC_GLYPHSFILE_EDIT,23,245,90,12,ES_AUTOHSCROLL |
WS_DISABLED
PUSHBUTTON "...",IDC_GLYPHSFILESELECTOR_BUTTON,117,245,15,12,
WS_DISABLED
GROUPBOX "Selected Glyph",IDC_SELECTEDGLYPH_GROUPBOX,5,289,130,
121,WS_DISABLED
CTEXT "Value",IDC_GLYPH_VALUE_LABEL,10,300,35,10,
SS_CENTERIMAGE | WS_DISABLED
CTEXT "",IDC_GLYPH_VALUE_STATIC,10,310,35,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "A",IDC_GLYPH_A_LABEL,60,300,20,10,SS_CENTERIMAGE |
WS_DISABLED
CTEXT "x",IDC_GLYPH_X_LABEL,9,324,20,10,SS_CENTERIMAGE |
WS_DISABLED
CTEXT "y",IDC_GLYPH_Y_LABEL,35,324,20,10,SS_CENTERIMAGE |
WS_DISABLED
CTEXT "w",IDC_GLYPH_W_LABEL,65,324,20,10,SS_CENTERIMAGE |
WS_DISABLED
CTEXT "h",IDC_GLYPH_H_LABEL,89,324,20,10,SS_CENTERIMAGE |
WS_DISABLED
CTEXT "B",IDC_GLYPH_B_LABEL,85,300,20,10,SS_CENTERIMAGE |
WS_DISABLED
CTEXT "C",IDC_GLYPH_C_LABEL,110,300,20,10,SS_CENTERIMAGE |
WS_DISABLED
CONTROL "Reserved for custom bitmap",IDC_GLYPH_SPECIAL,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,356,104,10
CTEXT "",IDC_GLYPH_X_STATIC,10,334,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "",IDC_GLYPH_Y_STATIC,35,334,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "",IDC_GLYPH_W_STATIC,65,334,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "",IDC_GLYPH_H_STATIC,90,334,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "",IDC_GLYPH_A_STATIC,60,310,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "",IDC_GLYPH_B_STATIC,85,310,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CTEXT "",IDC_GLYPH_C_STATIC,110,310,20,12,SS_CENTERIMAGE |
WS_DISABLED,WS_EX_CLIENTEDGE
CONTROL "Blurred",IDC_EFFECTSBLURRED_CHECK,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,97,50,10
CONTROL "ScanLines",IDC_EFFECTSSCANLINES_CHECK,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,114,50,10
EDITTEXT IDC_BLUR_EDIT,65,95,25,12,ES_CENTER | ES_AUTOHSCROLL |
WS_DISABLED
EDITTEXT IDC_SCANLINES_EDIT,65,114,25,12,ES_CENTER |
ES_AUTOHSCROLL | WS_DISABLED
CONTROL "Antialias",IDC_EFFECTSANTIALIAS_CHECK,"Button",
BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,130,50,10
CONTROL "Custom",IDC_GLYPHSCUSTOM_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_DISABLED | WS_GROUP,10,265,53,10
EDITTEXT IDC_INSERTGLYPH_EDIT,10,387,35,12,ES_CENTER |
ES_AUTOHSCROLL | WS_DISABLED
CTEXT "Width",IDC_TEXTUREWIDTH_LABEL,9,159,30,10,
SS_CENTERIMAGE | WS_DISABLED
END
IDD_TEXTURESIZE DIALOG 0, 0, 167, 49
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Texture Size"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Width",IDC_STATIC,5,5,19,15,SS_CENTERIMAGE
EDITTEXT IDC_WIDTH,35,5,40,15,ES_AUTOHSCROLL
LTEXT "Height",IDC_STATIC,5,25,25,15,SS_CENTERIMAGE
EDITTEXT IDC_HEIGHT,35,25,40,15,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,115,5,50,14
PUSHBUTTON "Cancel",IDCANCEL,115,25,50,14
END
IDD_ABOUT DIALOGEX 0, 0, 262, 123
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "About FontMaker"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,5,20,21,20
LTEXT "Xbox Font Maker tool - Modified for Valve Software",
IDC_STATIC,36,10,222,8
LTEXT "Version 2.0.0000.1 - Valve",IDC_STATIC,36,25,222,8
LTEXT "Copyright(c) 2000-2003 Microsoft Corporation. All rights reserved.",
IDC_STATIC,36,40,222,8
LTEXT "Warning: This computer program is protected by copyright law and",
IDC_STATIC,36,55,222,8
LTEXT "international treaties. Unauthorized reproduction or distribution of",
IDC_STATIC,36,65,222,8
LTEXT "this program, or any portion of it, may result in severe civil and",
IDC_STATIC,36,75,222,8
LTEXT "criminal penalties, and will be prosecuted to the maximum extent",
IDC_STATIC,36,85,222,8
LTEXT "possible under the law.",IDC_STATIC,36,95,222,8
DEFPUSHBUTTON "OK",IDOK,204,102,50,14
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOGBAR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 135
TOPMARGIN, 7
BOTTOMMARGIN, 411
END
IDD_TEXTURESIZE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 160
TOPMARGIN, 7
BOTTOMMARGIN, 42
END
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 255
TOPMARGIN, 7
BOTTOMMARGIN, 68
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "Load TTF Font...", IDM_FILE_NEWFONT
MENUITEM "Load Custom Font...", IDM_FILE_LOADFONTLAYOUT
MENUITEM "Load Compiled Font File...", IDM_FILE_LOADFONTFILE
MENUITEM SEPARATOR
MENUITEM "&Save Compiled Font...", IDM_FILE_SAVEFONTFILES
MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_FILE_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "FontMaker &Help\tF1", ID_HELP
MENUITEM SEPARATOR
MENUITEM "&About FontMaker...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDR_MAINFRAME "FontMaker\n\nFontMa\n\n\nFontMaker.Document\nFontMa Document"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+68
View File
@@ -0,0 +1,68 @@
//-----------------------------------------------------------------------------
// FONTMAKER.VPC
//
// Project Script
//-----------------------------------------------------------------------------
$Macro SRCDIR "..\..\.."
$Macro OUTBINDIR "$SRCDIR\devtools\bin"
$Include "$SRCDIR\vpc_scripts\source_exe_win_win32_base.vpc"
$Configuration
{
$Compiler
{
$EnableC++Exceptions "Yes (/EHsc)"
}
$Linker
{
$AdditionalDependencies "htmlhelp.lib"
}
}
$Project "FontMaker"
{
$Folder "Source Files"
{
-$File "$SRCDIR\public\tier0\memoverride.cpp"
$File "FontMaker.cpp"
$File "FontMakerWnd.cpp"
$File "Glyphs.cpp"
$File "..\toollib\piclib.cpp"
$File "..\toollib\scriplib.cpp"
$File "Stdafx.cpp"
{
$Configuration
{
$Compiler
{
$Create/UsePrecompiledHeader "Create Precompiled Header (/Yc)"
}
}
}
$File "..\toollib\toollib.cpp"
}
$Folder "Resource Files"
{
$File "FontMaker.ico"
$File "FontMaker.rc"
$File "resource.h"
}
$Folder "Header Files"
{
$File "..\..\..\public\BitmapFontFile.h"
$File "FontMaker.h"
$File "Glyphs.h"
$File "..\toollib\piclib.h"
$File "..\toollib\scriplib.h"
$File "Stdafx.h"
$File "..\toollib\toollib.h"
}
}
+396
View File
@@ -0,0 +1,396 @@
//-----------------------------------------------------------------------------
// Name: FontMakerWnd.cpp
//
// Desc: The window and scroll view class for the fontmaker app
//
// Hist: 09.06.02 - Revised Fontmaker sample
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include "FontMaker.h"
#include "Glyphs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CTextureFont g_Font;
BOOL g_bIsGlyphSelected = FALSE;
int g_iSelectedGlyphNum = 0;
WCHAR g_cSelectedGlyph = '\0';
GLYPH_ATTR* g_pSelectedGylph = NULL;
// Colors
#define COLOR_WHITE ( RGB(255,255,255) )
#define COLOR_BLACK ( RGB( 0, 0, 0) )
#define COLOR_BLUE ( RGB( 0, 0,255) )
#define COLOR_RED ( RGB(255, 0, 0) )
#define COLOR_DARKRED ( RGB(128, 0, 0) )
//-----------------------------------------------------------------------------
// CFontMakerFrameWnd
//-----------------------------------------------------------------------------
IMPLEMENT_DYNCREATE(CFontMakerFrameWnd, CFrameWnd)
BEGIN_MESSAGE_MAP(CFontMakerFrameWnd, CFrameWnd)
//{{AFX_MSG_MAP(CFontMakerFrameWnd)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
int CFontMakerFrameWnd::OnCreate( LPCREATESTRUCT pCreateStruct )
{
if( CFrameWnd::OnCreate( pCreateStruct ) == -1 )
return -1;
// Create a docked dialog bar
EnableDocking( CBRS_ALIGN_ANY );
if( !m_wndDialogBar.Create( this, IDD_DIALOGBAR,
CBRS_LEFT, IDD_DIALOGBAR ) )
{
TRACE0("Failed to create DlgBar\n");
return -1;
}
return 0;
}
//-----------------------------------------------------------------------------
// CFontMakerView
//-----------------------------------------------------------------------------
IMPLEMENT_DYNCREATE(CFontMakerView, CScrollView)
BEGIN_MESSAGE_MAP(CFontMakerView, CScrollView)
//{{AFX_MSG_MAP(CFontMakerView)
ON_WM_LBUTTONDOWN()
ON_WM_ERASEBKGND()
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
//-----------------------------------------------------------------------------
// Name: ~CFontMakerView()
// Desc: Destructor with special cleanup
//-----------------------------------------------------------------------------
CFontMakerView::~CFontMakerView()
{
// Cleanup before exitting
m_memDC.DeleteDC();
}
//-----------------------------------------------------------------------------
// Name: OnInitialUpdate()
// Desc: Called when the view is created.
//-----------------------------------------------------------------------------
void CFontMakerView::OnInitialUpdate()
{
// Set the scroll bars
CScrollView::OnInitialUpdate();
CSize szTotal( g_Font.m_dwTextureWidth, g_Font.m_dwTextureHeight );
SetScrollSizes( MM_TEXT, szTotal );
CPoint ptCenter( 0, 0 );
CenterOnPoint( ptCenter );
// Create a secondary DC, used for drawing
m_memDC.CreateCompatibleDC( GetDC() );
}
//-----------------------------------------------------------------------------
// Name: OnEraseBkgnd()
// Desc: Overridden function to prevent the view from flickering during resizes
// and redraws
//-----------------------------------------------------------------------------
BOOL CFontMakerView::OnEraseBkgnd( CDC* pDC )
{
return TRUE;
}
//-----------------------------------------------------------------------------
// Name: RenderSelectedGlyph()
// Desc: Highlight the selected glyph
//-----------------------------------------------------------------------------
VOID RenderSelectedGlyph( CDC* pDC )
{
// If no glyph is selected, return
if( FALSE == g_bIsGlyphSelected )
return;
HRGN rgn = CreateRectRgn( 0, 0, g_Font.m_dwTextureWidth, g_Font.m_dwTextureHeight );
SelectClipRgn( pDC->m_hDC, rgn );
// Draw a higlighted background for the selected glyph
{
int x = g_pSelectedGylph->x;
int y = g_pSelectedGylph->y;
int w = g_pSelectedGylph->w;
int h = g_pSelectedGylph->h;
pDC->FillSolidRect( x, y, w, h, COLOR_DARKRED );
}
// Setup the DC for drawing text
pDC->SetTextColor( COLOR_WHITE );
pDC->SelectObject( g_Font.m_hFont );
pDC->SetTextAlign( TA_LEFT|TA_TOP );
pDC->SetMapMode( MM_TEXT );
pDC->SetBkMode( TRANSPARENT );
pDC->SetBkColor( COLOR_BLUE );
CPen pen( PS_SOLID, 1, COLOR_RED );
pDC->SelectObject( &pen );
// Render the selected glyph
GLYPH_ATTR* pGlyph = g_pSelectedGylph;
{
WCHAR c = g_cSelectedGlyph;
WCHAR str[2] = L"A";
str[0] = c ? c : 0xffff;
if ( g_Font.m_ValidGlyphs[c] == 2 )
{
// Draw a square box for a placeholder for custom glyph graphics
pDC->FillSolidRect( pGlyph->x, pGlyph->y, pGlyph->w, pGlyph->h, COLOR_BLACK );
}
else
{
int sx = pGlyph->x;
int sy = pGlyph->y;
// Adjust ccordinates to account for the leading edge
if ( str[0] > 0x1000 )
{
}
else
{
sx -= pGlyph->a;
if ( g_Font.m_bOutlineEffect )
sx -= 1;
}
if ( g_Font.m_bOutlineEffect )
{
sx++;
sy++;
pDC->SetTextColor( COLOR_BLACK );
ExtTextOutW( pDC->m_hDC, sx-1, sy-1, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx+0, sy-1, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx+1, sy-1, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx-1, sy+0, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx+1, sy+0, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx-1, sy+1, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx+0, sy+1, ETO_OPAQUE, NULL, str, 1, NULL );
ExtTextOutW( pDC->m_hDC, sx+1, sy+1, ETO_OPAQUE, NULL, str, 1, NULL );
}
if ( g_Font.m_bShadowEffect )
{
pDC->SetTextColor( COLOR_BLACK );
ExtTextOutW( pDC->m_hDC, sx+2, sy+2, ETO_OPAQUE, NULL, str, 1, NULL );
}
// Output the letter
pDC->SetTextColor( COLOR_WHITE );
ExtTextOutW( pDC->m_hDC, sx, sy, ETO_OPAQUE, NULL, str, 1, NULL );
}
}
// Draw a red outline around the selected glyph
{
// Create a red pen
CPen pen( PS_SOLID, 1, COLOR_RED );
pDC->SelectObject( &pen );
// Draw the outline
int x1 = pGlyph->x - 1;
int y1 = pGlyph->y - 1;
int x2 = pGlyph->x + pGlyph->w;
int y2 = pGlyph->y + pGlyph->h;
pDC->MoveTo( x1, y1 );
pDC->LineTo( x2, y1 );
pDC->LineTo( x2, y2 );
pDC->LineTo( x1, y2 );
pDC->LineTo( x1, y1 );
}
SelectClipRgn( pDC->m_hDC, NULL );
DeleteObject( rgn );
}
//-----------------------------------------------------------------------------
// Name: OnDraw()
// Desc: Overridden draw function. Draws the font glyphs if a font is loaded,
// else just a black background.
//-----------------------------------------------------------------------------
VOID CFontMakerView::OnNewFontGlyphs()
{
// Select the resulting bits into our memory DC
static CBitmap Bitmap;
Bitmap.DeleteObject();
Bitmap.CreateBitmap( g_Font.m_dwTextureWidth, g_Font.m_dwTextureHeight, 1, 32, g_Font.m_pBits );
m_memDC.SelectObject( &Bitmap );
// Trigger the view to be re-drawn
OnUpdate(0,0,0);
}
//-----------------------------------------------------------------------------
// Name: OnDraw()
// Desc: Overridden draw function. Draws the font glyphs if a font is loaded,
// else just a black background.
//-----------------------------------------------------------------------------
VOID CFontMakerView::OnDraw( CDC* pDC )
{
RECT rc;
GetClientRect( &rc );
// Draw the view
if ( g_Font.m_hFont == NULL && !g_Font.m_pCustomFilename )
{
// Don't display any scroll bars
CSize sizeTotal( 0, 0 );
SetScrollSizes( MM_TEXT, sizeTotal );
// Draw a black background
pDC->FillSolidRect( 0, 0, rc.right, rc.bottom, COLOR_BLACK );
}
else
{
// Set the scroll sizes for the view
CSize sizeTotal( g_Font.m_dwTextureWidth, g_Font.m_dwTextureHeight );
SetScrollSizes( MM_TEXT, sizeTotal );
// Draw the view's black areas
pDC->FillSolidRect( g_Font.m_dwTextureWidth, 0, max( (int)g_Font.m_dwTextureWidth, rc.right), g_Font.m_dwTextureHeight, COLOR_BLACK );
pDC->FillSolidRect( 0, g_Font.m_dwTextureHeight, max( (int)g_Font.m_dwTextureWidth, rc.right), max( (int)g_Font.m_dwTextureHeight, rc.bottom), COLOR_BLACK );
// Display the bitmap of all the rendered glyphs
pDC->BitBlt( 0, 0, g_Font.m_dwTextureWidth, g_Font.m_dwTextureHeight, &m_memDC, 0, 0, SRCCOPY );
// Draw the selected glyph, if any
RenderSelectedGlyph( pDC );
}
}
//-----------------------------------------------------------------------------
// Name: OnLButtonDown()
// Desc: Overridden function to select a glyph when the user clicks the mouse.
//-----------------------------------------------------------------------------
void CFontMakerView::OnLButtonDown( UINT nFlags, CPoint point )
{
if ( !g_Font.m_hFont )
return;
// Correct the mouseclick point to account for the scroll position
point += GetScrollPosition();
// Find out which glyph, if any, is selected by the mouse click
theApp.UpdateSelectedGlyph( FALSE );
for( DWORD i=0; i<g_Font.m_dwNumGlyphs && g_Font.m_pGlyphs; i++ )
{
GLYPH_ATTR* pGlyph = &g_Font.m_pGlyphs[i];
if ( point.x >= pGlyph->x-2 && point.x <= pGlyph->x + pGlyph->w )
{
if ( point.y >= pGlyph->y-2 && point.y <= pGlyph->y + pGlyph->h )
{
theApp.UpdateSelectedGlyph( TRUE, i );
break;
}
}
}
// Redraw the view to show the newly selected glyph
Invalidate( TRUE );
// Call the base class' handler
CScrollView::OnLButtonDown( nFlags, point );
}
//-----------------------------------------------------------------------------
// Name: OnKeyDown()
// Desc: Overridden function to select a glyph with the keyboard.
//-----------------------------------------------------------------------------
void CFontMakerView::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags )
{
if ( !g_Font.m_hFont )
return;
if( g_Font.m_dwNumGlyphs > 0 )
{
if( FALSE == g_bIsGlyphSelected )
{
if( nChar == 37 || nChar == 38 || nChar == 39 || nChar == 40 ) // Left, right, up or down
{
// Select the first glyph
theApp.UpdateSelectedGlyph( TRUE, 0 );
}
}
else
{
if( nChar == 37 ) // Left
theApp.UpdateSelectedGlyph( TRUE, max( 0, g_iSelectedGlyphNum-1 ) );
else if( nChar == 39 ) // Right
theApp.UpdateSelectedGlyph( TRUE, min( (int)g_Font.m_dwNumGlyphs-1, g_iSelectedGlyphNum+1 ) );
else if( nChar == 38 || nChar == 40 ) // Up or down
{
// Find the closest glyph above or below to move to
int x = g_pSelectedGylph->x + g_pSelectedGylph->w/2;
int y = g_pSelectedGylph->y + g_pSelectedGylph->h/2;
if( nChar == 38 ) y -= g_pSelectedGylph->h;
if( nChar == 40 ) y += g_pSelectedGylph->h;
for( DWORD i=0; i<g_Font.m_dwNumGlyphs; i++ )
{
GLYPH_ATTR* pGlyph = &g_Font.m_pGlyphs[i];
if( x >= pGlyph->x-2 && x <= pGlyph->x + pGlyph->w )
{
if( y >= pGlyph->y-2 && y <= pGlyph->y + pGlyph->h )
{
theApp.UpdateSelectedGlyph( TRUE, i );
break;
}
}
}
}
else if ( nChar == 46 )
{
// delete a glyph
theApp.OnGlyphsCustom();
// mark glyph as invalid
g_Font.DeleteGlyph( g_cSelectedGlyph );
// reset to the first glyph
theApp.UpdateSelectedGlyph( FALSE );
}
else if ( nChar == 45 )
{
// insert a glyph
theApp.OnGlyphsCustom();
// reset to the first glyph
theApp.UpdateSelectedGlyph( FALSE );
theApp.InsertGlyph();
}
}
// Redraw the view to show the newly selected glyph
Invalidate( TRUE );
}
CScrollView::OnKeyDown( nChar, nRepCnt, nFlags );
}
File diff suppressed because it is too large Load Diff
+104
View File
@@ -0,0 +1,104 @@
//-----------------------------------------------------------------------------
// Name: Glyphs.cpp
//
// Desc: Functions and global variables for keeping track of font glyphs
//
// Hist: 09.06.02 - Revised Fontmaker sample
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef GLYPHS_H
#define GLYPHS_H
//-----------------------------------------------------------------------------
// Name: struct GLYPH_ATTR
// Desc: A structure to hold attributes for one glpyh. The left, right, etc.
// values are texture coordinate offsets into the resulting texture image
// (which ends up in the .tga file). The offset, width, etc. values are
// spacing information, used when rendering the font.
//-----------------------------------------------------------------------------
struct FILE_GLYPH_ATTR
{
FLOAT fLeft, fTop, fRight, fBottom;
};
struct GLYPH_ATTR : public FILE_GLYPH_ATTR
{
int a, b, c;
int x, y, w, h;
};
//-----------------------------------------------------------------------------
// Name: class CTextureFont
// Desc: A class to hold all information about a texture-based font
//-----------------------------------------------------------------------------
class CTextureFont
{
public:
// current ttf font
LOGFONT m_LogFont;
HFONT m_hFont;
BOOL m_bAntialiasEffect;
BOOL m_bShadowEffect;
BOOL m_bOutlineEffect;
int m_nBlur;
int m_nScanlines;
// Glyph info
BYTE* m_ValidGlyphs;
WCHAR m_cMaxGlyph;
WORD* m_TranslatorTable;
BOOL m_bIncludeNullCharacter;
DWORD m_dwNumGlyphs;
GLYPH_ATTR* m_pGlyphs;
// Texture info
DWORD m_dwTextureWidth;
DWORD m_dwTextureHeight;
DWORD* m_pBits;
CHAR m_strFontName[MAX_PATH];
// current custom font
const char *m_pCustomFilename;
unsigned char m_customGlyphs[256];
char *m_pCustomGlyphFiles[256];
int m_maxCustomCharHeight;
public:
HRESULT DeleteGlyph( WORD wGlyph );
HRESULT InsertGlyph( WORD wGlyph );
HRESULT ExtractValidGlyphsFromRange( WORD wStartGlyph, WORD wEndGlyph );
HRESULT ExtractValidGlyphsFromFile( const CHAR* strFileName );
HRESULT BuildTranslatorTable();
HRESULT CalculateAndRenderGlyphs();
HRESULT ReadCustomFontFile( CHAR* strFileName );
HRESULT ReadFontInfoFile( CHAR* strFileName );
HRESULT WriteFontInfoFile( CHAR* strFileName );
HRESULT WriteFontImageFile( CHAR* strFileName, bool bAdditiveMode, bool bCustomFont );
VOID ClearFont();
VOID DestroyObjects();
CTextureFont();
~CTextureFont();
private:
GLYPH_ATTR* RenderCustomGlyphs( HBITMAP hBitmap );
GLYPH_ATTR* RenderTTFGlyphs( HFONT hFont, HBITMAP hBitmap,
DWORD dwTextureWidth, DWORD dwTextureHeight,
BOOL bOutlineEffect, BOOL bShadowEffect,
int nScanlineEffect, int nBlurEffect,
BOOL bAntialias,
BYTE* ValidGlyphs, DWORD dwNumGlyphs );
};
#endif // GLYPHS_H
+80
View File
@@ -0,0 +1,80 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by fontmaker.rc
//
#define IDD_DIALOGBAR 103
#define IDD_TEXTURESIZE 104
#define IDR_MAINFRAME 128
#define IDD_ABOUT 132
#define IDC_GLYPHSFROMRANGE_RADIO 1007
#define IDC_GLYPHSFROMFILE_RADIO 1008
#define IDC_GLYPHSFILE_EDIT 1009
#define IDC_GLYPHSFILESELECTOR_BUTTON 1010
#define IDC_GLYPHSRANGEFROM_EDIT 1011
#define IDC_GLYPHSRANGETO_EDIT 1012
#define IDC_EFFECTSOUTLINED_CHECK 1013
#define IDC_EFFECTSSHADOWED_CHECK 1014
#define IDC_EFFECTSBLURRED_CHECK 1015
#define IDC_EFFECTSSCANLINES_CHECK 1016
#define IDC_BLUR_EDIT 1017
#define IDC_SCANLINES_EDIT 1018
#define IDC_EFFECTSANTIALIAS_CHECK 1019
#define IDC_GLYPHSCUSTOM_RADIO 1020
#define IDC_INSERTGLYPH_EDIT 1021
#define IDC_GLYPH_SPECIAL 1024
#define IDC_TEXTURESIZE_BUTTON 1026
#define IDC_FONTNAME_STATIC 1030
#define IDC_FONT_GROUPBOX 1031
#define IDC_GLYPHS_GROUPBOX 1032
#define IDC_FONTSTYLE_STATIC 1033
#define IDC_FONTSIZE_STATIC 1034
#define IDC_TEXTUREWIDTH_STATIC 1035
#define IDC_TEXTURE_GROUPBOX 1036
#define IDC_SELECTEDGLYPH_GROUPBOX 1037
#define IDC_FONTNAME_LABEL 1038
#define IDC_FONTSTYLE_LABEL 1039
#define IDC_FONTSIZE_LABEL 1040
#define IDC_INSERTGLYPH_LABEL 1041
#define IDC_TEXTUREHEIGHT_LABEL 1042
#define IDC_TEXTUREHEIGHT_STATIC 1043
#define IDC_GLYPHSRANGEFROM_LABEL 1044
#define IDC_GLYPHSRANGETO_LABEL 1045
#define IDC_WIDTH 1046
#define IDC_GLYPH_X_STATIC 1046
#define IDC_TEXTUREWIDTH_LABEL 1047
#define IDC_HEIGHT 1048
#define IDC_GLYPH_X_LABEL 1048
#define IDC_GLYPH_Y_LABEL 1049
#define IDC_GLYPH_W_LABEL 1050
#define IDC_GLYPH_H_LABEL 1051
#define IDC_GLYPH_A_LABEL 1052
#define IDC_GLYPH_B_LABEL 1053
#define IDC_GLYPH_C_LABEL 1054
#define IDC_MAGNIFY_BUTTON 1055
#define IDC_GLYPH_VALUE_LABEL 1056
#define IDC_USENTSCSAFECOLORS_CHECK 1057
#define IDC_GLYPH_Y_STATIC 1061
#define IDC_GLYPH_W_STATIC 1062
#define IDC_GLYPH_H_STATIC 1063
#define IDC_GLYPH_A_STATIC 1064
#define IDC_GLYPH_B_STATIC 1065
#define IDC_GLYPH_C_STATIC 1066
#define IDC_GLYPH_VALUE_STATIC 1067
#define IDM_FILE_EXIT 32778
#define IDM_FILE_NEWFONT 32782
#define IDM_FILE_SAVEFONTFILES 32784
#define ID_FILE_LOADFONTFILE 32788
#define IDM_FILE_LOADFONTFILE 32790
#define IDM_FILE_LOADFONTLAYOUT 32792
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32793
#define _APS_NEXT_CONTROL_VALUE 1058
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
+8
View File
@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// FontMaker.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
+27
View File
@@ -0,0 +1,27 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__797D2B31_3C16_4BE2_8C81_8C3E74DC9138__INCLUDED_)
#define AFX_STDAFX_H__797D2B31_3C16_4BE2_8C81_8C3E74DC9138__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include "tier0\wchartypes.h"
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__797D2B31_3C16_4BE2_8C81_8C3E74DC9138__INCLUDED_)