]> git.saurik.com Git - wxWidgets.git/commitdiff
wxFont::IsFixedWidth for wxMGL
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 17 Jan 2002 19:38:39 +0000 (19:38 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 17 Jan 2002 19:38:39 +0000 (19:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mgl/font.h
include/wx/mgl/fontutil.h
src/mgl/font.cpp
src/mgl/fontutil.cpp

index 29f2fd60930e996e80f7cd85b7ffc894aa084ba4..4aed3d6dfb59041a6c4c2039a417c2346b1aa302 100644 (file)
@@ -80,6 +80,7 @@ public:
     virtual wxString GetFaceName() const;
     virtual bool GetUnderlined() const;
     virtual wxFontEncoding GetEncoding() const;
+    virtual bool IsFixedWidth() const;
 
     virtual void SetPointSize(int pointSize);
     virtual void SetFamily(int family);
index 6f353a4d4a5f569928b4fd8815efe955b8e43585..f83849b133e6b42a84c7c9de734087da1675de2d 100644 (file)
@@ -57,10 +57,11 @@ private:
 class wxMGLFontLibrary
 {
 public:
-    wxMGLFontLibrary(const wxString& filename, int type);
+    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();
@@ -73,6 +74,7 @@ private:
     wxString m_fileName;
     size_t m_refs;
     wxMGLFontInstanceList *m_instances;
+    wxMGLFontFamily *m_family;
 };
 
 // structure representing native MGL font family
index ff9f73343d4d64d5a113834a7a3ffe666976a056..3120a1d59f097a0c2ff4b6c1a99f1f6095930e88 100644 (file)
@@ -33,6 +33,7 @@
 #include "wx/gdicmn.h"
 #include "wx/tokenzr.h"
 #include "wx/settings.h"
+#include "wx/mgl/private.h"
 
 // ----------------------------------------------------------------------------
 // wxFontRefData
@@ -259,6 +260,13 @@ wxFontEncoding wxFont::GetEncoding() const
     return M_FONTDATA->m_encoding;
 }
 
+bool wxFont::IsFixedWidth() const
+{
+    wxCHECK_MSG( Ok(), FALSE, wxT("invalid font") );
+
+    return (bool)(M_FONTDATA->m_library->GetFamily()->GetInfo()->isFixed);
+}
+
 
 // ----------------------------------------------------------------------------
 // change font attributes
index 59eb52336374f23154cb01c2c47c25f59e83d234..85b76d080aab42f506f6e702ac69d54a0726c346 100644 (file)
@@ -189,8 +189,10 @@ wxMGLFontInstance::~wxMGLFontInstance()
         MGL_unloadFontInstance(m_font);
 }
     
-wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type)
+wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type, 
+                                   wxMGLFontFamily *parentFamily)
 {
+    m_family = parentFamily;
     m_type = type;
     m_fileName = filename;
     m_refs = 0;
@@ -299,25 +301,25 @@ wxMGLFontFamily::wxMGLFontFamily(const font_info_t *info)
         m_fontLibs[wxFONTFACE_REGULAR] = NULL;
     else
         m_fontLibs[wxFONTFACE_REGULAR] = 
-            new wxMGLFontLibrary(info->regularFace, wxFONTFACE_REGULAR);
+            new wxMGLFontLibrary(info->regularFace, wxFONTFACE_REGULAR, this);
     
     if ( info->italicFace[0] == '\0' )
         m_fontLibs[wxFONTFACE_ITALIC] = NULL;
     else
         m_fontLibs[wxFONTFACE_ITALIC] = 
-            new wxMGLFontLibrary(info->italicFace, wxFONTFACE_ITALIC);
+            new wxMGLFontLibrary(info->italicFace, wxFONTFACE_ITALIC, this);
     
     if ( info->boldFace[0] == '\0' )
         m_fontLibs[wxFONTFACE_BOLD] = NULL;
     else
         m_fontLibs[wxFONTFACE_BOLD] = 
-            new wxMGLFontLibrary(info->boldFace, wxFONTFACE_BOLD);
+            new wxMGLFontLibrary(info->boldFace, wxFONTFACE_BOLD, this);
     
     if ( info->boldItalicFace[0] == '\0' )
         m_fontLibs[wxFONTFACE_BOLD_ITALIC] = NULL;
     else
         m_fontLibs[wxFONTFACE_BOLD_ITALIC] = 
-            new wxMGLFontLibrary(info->boldItalicFace, wxFONTFACE_BOLD_ITALIC);
+            new wxMGLFontLibrary(info->boldItalicFace, wxFONTFACE_BOLD_ITALIC, this);
             
     wxLogTrace("mgl_font", "new family '%s' (r=%s, i=%s, b=%s, bi=%s)\n",
                info->familyName, info->regularFace, info->italicFace,