moved wxMGL's font management code to common so that it can be reused by wxDFB; implemented wxDFB part
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43550 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -79,6 +79,10 @@ public:
|
||||
virtual void SetUnderlined(bool underlined);
|
||||
virtual void SetEncoding(wxFontEncoding encoding);
|
||||
|
||||
// Unofficial API, don't use
|
||||
virtual void SetNoAntiAliasing(bool no = true);
|
||||
virtual bool GetNoAntiAliasing() const;
|
||||
|
||||
struct font_t *GetMGLfont_t(float scale, bool antialiased);
|
||||
|
||||
protected:
|
||||
|
@@ -1,124 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/mgl/fontutil.h
|
||||
// Purpose: font-related helper functions for MGL
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2001/05/01
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MGL_FONTUTIL_H_
|
||||
#define _WX_MGL_FONTUTIL_H_
|
||||
|
||||
#include "wx/list.h"
|
||||
|
||||
struct font_info_t;
|
||||
struct font_lib_t;
|
||||
struct font_t;
|
||||
|
||||
class wxMGLFontInstance;
|
||||
class wxMGLFontInstanceList;
|
||||
class wxMGLFontLibrary;
|
||||
class wxMGLFontFamily;
|
||||
|
||||
enum
|
||||
{
|
||||
wxFONTFACE_REGULAR = 0,
|
||||
wxFONTFACE_ITALIC = 1,
|
||||
wxFONTFACE_BOLD = 2, // = (regular | bold)
|
||||
wxFONTFACE_BOLD_ITALIC = 3, // = (italic | bold)
|
||||
|
||||
wxFONTFACE_MAX
|
||||
};
|
||||
|
||||
// structure representing particular loaded font instance:
|
||||
class wxMGLFontInstance
|
||||
{
|
||||
public:
|
||||
wxMGLFontInstance(wxMGLFontLibrary *fontLib, float pt, bool slant, bool aa);
|
||||
~wxMGLFontInstance();
|
||||
|
||||
struct font_t *GetMGLfont_t() const { return m_font; }
|
||||
|
||||
float GetPt() const { return m_pt; }
|
||||
bool GetSlant() const { return m_slant; }
|
||||
bool GetAA() const { return m_aa; }
|
||||
|
||||
private:
|
||||
wxMGLFontLibrary *m_fontLib;
|
||||
font_t *m_font;
|
||||
float m_pt;
|
||||
bool m_slant;
|
||||
bool m_aa;
|
||||
};
|
||||
|
||||
// structure representing loaded font library:
|
||||
class wxMGLFontLibrary
|
||||
{
|
||||
public:
|
||||
wxMGLFontLibrary(const wxString& filename, int type, wxMGLFontFamily *parentFamily);
|
||||
~wxMGLFontLibrary();
|
||||
|
||||
wxMGLFontInstance *GetFontInstance(wxFont *font, float scale, bool aa);
|
||||
wxMGLFontFamily *GetFamily() const { return m_family; }
|
||||
|
||||
void IncRef();
|
||||
void DecRef();
|
||||
|
||||
struct font_lib_t *GetMGLfont_lib_t() const { return m_fontLib; }
|
||||
|
||||
private:
|
||||
font_lib_t *m_fontLib;
|
||||
int m_type;
|
||||
wxString m_fileName;
|
||||
size_t m_refs;
|
||||
wxMGLFontInstanceList *m_instances;
|
||||
wxMGLFontFamily *m_family;
|
||||
};
|
||||
|
||||
// structure representing native MGL font family
|
||||
class wxMGLFontFamily : public wxObject
|
||||
{
|
||||
public:
|
||||
wxMGLFontFamily(const font_info_t *info);
|
||||
virtual ~wxMGLFontFamily();
|
||||
|
||||
wxString GetName() const { return m_name; }
|
||||
const font_info_t *GetInfo() const { return m_fontInfo; }
|
||||
|
||||
bool HasFace(int type) const;
|
||||
wxMGLFontLibrary *GetLibrary(int type) const
|
||||
{ return m_fontLibs[type]; }
|
||||
|
||||
private:
|
||||
wxString m_name;
|
||||
const font_info_t *m_fontInfo;
|
||||
wxMGLFontLibrary *m_fontLibs[wxFONTFACE_MAX];
|
||||
};
|
||||
|
||||
WX_DECLARE_LIST(wxMGLFontFamily, wxMGLFontFamilyList);
|
||||
|
||||
class wxFontsManager
|
||||
{
|
||||
public:
|
||||
wxFontsManager();
|
||||
~wxFontsManager();
|
||||
|
||||
void AddFamily(const font_info_t *info);
|
||||
|
||||
// return info about font with given name:
|
||||
wxMGLFontFamily *GetFamily(const wxString& name) const;
|
||||
// return list of all families
|
||||
wxMGLFontFamilyList *GetFamilyList() { return m_list; }
|
||||
|
||||
wxMGLFontLibrary *GetFontLibrary(wxFont *font);
|
||||
|
||||
private:
|
||||
wxHashTable *m_hash;
|
||||
wxMGLFontFamilyList *m_list;
|
||||
};
|
||||
|
||||
extern wxFontsManager *wxTheFontsManager;
|
||||
|
||||
#endif // _WX_MGL_FONTUTIL_H_
|
77
include/wx/mgl/private/fontmgr.h
Normal file
77
include/wx/mgl/private/fontmgr.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/mgl/private/fontmgr.h
|
||||
// Purpose: font management for MGL
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-11-18
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MGL_PRIVATE_FONTMGR_H_
|
||||
#define _WX_MGL_PRIVATE_FONTMGR_H_
|
||||
|
||||
struct font_info_t;
|
||||
struct font_lib_t;
|
||||
struct font_t;
|
||||
|
||||
class wxFontInstance : public wxFontInstanceBase
|
||||
{
|
||||
public:
|
||||
wxFontInstance(float ptSize, bool aa, font_lib_t *fontLib);
|
||||
virtual ~wxFontInstance();
|
||||
|
||||
struct font_t *GetMGLfont_t() const { return m_font; }
|
||||
|
||||
private:
|
||||
font_t *m_font;
|
||||
};
|
||||
|
||||
class wxFontFace : public wxFontFaceBase
|
||||
{
|
||||
public:
|
||||
wxFontFace(const wxString& filename)
|
||||
: m_fontLib(NULL), m_fileName(filename) {}
|
||||
|
||||
virtual void Acquire();
|
||||
virtual void Release();
|
||||
|
||||
virtual wxFontInstance *GetFontInstance(float ptSize, bool aa);
|
||||
|
||||
protected:
|
||||
wxFontInstance *CreateFontInstance(float ptSize, bool aa);
|
||||
|
||||
private:
|
||||
font_lib_t *m_fontLib;
|
||||
wxString m_fileName;
|
||||
};
|
||||
|
||||
class wxFontBundle : public wxFontBundleBase
|
||||
{
|
||||
public:
|
||||
wxFontBundle(const font_info_t *fontInfo);
|
||||
|
||||
virtual wxString GetName() const
|
||||
{ return wxString::FromAscii(m_fontInfo->familyName); }
|
||||
|
||||
virtual bool IsFixed() const { return m_fontInfo->isFixed; }
|
||||
|
||||
const font_info_t *GetInfo() const { return m_fontInfo; }
|
||||
|
||||
private:
|
||||
const font_info_t *m_fontInfo;
|
||||
};
|
||||
|
||||
class wxFontsManager : public wxFontsManagerBase
|
||||
{
|
||||
public:
|
||||
wxFontsManager() { AddAllFonts(); }
|
||||
|
||||
virtual wxString GetDefaultFacename(wxFontFamily family) const;
|
||||
|
||||
private:
|
||||
// adds all fonts using AddBundle()
|
||||
void AddAllFonts();
|
||||
};
|
||||
|
||||
#endif // _WX_MGL_PRIVATE_FONTMGR_H_
|
Reference in New Issue
Block a user