From: Kevin A. <al...@se...> - 2001-08-27 01:09:47
|
dialog.py, test_dialogs.py, and widget.py have been updated in cvs to use the new Font class. This is highly experimental, but doesn't appear to break any existing samples. I chose to combine and hide some of the wxPython font settings. A Font is described by its optional attributes: family: 'serif', 'sansSerif', 'monospace', 'default' faceName: an actual font name from the system (Arial, Courier New...) size: a number representing point size (8, 9, 10, etc.) style: 'regular', 'bold', 'italic', 'boldItalic' underline is currently turned off If None is passed in to initialize the Font class then you currently get a Font with an empty faceName, a default family, 8 point, and 'regular' style. If a faceName is present, it overrides the family attribute. If you specify a faceName then you risk that font not being available on a different system. You should only use 'faceName' right now for cross-platform compatibility. You can provide a 'font' attribute in the .rsrc.py files for a widget such as: 'font':{'family':'monospace', 'size':12} 'font':{'faceName':'Garamond', 'size':10, 'style':'boldItalic'} or you can set the font while the program is running. f = PythonCardPrototype.widget.Font({'family':'monospace', 'size':12}) self.field1.font = f I need to work on some mechanism, so that a list of alternative fonts can be searched for in order such as ["Garamond, Times New Roman, Times"] in order to make a match. I also need to provide a set of named fonts. Finally, I need to change the Font class initialization, so that the defaults aren't hard-coded, by using GetFont() on the background panel (Panel class) prior to initializing any of the widgets. ka |
From: Kevin A. <al...@se...> - 2001-08-27 01:14:03
|
> a faceName then you risk that font not being available on a different > system. You should only use 'faceName' right now for cross-platform > compatibility. That should be 'family' for cross-platform compatibility. ka |
From: Kevin A. <al...@se...> - 2001-08-27 04:34:50
|
One other thing that you may be tempted to try, but which won't work is dot dot set notation. For example: self.components.field1.text.size = 12 # can't change the font size This won't work. You can do a get just fine: print self.components.field1.text.size I don't think there is a workaround for the set + set problem, but one of the Python wizards may have a solution. If you need to set a font property for a widget, just get a reference to the font, change the attribute you are interested in, then change the font for the widget. Also, because the Font class doesn't actually keep a reference to a real wxPython wxFont, you can just create a Font class that you want to use for a group of widgets, then iterate through the widgets to make them all use the same font characteristics. More on this kind of stuff as the fonts mature. ka > -----Original Message----- > From: pyt...@li... > [mailto:pyt...@li...]On Behalf Of Kevin > Altis > Sent: Sunday, August 26, 2001 6:11 PM > To: pythoncard-Users > Subject: [Pythoncard-users] fonts - day three > > > dialog.py, test_dialogs.py, and widget.py have been updated in cvs to use > the new Font class. This is highly experimental, but doesn't > appear to break > any existing samples. > > I chose to combine and hide some of the wxPython font settings. A Font is > described by its optional attributes: > family: 'serif', 'sansSerif', 'monospace', 'default' > faceName: an actual font name from the system (Arial, Courier New...) > size: a number representing point size (8, 9, 10, etc.) > style: 'regular', 'bold', 'italic', 'boldItalic' > underline is currently turned off > > If None is passed in to initialize the Font class then you currently get a > Font with an empty faceName, a default family, 8 point, and > 'regular' style. > If a faceName is present, it overrides the family attribute. If > you specify > a faceName then you risk that font not being available on a different > system. You should only use 'faceName' right now for cross-platform > compatibility. > > You can provide a 'font' attribute in the .rsrc.py files for a widget such > as: > > 'font':{'family':'monospace', 'size':12} > 'font':{'faceName':'Garamond', 'size':10, 'style':'boldItalic'} > > or you can set the font while the program is running. > > f = PythonCardPrototype.widget.Font({'family':'monospace', 'size':12}) > self.field1.font = f > > I need to work on some mechanism, so that a list of alternative > fonts can be > searched for in order such as ["Garamond, Times New Roman, > Times"] in order > to make a match. I also need to provide a set of named fonts. Finally, I > need to change the Font class initialization, so that the defaults aren't > hard-coded, by using GetFont() on the background panel (Panel class) prior > to initializing any of the widgets. > > ka > > > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > http://lists.sourceforge.net/lists/listinfo/pythoncard-users > |
From: Neil H. <ne...@sc...> - 2001-08-27 04:58:20
|
Kevin Altis: I'll look at this from a CSS point of view as CSS is a "real standard" which works fairly well. These are not heavily held opinions and I don't mind if the font model is more wx specific. Since wxWindows uses "wxSWISS" style constants for settings rather than string forms, I'd aim for string forms that look much like CSS. > I chose to combine and hide some of the wxPython font settings. A Font is > described by its optional attributes: > family: 'serif', 'sansSerif', 'monospace', 'default' > faceName: an actual font name from the system (Arial, Courier New...) CSS combines these as font-family with the particular names 'serif', 'sans-serif', 'cursive', 'fantasy', and 'monospace' being mapped by the user agent to available real fonts. > size: a number representing point size (8, 9, 10, etc.) > style: 'regular', 'bold', 'italic', 'boldItalic' Combining these makes no sense to me. I know the Microsoft font dialog does this but why have bold and italic combined and underline separate? (the reason the dialog does it is that the normal, bold, italics, and bolditalics are separate fonts often in separate files and you'll occasionally see demibold and oblique in that list). A richer weight parameter is more general and maps to CSS as does style being for italic or oblique. > underline is currently turned off There should be an encoding or character set as well. Don't worry about what it means or how to use it. After everything else is working one or more Russian or Hungarian developers (or from somewhere around there) will turn up and use it to hook up the right things so that they can work with PythonCard. Trust me on this one :-) And avoid sunscreen - it contains lots of very nasty chemicals :-( > I need to work on some mechanism, so that a list of alternative fonts can be > searched for in order such as ["Garamond, Times New Roman, Times"] in order > to make a match. CSS syntax compatibility may be worthwhile here - family is a space delimited string with multiword family names quoted. Neil |
From: Kevin A. <al...@se...> - 2001-08-27 05:44:08
|
> Neil Hodgson > > I'll look at this from a CSS point of view as CSS is a "real standard" > which works fairly well. These are not heavily held opinions and I don't > mind if the font model is more wx specific. Since wxWindows uses "wxSWISS" > style constants for settings rather than string forms, I'd aim for string > forms that look much like CSS. I agree. CSS would be better, I think the question is how far we take it. > > I chose to combine and hide some of the wxPython font settings. > A Font is > > described by its optional attributes: > > family: 'serif', 'sansSerif', 'monospace', 'default' > > faceName: an actual font name from the system (Arial, Courier New...) > > CSS combines these as font-family with the particular names 'serif', > 'sans-serif', 'cursive', 'fantasy', and 'monospace' being mapped > by the user > agent to available real fonts. We need a list of face names to default to for each of these types for different platforms. Is there a standard CSS font list? The last time I did web pages for a living, CSS didn't exist, so I'm in the dark here :) > > size: a number representing point size (8, 9, 10, etc.) > > style: 'regular', 'bold', 'italic', 'boldItalic' > > Combining these makes no sense to me. I know the Microsoft font dialog > does this but why have bold and italic combined and underline > separate? (the > reason the dialog does it is that the normal, bold, italics, and > bolditalics > are separate fonts often in separate files and you'll occasionally see > demibold and oblique in that list). A richer weight parameter is more > general and maps to CSS as does style being for italic or oblique. Ultimately, we have to map to wxPython right now, so having a richer list is fine as long as it is going to translate. I specifically mimicked the font dialog since I thought that would be more intuitive. I will make underline another style if it works on *nix and not just Windows. > There should be an encoding or character set as well. Don't worry about > what it means or how to use it. After everything else is working > one or more > Russian or Hungarian developers (or from somewhere around there) will turn > up and use it to hook up the right things so that they can work with > PythonCard. Trust me on this one :-) And avoid sunscreen - it > contains lots > of very nasty chemicals :-( I'll add encoding, though I'm sure we'll have to change whatever I add. > > I need to work on some mechanism, so that a list of alternative > fonts can > be > > searched for in order such as ["Garamond, Times New Roman, Times"] in > order > > to make a match. > > CSS syntax compatibility may be worthwhile here - family is a space > delimited string with multiword family names quoted. Again, CSS is fine with me. It is mostly a matter of how far we take it and how complex the parsing will be. Will the CSS syntax translate over to wxSTC as well when we start setting font characteristics for individual characters in a field? ka |
From: Roman S. <rn...@on...> - 2001-08-27 09:29:53
|
On Sun, 26 Aug 2001, Kevin Altis wrote: > > Russian or Hungarian developers (or from somewhere around there) will turn > > up and use it to hook up the right things so that they can work with > > PythonCard. Trust me on this one :-) And avoid sunscreen - it > > contains lots > > of very nasty chemicals :-( > > I'll add encoding, though I'm sure we'll have to change whatever I add. I think Unicode/UTF-8 will be fine. Does wxPython support Unicode? (Though, non-Windows Russian developers will be wanting to choose koi8-r, cp1251, or whatever.) I think that letting Unicode will eliminate problems which arise with porting software from one system to another. To prevent this hell (+ allow for special characters like math notation, astrology, chemistry, etc, signs) I think that there must be ONLY Unicode. Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rn...@on... - |
From: Neil H. <ne...@sc...> - 2001-08-27 09:44:53
|
[Kevin] > > I'll add encoding, though I'm sure we'll have to change whatever I add. [Roman Suzi] > I think Unicode/UTF-8 will be fine. Does wxPython support Unicode? > (Though, non-Windows Russian developers will be wanting to > choose koi8-r, cp1251, or whatever.) It looks to me like wxWindows only supports Unicode fully where the underlying platform supports it which means, for now, on Windows NT and derivatives. GTK+ 1.x (and hence wxGTK) does not support Unicode and GTK+ 2.0 which will support Unicode is not ready yet. When GTK+ 2.0 is ready then there may still be a delay in wrapping this within wxWindows. Neil |
From: Kevin A. <al...@se...> - 2001-08-29 18:19:59
|
> > I chose to combine and hide some of the wxPython font settings. > A Font is > > described by its optional attributes: > > family: 'serif', 'sansSerif', 'monospace', 'default' > > faceName: an actual font name from the system (Arial, Courier New...) > > CSS combines these as font-family with the particular names 'serif', > 'sans-serif', 'cursive', 'fantasy', and 'monospace' being mapped > by the user > agent to available real fonts. wxWindows/wxPython wxDEFAULT Chooses a default font. wxDECORATIVE A decorative font. wxROMAN A formal, serif font. wxSCRIPT A handwriting font. wxSWISS A sans-serif font. wxMODERN A fixed pitch font. 'cursive' should map to wxSCRIPT and 'fantasy' should map to wxDECORATIVE but neither of these families seems to work for me. I don't know if I'm doing something wrong or if its a bug in wxPython or those families just aren't supported right now?! > > size: a number representing point size (8, 9, 10, etc.) > > style: 'regular', 'bold', 'italic', 'boldItalic' > > Combining these makes no sense to me. I know the Microsoft font dialog > does this but why have bold and italic combined and underline > separate? (the > reason the dialog does it is that the normal, bold, italics, and > bolditalics > are separate fonts often in separate files and you'll occasionally see > demibold and oblique in that list). A richer weight parameter is more > general and maps to CSS as does style being for italic or oblique. So we want to do a separate 'weight': 'normal', 'bold', 'lighter'? 'lighter' (wxLIGHT in wxPython) doesn't ever seem to do anything. 'oblique' (wxSLANT) appears to be the same as 'italic' (wxITALIC). CSS doesn't support underline as a style, underline is a a text decoration. "The text-decoration property allows text to be decorated through one of five properties: underline, overline, line-through, blink, or the default, none." Are you saying that you want the style to be a list of one or more values 'normal', 'italic', 'oblique', 'bold', 'underline'? It seems like it would make the most sense to have 'family' and 'style' be Python lists to simplify adding, doing slices, and checking for matches. Guess I just need to ponder this some more. Is Small Caps possible in wxPython/wxWindows? That's font-variant in CSS terms. ka |
From: Neil H. <ne...@sc...> - 2001-08-30 01:29:45
|
Kevin Altis: > So we want to do a separate 'weight': 'normal', 'bold', 'lighter'? 'lighter' > (wxLIGHT in wxPython) doesn't ever seem to do anything. 'oblique' (wxSLANT) > appears to be the same as 'italic' (wxITALIC). Just tried to provoke both the Win32 API and Internet Explorer into doing something with a light font using a weight of 100 which is the lightest possible but there is no effect so its unlikely that wxWindows can do anything with it either. If it never works then there is probably not much point in supporting it ;) The reason I wanted to be able to choose lighter weights is for very high resolution modes where you mostly have two pixel wide characters but would like to choose thinner characters sometimes. > CSS doesn't support underline as a style, underline is a a text decoration. > > "The text-decoration property allows text to be decorated through one of > five properties: underline, overline, line-through, blink, or the default, > none." > > Are you saying that you want the style to be a list of one or more values > 'normal', 'italic', 'oblique', 'bold', 'underline'? Mostly I'd prefer options to be separate rather than trying to mix them together in some sort of style attribute which doesn't correspond to any underlying API. Trying to produce a new font description model that is different but less capable than any of wxWindows, Win32, or CSS looks like a backwards step to me. > Is Small Caps possible in wxPython/wxWindows? That's font-variant in CSS > terms. Its not a Win32 choice so its unlikely wxWindows will try to handle it. Sometimes small-caps fonts are available so this can be done by choosing a family name of such a font. Neil |
From: Kevin A. <al...@se...> - 2001-08-30 01:55:25
|
> > Are you saying that you want the style to be a list of one or > more values > > 'normal', 'italic', 'oblique', 'bold', 'underline'? > > Mostly I'd prefer options to be separate rather than trying to mix them > together in some sort of style attribute which doesn't correspond to any > underlying API. Trying to produce a new font description model that is > different but less capable than any of wxWindows, Win32, or CSS > looks like a > backwards step to me. Okay, but I still need to know what you're proposing, so I can implement it. fontFamily: CSS-like fontWeight: normal or bold fontStyle: normal or italic (or oblique) fontUnderline: 1 or 0 I still don't know whether underline works on *nix or just Windows. ka |
From: Neil H. <ne...@sc...> - 2001-08-30 11:04:32
|
Kevin Altis: > Okay, but I still need to know what you're proposing, so I can implement it. I'm not really proposing anything particular as I'm somewhat unsure here and even managed to guess wrong about "light" being implemented. Just raising issues. > I still don't know whether underline works on *nix or just Windows. Underlined fonts aren't supported directly by X or GTK+ IIRC. Scintilla uses explicit underline drawing to avoid relying upon the platform to implement this as part of text drawing. Neil |