#include "helpers.h"
#include <wx/fontmap.h>
#include <wx/fontenc.h>
-#include <wx/fontmap.h>
#include <wx/fontutil.h>
#include <wx/fontenum.h>
#include <wx/intl.h>
};
+
// font encodings
enum wxFontEncoding
{
// and for Windows
wxFONTENCODING_CP874, // WinThai
wxFONTENCODING_CP932, // Japanese (shift-JIS)
- wxFONTENCODING_CP936, // Chiniese simplified (GB)
+ wxFONTENCODING_CP936, // Chinese simplified (GB)
wxFONTENCODING_CP949, // Korean (Hangul charset)
wxFONTENCODING_CP950, // Chinese (traditional - Big5)
wxFONTENCODING_CP1250, // WinLatin2
wxFONTENCODING_UTF7, // UTF-7 Unicode encoding
wxFONTENCODING_UTF8, // UTF-8 Unicode encoding
- wxFONTENCODING_UNICODE, // Unicode - currently used only by
- // wxEncodingConverter class
+ // Far Eastern encodings
+ // Chinese
+ wxFONTENCODING_GB2312 = wxFONTENCODING_CP936, // Simplified Chinese
+ wxFONTENCODING_BIG5 = wxFONTENCODING_CP950, // Traditional Chinese
+
+ // Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html)
+ wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, // Shift JIS
+ wxFONTENCODING_EUC_JP = wxFONTENCODING_UTF8 + 1, // Extended Unix Codepage
+ // for Japanese
+
+ wxFONTENCODING_UNICODE, // Unicode (for wxEncodingConverter only)
wxFONTENCODING_MAX
};
-
//---------------------------------------------------------------------------
// wxNativeFontInfo is platform-specific font representation: this struct
// should be considered as opaque font description only used by the native
// ToString() and restore them using FromString())
struct wxNativeFontInfo
{
-#ifdef __WXGTK__
- // init the elements from an XLFD, return TRUE if ok
- bool FromXFontName(const wxString& xFontName);
-
- // return false if we were never initialized with a valid XLFD
- bool IsDefault() const;
-
- // generate an XLFD using the fontElements
- wxString GetXFontName() const;
-
- // set the XFLD
- void SetXFontName(const wxString& xFontName);
-#endif
-
- wxNativeFontInfo() { Init(); }
+ wxNativeFontInfo();
// reset to the default state
void Init();
-#ifndef __WXGTK__
// accessors and modifiers for the font elements
int GetPointSize() const;
wxFontStyle GetStyle() const;
void SetFaceName(wxString facename);
void SetFamily(wxFontFamily family);
void SetEncoding(wxFontEncoding encoding);
-#endif
// it is important to be able to serialize wxNativeFontInfo objects to be
// able to store them (in config file, for example)
};
+%{
+// Fix some link errors... Remove this when these methods get real implementations...
+#if defined(__WXGTK__) || defined(__WXX11__)
+#if wxUSE_PANGO
+void wxNativeFontInfo::SetPointSize(int pointsize)
+ { wxFAIL_MSG( _T("not implemented") ); }
+
+void wxNativeFontInfo::SetStyle(wxFontStyle style)
+ { wxFAIL_MSG( _T("not implemented") ); }
+
+void wxNativeFontInfo::SetWeight(wxFontWeight weight)
+ { wxFAIL_MSG( _T("not implemented") ); }
+
+void wxNativeFontInfo::SetUnderlined(bool WXUNUSED(underlined))
+ { wxFAIL_MSG( _T("not implemented") ); }
+
+void wxNativeFontInfo::SetFaceName(wxString facename)
+ { wxFAIL_MSG( _T("not implemented") ); }
+
+void wxNativeFontInfo::SetFamily(wxFontFamily family)
+ { wxFAIL_MSG( _T("not implemented") ); }
+
+void wxNativeFontInfo::SetEncoding(wxFontEncoding encoding)
+ { wxFAIL_MSG( _T("not implemented") ); }
+#endif
+#endif
+%}
+
//---------------------------------------------------------------------------
// wxFontMapper manages user-definable correspondence between logical font
// names and the fonts present on the machine.
wxFontMapper();
~wxFontMapper();
+ // return instance of the wxFontMapper singleton
+ static wxFontMapper *Get();
+ // set the sigleton to 'mapper' instance and return previous one
+ static wxFontMapper *Set(wxFontMapper *mapper);
+
// find an alternative for the given encoding (which is supposed to not be
// available on this system). If successful, return TRUE and rwxFontEcoding
wxFontEncoding encoding=wxFONTENCODING_DEFAULT);
%name(wxFontFromNativeInfo)wxFont(const wxNativeFontInfo& info);
+ %addmethods {
+ %new wxFont* wxFontFromNativeInfoString(const wxString& info) {
+ wxNativeFontInfo nfi;
+ nfi.FromString(info);
+ return new wxFont(nfi);
+ }
+ }
~wxFont();
wxString GetStyleString() const;
wxString GetWeightString() const;
+ void SetNoAntiAliasing( bool no = TRUE );
+ bool GetNoAntiAliasing();
+
static wxFontEncoding GetDefaultEncoding();
static void SetDefaultEncoding(wxFontEncoding encoding);
enum wxLanguage
{
+ // user's default/preffered language as got from OS:
wxLANGUAGE_DEFAULT,
+ // unknown language, if wxLocale::GetSystemLanguage fails:
wxLANGUAGE_UNKNOWN,
wxLANGUAGE_ABKHAZIAN,
wxLocale(int language = wxLANGUAGE_DEFAULT,
int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING);
- // the same as a function (returns TRUE on success)
- bool Init(const wxString& szName,
- const wxString& szShort = wxPyEmptyString,
- const wxString& szLocale = wxPyEmptyString,
- bool bLoadDefault = TRUE,
- bool bConvertEncoding = FALSE);
-
// restores old locale
~wxLocale();
+ %name(Init1)bool Init(const wxString& szName,
+ const wxString& szShort = wxPyEmptyString,
+ const wxString& szLocale = wxPyEmptyString,
+ bool bLoadDefault = TRUE,
+ bool bConvertEncoding = FALSE);
+
+ %name(Init2) bool Init(int language = wxLANGUAGE_DEFAULT,
+ int flags = wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING);
+
+ %pragma(python) addtoclass = "
+ def Init(self, *_args, **_kwargs):
+ if type(_args[0]) in [type(''), type(u'')]:
+ val = apply(self.Init1, _args, _kwargs)
+ else:
+ val = apply(self.Init2, _args, _kwargs)
+ return val
+ "
+
+
// Try to get user's (or OS's) prefered language setting.
// Return wxLANGUAGE_UNKNOWN if language-guessing algorithm failed
static int GetSystemLanguage();
// check if the given catalog is loaded
bool IsLoaded(const wxString& szDomain) const;
+ // Retrieve the language info struct for the given language
+ //
+ // Returns NULL if no info found, pointer must *not* be deleted by caller
+ static const wxLanguageInfo *GetLanguageInfo(int lang);
+
+ // Find the language for the given locale string which may be either a
+ // canonical ISO 2 letter language code ("xx"), a language code followed by
+ // the country code ("xx_XX") or a Windows full language name ("Xxxxx...")
+ //
+ // Returns NULL if no info found, pointer must *not* be deleted by caller
+ static const wxLanguageInfo *FindLanguageInfo(const wxString& locale);
+
// Add custom language to the list of known languages.
// Notes: 1) wxLanguageInfo contains platform-specific data
// 2) must be called before Init to have effect
// or output encoding is not supported.)
bool Init(wxFontEncoding input_enc, wxFontEncoding output_enc, int method = wxCONVERT_STRICT);
+
+ // TODO: Need to do something about unicode mode...
+
// Convert input string according to settings passed to Init.
// Note that you must call Init before using Convert!
wxString Convert(const wxString& input);
// #endif
+
// Return equivalent(s) for given font that are used
// under given platform. wxPLATFORM_CURRENT means the plaform
// this binary was compiled for