From: Kevin A. <al...@se...> - 2001-08-24 16:36:47
|
If you know anything about fonts, programming issues around fonts, cross-platform font issues, wxPython font issues, cascading style sheets (CSS), etc. or just have some opinions on what you want in terms of font support, please contribute to this thread on the list. Fonts are not a speciality of mine, so if I end up doing this one alone we're gonna have to refactor many times ;-) The time has come to add font support to all the widgets in PythonCard. Since the prototype is based on wxPython, we're going to be limited by what can be done with the wxWindows/wxPython library and we're going to be further limited by what is going to work across platforms. Rowland and I avoided adding MS Windows-specific features to any of the existing widgets, and fonts should be handled the same way. This is also the time to start looking at wrapping wxSTC (Scintilla) for styled text support, though I'm still unclear on how the wxTE_RICH style for wxTextCtrl relates to wxSTC if at all. I encourage everyone to at least read the wxFont overview in the wxWindows/wxPython documentation, but I'm going to include it at the end of this message in case you don't know where to look. Other relevant sections include: Font encoding overview, Unicode support in wxWindows, wxFont class, wxFontDialog, and just about any other topic in the wxWindows docs with 'Font' in the name. I don't want to use the wxWindows constants directly for font families, but will probably use some equivelant mapping initially. I definitely want to support basic style sheets, so that an app can define a fontStyleSheet and then set the font for a widget simply by referring to the named fontStyleSheet. This isn't going to be a full web CSS-like capability, but we can borrow some of the ideas from CSS. platform-specific features In the future, we will probably have a some kind of setting so that if you wanted to write a PythonCard app that uses platform-specific features the framework will let you do so, but then make appropriate warnings when the app is being written and run. So, if there is some feature that is platform-specific that you want, you can still bring it up and it will get posted into the feature requests. ka --- wxFont overview Class: wxFont A font is an object which determines the appearance of text, primarily when drawing text to a window or device context. A font is determined by the following parameters (not all of them have to be specified, of course): Point size This is the standard way of referring to text size. Family Supported families are: wxDEFAULT, wxDECORATIVE, wxROMAN, wxSCRIPT, wxSWISS, wxMODERN. wxMODERN is a fixed pitch font; the others are either fixed or variable pitch. Style The value can be wxNORMAL, wxSLANT or wxITALIC. Weight The value can be wxNORMAL, wxLIGHT or wxBOLD. Underlining The value can be TRUE or FALSE. Face name An optional string specifying the actual typeface to be used. If NULL, a default typeface will chosen based on the family. Encoding The font encoding (see wxFONTENCODING_XXX constants and the font overview for more details) Specifying a family, rather than a specific typeface name, ensures a degree of portability across platforms because a suitable font will be chosen for the given font family. Under Windows, the face name can be one of the installed fonts on the user's system. Since the choice of fonts differs from system to system, either choose standard Windows fonts, or if allowing the user to specify a face name, store the family id with any file that might be transported to a different Windows machine or other platform. ---------------------------------------------------------------------------- ---- Note: There is currently a difference between the appearance of fonts on the two platforms, if the mapping mode is anything other than wxMM_TEXT. Under X, font size is always specified in points. Under MS Windows, the unit for text is points but the text is scaled according to the current mapping mode. However, user scaling on a device context will also scale fonts under both environments. |