1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: font.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-29 13:03:18 -05:00
|
|
|
// Id: $Id$
|
1998-05-20 10:01:55 -04:00
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
1998-12-09 12:30:17 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKFONTH__
|
|
|
|
#define __GTKFONTH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/hash.h"
|
|
|
|
#include "wx/gdiobj.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxDC;
|
|
|
|
class wxPaintDC;
|
|
|
|
class wxWindow;
|
|
|
|
|
|
|
|
class wxFont;
|
|
|
|
class wxFontNameDirectory;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// global variables
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-18 08:35:58 -05:00
|
|
|
extern wxFontNameDirectory *wxTheFontNameDirectory;
|
|
|
|
extern const char* wxEmptyString;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxFont
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-09 12:30:17 -05:00
|
|
|
class wxFont: public wxGDIObject
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxFont)
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1998-12-18 08:35:58 -05:00
|
|
|
public:
|
|
|
|
wxFont();
|
|
|
|
wxFont( int pointSize, int family, int style, int weight, bool underlined = FALSE,
|
|
|
|
const wxString& face = wxEmptyString );
|
|
|
|
wxFont( const wxFont& font );
|
|
|
|
~wxFont();
|
|
|
|
wxFont& operator = ( const wxFont& font );
|
|
|
|
bool operator == ( const wxFont& font );
|
|
|
|
bool operator != ( const wxFont& font );
|
|
|
|
bool Ok() const;
|
|
|
|
|
|
|
|
int GetPointSize() const;
|
|
|
|
int GetFamily() const;
|
|
|
|
int GetFontId() const;
|
|
|
|
int GetStyle() const;
|
|
|
|
int GetWeight() const;
|
|
|
|
bool GetUnderlined() const;
|
|
|
|
|
|
|
|
void SetPointSize( int pointSize );
|
|
|
|
void SetFamily( int family );
|
|
|
|
void SetStyle( int style );
|
|
|
|
void SetWeight( int weight );
|
|
|
|
void SetFaceName( const wxString& faceName );
|
|
|
|
void SetUnderlined( bool underlined );
|
|
|
|
|
|
|
|
wxString GetFaceName() const;
|
|
|
|
wxString GetFamilyString() const;
|
|
|
|
wxString GetStyleString() const;
|
|
|
|
wxString GetWeightString() const;
|
|
|
|
|
1998-12-09 12:30:17 -05:00
|
|
|
// implementation
|
1998-12-18 08:35:58 -05:00
|
|
|
|
|
|
|
wxFont( char *xFontName );
|
|
|
|
void Unshare();
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1998-12-18 08:35:58 -05:00
|
|
|
GdkFont* GetInternalFont(float scale = 1.0) const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1998-12-18 08:35:58 -05:00
|
|
|
// no data :-)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxFontDirectory
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1998-12-09 12:30:17 -05:00
|
|
|
class wxFontNameDirectory: public wxObject
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxFontNameDirectory)
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
public:
|
1998-12-09 12:30:17 -05:00
|
|
|
wxFontNameDirectory();
|
1998-05-20 10:01:55 -04:00
|
|
|
~wxFontNameDirectory();
|
|
|
|
|
1998-12-09 12:30:17 -05:00
|
|
|
void Initialize();
|
1998-05-20 10:01:55 -04:00
|
|
|
void Initialize(int fontid, int family, const char *name);
|
|
|
|
|
|
|
|
int FindOrCreateFontId(const char *name, int family);
|
|
|
|
char* GetAFMName(int fontid, int weight, int style);
|
|
|
|
int GetFamily(int fontid);
|
|
|
|
int GetFontId(const char *name);
|
|
|
|
char* GetFontName(int fontid);
|
1998-12-09 12:30:17 -05:00
|
|
|
int GetNewFontId();
|
1998-05-20 10:01:55 -04:00
|
|
|
char* GetPostScriptName(int fontid, int weight, int style);
|
|
|
|
char* GetScreenName(int fontid, int weight, int style);
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
class wxHashTable *table;
|
|
|
|
int nextFontId;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __GTKFONTH__
|