void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
- void SetFaceName(wxString facename);
+ bool SetFaceName(wxString facename);
void SetFamily(wxFontFamily family);
void SetEncoding(wxFontEncoding encoding);
+// TODO:
+// // sets the first facename in the given array which is found
+// // to be valid. If no valid facename is given, sets the
+// // first valid facename returned by wxFontEnumerator::GetFacenames().
+// // Does not return a bool since it cannot fail.
+// void SetFaceName(const wxArrayString &facenames);
+
+
// it is important to be able to serialize wxNativeFontInfo objects to be
// able to store them (in config file, for example)
bool FromString(const wxString& s);
// return instance of the wxFontMapper singleton
static wxFontMapper *Get();
- // set the sigleton to 'mapper' instance and return previous one
+ // set the singleton to 'mapper' instance and return previous one
static wxFontMapper *Set(wxFontMapper *mapper);
// get the n-th supported encoding
static wxFontEncoding GetEncoding(size_t n);
- // return internal string identifier for the encoding (see also
- // GetEncodingDescription())
+ // return canonical name of this encoding (this is a short string,
+ // GetEncodingDescription() returns a longer one)
static wxString GetEncodingName(wxFontEncoding encoding);
+// // return a list of all names of this encoding (see GetEncodingName)
+// static const wxChar** GetAllEncodingNames(wxFontEncoding encoding);
+
// return user-readable string describing the given encoding
//
// NB: hard-coded now, but might change later (read it from config?)
static wxFontEncoding GetEncodingFromName(const wxString& name);
- // set the config object to use (may be NULL to use default)
- void SetConfig(wxConfigBase *config);
-
// set the root config path to use (should be an absolute path)
void SetConfigPath(const wxString& prefix);
"Sets the font weight.", "");
DocDeclStr(
- virtual void , SetFaceName( const wxString& faceName ),
+ virtual bool , SetFaceName( const wxString& faceName ),
"Sets the facename for the font. The facename, which should be a valid
font installed on the end-user's system.
DocDeclStrName(
- void , SetNativeFontInfo(const wxString& info),
+ bool , SetNativeFontInfo(const wxString& info),
"Set the font's attributes from string representation of a
`wx.NativeFontInfo` object.", "",
SetNativeFontInfoFromString);
DocDeclStr(
- void , SetNativeFontInfoUserDesc(const wxString& info),
+ bool , SetNativeFontInfoUserDesc(const wxString& info),
"Set the font's attributes from a string formerly returned from
`GetNativeFontInfoDesc`.", "");
bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);
- //wxArrayString* GetEncodings();
- //wxArrayString* GetFacenames();
%extend {
- PyObject* GetEncodings() {
- wxArrayString* arr = self->GetEncodings();
- if (arr)
- return wxArrayString2PyList_helper(*arr);
- else
- return PyList_New(0);
+ static PyObject* GetEncodings() {
+ PyObject* ret;
+ wxArrayString arr = wxFontEnumerator::GetEncodings();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
+ ret = wxArrayString2PyList_helper(arr);
+ wxPyEndBlockThreads(blocked);
+ return ret;
}
- PyObject* GetFacenames() {
- wxArrayString* arr = self->GetFacenames();
- if (arr)
- return wxArrayString2PyList_helper(*arr);
- else
- return PyList_New(0);
+ static PyObject* GetFacenames() {
+ PyObject* ret;
+ wxArrayString arr = wxFontEnumerator::GetFacenames();
+ wxPyBlock_t blocked = wxPyBeginBlockThreads();
+ ret = wxArrayString2PyList_helper(arr);
+ wxPyEndBlockThreads(blocked);
+ return ret;
}
}
+
+ DocDeclStr(
+ static bool , IsValidFacename(const wxString &str),
+ "Convenience function that returns true if the given face name exist in
+the user's system", "");
+
};