Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to enum installed (ttf) fonts #340748
09/07/10 13:47
09/07/10 13:47
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline OP
Senior Member
3dgs_snake  Offline OP
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Hi,

I just wanted to ask if it is possible to show the font selection dialog - ChooseFont with LOGFONT and CHOOSEFONT structs - (I have tried and failed blush ). I want this because i want to make a graphical font generator to use with the engine. That would also be great if someone can point me to an already made graphical font generator in the format required by 3dgs (no further editing).

this the code :

#include <acknex.h>
#include <windows.h>
#include <default.c>

typedef char TCHAR;
typedef int INT;
typedef char* LPTSTR;
typedef const char* LPCTSTR;

//////////////////////////////
// LOGFONT struct
//////////////////////////////
typedef struct tagLOGFONT {
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT;
typedef LOGFONT* PLOGFONT ;
typedef LOGFONT* LPLOGFONT ;

//////////////////////////////
// CHOOSEFONT struct
//////////////////////////////
/*UINT (APIENTRY* LPCFHOOKPROC)(
HWND hdlg,
UINT uiMsg,
WPARAM wParam,
LPARAM lParam
);*/
typedef UINT LPCFHOOKPROC;


typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HDC hDC;
LPLOGFONT lpLogFont;
INT iPointSize;
DWORD Flags;
COLORREF rgbColors;
LPARAM lCustData;
/*LPCFHOOKPROC lpfnHook;*/
LPCFHOOKPROC lpfnHook(HWND hdlg,UINT uiMsg,WPARAM wParam,LPARAM lParam);
// function pointer

LPCTSTR lpTemplateName;
HINSTANCE hInstance;
LPTSTR lpszStyle;
WORD nFontType;
INT nSizeMin;
INT nSizeMax;
} CHOOSEFONT;
typedef CHOOSEFONT* PCHOOSEFONT;
typedef CHOOSEFONT* LPCHOOSEFONT;


BOOL WINAPI ChooseFont(CHOOSEFONT* lpcf);
#define PRAGMA_API ChooseFont;comdlg32!ChooseFontA

//////////////////////////////
// Main
//////////////////////////////
void main()
{
wait(-1) ;

CHOOSEFONT cf;
int cyChar;
LOGFONT lf;
TCHAR szText[] = {'1','2','3','4','5'};

GetObject (GetStockObject (SYSTEM_FONT), sizeof (lf), &lf) ;
//printf("%s", lf.lfFaceName);

// Inialize the CHOOSEFONT structure
cf.lStructSize = sizeof (CHOOSEFONT) ;
cf.hwndOwner = NULL ;
cf.hDC = NULL ;
cf.lpLogFont = &lf ;
cf.iPointSize = 0 ;
cf.Flags = CF_INITTOLOGFONTSTRUCT |
CF_SCREENFONTS | CF_EFFECTS ;
cf.rgbColors = 0 ;
cf.lCustData = 0 ;
cf.lpfnHook = NULL ;
cf.lpTemplateName = NULL ;
cf.hInstance = NULL ;
cf.lpszStyle = NULL ;
cf.nFontType = 0 ;
cf.nSizeMin = 0 ;
cf.nSizeMax = 0 ;

ChooseFont (&cf);

}

Thanks in advance, and sorry for my bad english.

Re: How to enum installed (ttf) fonts [Re: 3dgs_snake] #349639
12/09/10 19:13
12/09/10 19:13
Joined: Mar 2009
Posts: 42
Dominican Republic
keilyn3d Offline
Newbie
keilyn3d  Offline
Newbie

Joined: Mar 2009
Posts: 42
Dominican Republic
maybe you don't need it still, but if some one need it:

only change the line:
Code:
WORD nFontType;


to:
Code:
DWORD nFontType;



here is your code repaired:

Code:
#include <acknex.h>
#include <windows.h>
#include <default.c>

typedef char TCHAR;
typedef int INT;
typedef char* LPTSTR;
typedef const char* LPCTSTR;

//////////////////////////////
// LOGFONT struct
//////////////////////////////
typedef struct tagLOGFONT {
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT;
typedef LOGFONT* PLOGFONT ;
typedef LOGFONT* LPLOGFONT ;

//////////////////////////////
// CHOOSEFONT struct
//////////////////////////////
/*UINT (APIENTRY* LPCFHOOKPROC)(
HWND hdlg,
UINT uiMsg,
WPARAM wParam,
LPARAM lParam
);*/
typedef UINT LPCFHOOKPROC;


typedef struct {
DWORD lStructSize;
HWND hwndOwner;
HDC hDC;
LPLOGFONT lpLogFont;
INT iPointSize;
DWORD Flags;
COLORREF rgbColors;
LPARAM lCustData;
/*LPCFHOOKPROC lpfnHook;*/
LPCFHOOKPROC lpfnHook(HWND hdlg,UINT uiMsg,WPARAM wParam,LPARAM lParam);
// function pointer

LPCTSTR lpTemplateName;
HINSTANCE hInstance;
LPTSTR lpszStyle;
DWORD nFontType;
INT nSizeMin;
INT nSizeMax;
} CHOOSEFONT;
typedef CHOOSEFONT* PCHOOSEFONT;
typedef CHOOSEFONT* LPCHOOSEFONT;


BOOL WINAPI ChooseFont(CHOOSEFONT* lpcf);
#define PRAGMA_API ChooseFont;comdlg32!ChooseFontA

//////////////////////////////
// Main
//////////////////////////////
void main()
{
wait(-1) ;

CHOOSEFONT cf;
int cyChar;
LOGFONT lf;
TCHAR szText[] = {'1','2','3','4','5'};

GetObject (GetStockObject (SYSTEM_FONT), sizeof (lf), &lf) ; 
//printf("%s", lf.lfFaceName);

// Inialize the CHOOSEFONT structure
cf.lStructSize = sizeof (CHOOSEFONT) ;
cf.hwndOwner = NULL ;
cf.hDC = NULL ;
cf.lpLogFont = &lf ;
cf.iPointSize = 0 ;
cf.Flags = CF_INITTOLOGFONTSTRUCT |
CF_SCREENFONTS | CF_EFFECTS ;
cf.rgbColors = 0 ;
cf.lCustData = 0 ;
cf.lpfnHook = NULL ;
cf.lpTemplateName = NULL ;
cf.hInstance = NULL ;
cf.lpszStyle = NULL ;
cf.nFontType = 0 ; 
cf.nSizeMin = 0 ;
cf.nSizeMax = 0 ;

ChooseFont (&cf);

}




Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1