Ticket UUID: | 780617 | |||
Title: | TIP 145: Font handling enhancements | |||
Type: | Patch | Version: | TIP Implementation | |
Submitter: | patthoyts | Created on: | 2003-07-31 00:57:55 | |
Subsystem: | 47. Win Fonts | Assigned To: | patthoyts | |
Priority: | 9 Immediate | Severity: | ||
Status: | Open | Last Modified: | 2012-05-28 16:06:43 | |
Resolution: | Remind | Closed By: | ||
Closed on: | ||||
Description: |
This is the implementation for TIP 145: Enhanced Tk Font handling. | |||
User Comments: |
dkf added on 2012-05-28 16:06:43:
Status is that the C interface described in the TIP has not been committed. dkf added on 2012-05-28 16:01:31: IP - Comment Removed: 130.88.1.31 dgp added on 2009-12-10 22:38:00: status ? dkf added on 2009-07-29 17:21:13: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:21:11: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:21:05: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:21:03: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:21:02: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:21:00: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:55: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:54: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:52: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:51: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:28: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:25: IP - Comment Removed: 130.88.1.31 dkf added on 2009-07-29 17:20:23: IP - Comment Removed: 130.88.1.31 dkf added on 2009-02-10 23:22:31: Taken private; hopefully this will do something to stem the spam... patthoyts added on 2008-05-14 07:57:25: File Added - 277712: tip145-final-c.patch Logged In: YES user_id=202636 Originator: YES This patch is the final part of TIP #145 Tk_CreateNamedFont is placed in the public stubs. Tk_FontAttributes is placed in tk.h Now that the font attributes are exposed I want to declare a more general set of font weight values that are more in keeping with the commonly available font systems. Pango and Win32 both use the same set of symbolic names and values in the range 0-1000. Xft uses a similar set of names but in a range 0-255 XLFD has similar names but they are symbolic. This extends the possible values of the weight field in font attributes to include normal, bold, light, ultralight, ultrabold and heavy File Added: tip145-final-c.patch das added on 2007-10-24 23:28:37: Logged In: YES user_id=90580 Originator: NO Joe, those docs are wrong, OSX uses lucida 14 in menus. I changed fonts.tcl to match what is returned by the GetThemeFont() API (which is what is now actually used by HEAD to setup the Tk* fonts, c.f. tkMacOSXFont.c): % foreach f [lsort [font names]] {puts "[format %-34s $f][font configure $f]"} TkCaptionFont -family {Lucida Grande} -size 13 -weight bold -slant roman -underline 0 -overstrike 0 TkDefaultFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 TkFixedFont -family monaco -size 9 -weight normal -slant roman -underline 0 -overstrike 0 TkHeadingFont -family {Lucida Grande} -size 11 -weight normal -slant roman -underline 0 -overstrike 0 TkIconFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 TkMenuFont -family {Lucida Grande} -size 14 -weight normal -slant roman -underline 0 -overstrike 0 TkSmallCaptionFont -family {Lucida Grande} -size 10 -weight normal -slant roman -underline 0 -overstrike 0 TkTextFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 TkTooltipFont -family {Lucida Grande} -size 11 -weight normal -slant roman -underline 0 -overstrike 0 systemAlertHeaderFont -family {Lucida Grande} -size 13 -weight bold -slant roman -underline 0 -overstrike 0 systemApplicationFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 systemDetailEmphasizedSystemFont -family {Lucida Grande} -size 9 -weight bold -slant roman -underline 0 -overstrike 0 systemDetailSystemFont -family {Lucida Grande} -size 9 -weight normal -slant roman -underline 0 -overstrike 0 systemEmphasizedSystemFont -family {Lucida Grande} -size 13 -weight bold -slant roman -underline 0 -overstrike 0 systemLabelFont -family {Lucida Grande} -size 10 -weight normal -slant roman -underline 0 -overstrike 0 systemMenuItemCmdKeyFont -family {Lucida Grande} -size 14 -weight normal -slant roman -underline 0 -overstrike 0 systemMenuItemFont -family {Lucida Grande} -size 14 -weight normal -slant roman -underline 0 -overstrike 0 systemMenuItemMarkFont -family {Lucida Grande} -size 14 -weight normal -slant roman -underline 0 -overstrike 0 systemMenuTitleFont -family {Lucida Grande} -size 14 -weight normal -slant roman -underline 0 -overstrike 0 systemMiniSystemFont -family {Lucida Grande} -size 9 -weight normal -slant roman -underline 0 -overstrike 0 systemPushButtonFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 systemSmallEmphasizedSystemFont -family {Lucida Grande} -size 11 -weight bold -slant roman -underline 0 -overstrike 0 systemSmallSystemFont -family {Lucida Grande} -size 11 -weight normal -slant roman -underline 0 -overstrike 0 systemSystemFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 systemToolbarFont -family {Lucida Grande} -size 11 -weight normal -slant roman -underline 0 -overstrike 0 systemUtilityWindowTitleFont -family {Lucida Grande} -size 11 -weight normal -slant roman -underline 0 -overstrike 0 systemViewsFont -family {Lucida Grande} -size 12 -weight normal -slant roman -underline 0 -overstrike 0 systemWindowTitleFont -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 jenglish added on 2007-10-24 23:09:22: Logged In: YES user_id=68433 Originator: NO das -- fonts.tcl r1.7 has: switch -- [tk windowingsystem] { ... aqua { ... set F(menusize) 14 ... font configure TkMenuFont -family $F(family) -size $F(menusize) } } But according to <URL: http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/ >, Part III, section "Text", subsection "Fonts": "The system font (Lucida Grande Regular 13 point) is used *for text in menus*, dialogs, and full-size controls." Shouldn't $F(menusize) be the same as $F(size) (== system font point size == 13)? patthoyts added on 2007-10-23 16:18:17: Logged In: YES user_id=202636 Originator: YES I misread the handling of the faPtr arg in TkCreateNamedFont and thought that the pointer was being copied into the NamedFont structure. I've applied the suggested fixes - thanks das. dkf added on 2007-10-22 03:13:19: Logged In: YES user_id=79902 Originator: NO General Note: When thinking about ckalloc() vs. stack "allocation", consider whether to use TclStackAlloc() or thread-local allocation instead. Since stack alloc is on the cards, TclStackAlloc()/TclStackFree() should also work if an interp handle is available (needs tclInt.h for declaration though). das added on 2007-10-21 22:28:09: Logged In: YES user_id=90580 Originator: NO I have just committed TIP145 font name registration for the aqua theme fonts to tkMacOSXFont.c While looking at the windows implementation of this, I found what appear to be bugs in tkWinFont.c's CreateNamedSystemFont(): - faPtr is leaked; in fact the whole allocation and copying of TkFontAttributes is unnecessary, as TkCreateNamedFont() copies the attributes again anyway. - TkDeleteNamedFont() should be called with a NULL interp (just added support for that), you don't want error info from it in the interp result. - the allocation and freeing of a WinFont seems unnecessary and could be replaced with a WinFont struct on the stack. dkf added on 2006-12-22 18:51:53: Logged In: YES user_id=79902 Originator: NO Also, don't forget to leave a compatability typedef in tkFont.h, just in case people are using that. dkf added on 2006-12-22 18:50:46: Logged In: YES user_id=79902 Originator: NO Also need to rename type TkFontAttributes to Tk_FontAttributes and to move it (together with defines of TK_FW_NORMAL, TK_FW_BOLD, TK_FS_ROMAN, TK_FS_ITALIC, TK_FS_OBLIQUE) to tk.h from tkFont.h, and also need to add documentation of the font names. This can either be a new manual page or an addition to the font.n page. Need to add TkHeadingFont and TkTextFont to the TIP. (Requires editor assistance: contact me directly with the descriptions of the purpose of these fonts, or add them to the comments in this tracker item.) patthoyts added on 2006-12-22 17:16:37: File Added - 208251: tkfont-20061222.patch Logged In: YES user_id=202636 Originator: YES Merging TIP #145 and the Tile font names I've updated the set in Windows to TkDefaultFont, TkHeadingFont, TkTextFont, TkMenuFont, TkTooltipFont, TkCaptionFont, TkSmallCaptionFont, TkIconFont and TkFixedFont. A look over the TIP shows that this implementation needs to put the TkCreateNamedFont function into the public stubs table as Tk_CreateNamedFont which has yet to be done. Attaching a new patch. File Added: tkfont-20061222.patch patthoyts added on 2006-12-20 23:13:01: Logged In: YES user_id=202636 Originator: YES Just need to agree names for the fonts. IIRC jenglish has some suggestions deriving from the tile work. Tile provides TkDefaultFont general gui font TkTextFont user text, entries etc TkHeadingFont column headings in table TkCaptionFont dialog captions TkTooltipFont tooltips and I think I had the following listed in the TIP (probably mostly from Windows stuff): TkFixedFont fixed width font TkMenuFont menu text TkSmallCaptionFont captions on tool windows and contained dialogs, MDI windows TkIconFont icon captions (eg: MDI iconified things) hobbs added on 2006-12-08 13:38:13: Logged In: YES user_id=72656 Originator: NO We just need to standardize on a set of font names (TkXXXXXX), otherwise its all just waiting in the wings. das added on 2006-12-08 09:55:03: Logged In: YES user_id=90580 Originator: NO I'm currently revising tkMacOSXFont.c's TkpGetNativeFont() because I need an additional standard OS font for menu items. If this patch were in, I could use TkCreateNamedFont() instead (and would at the same time implement the other system fonts defined in the TIP for Aqua). What's the status of this patch, any reason for the holdup since 2004? this TIP has been flagged as one needing to be prioritized for 8.5... dkf added on 2004-09-02 19:07:16: Logged In: YES user_id=79902 I'm unsure about the technical content of the patch, but it appears to be missing documentation and tests... vincentdarley added on 2004-09-01 19:15:53: Logged In: YES user_id=32170 Is this patch ready for committing to Tk? Given the vote has passed, we ought to try to get this in soon... jenglish added on 2004-06-15 09:18:51: Logged In: YES user_id=68433 TIP #145 doesn't seem to provide an appropriate symbolic font name for entry widgets. Although on Windows Tk uses a single font for just about everything (CTL_FONT == TkDefaultFont), on X11 it uses a different font for entry widgets and canvas text items (Helvetica -12) than it does for everything else (Helvetica -12 bold). MacOSX is similar. Text widgets also use a different default font on X11 (Courier -12). For those we can use TkFixedFont, but none of the other symbolic names listed in the TIP seem to be appropriate for entry widgets. Perhaps "TkTextFont" should be added? patthoyts added on 2004-02-01 06:40:08: File Added - 75342: tk-font.patch Logged In: YES user_id=202636 Uploaded a newer version patthoyts added on 2003-07-31 07:57:57: File Added - 57370: font.patch |
Attachments:
- tip145-final-c.patch [download] added by patthoyts on 2008-05-14 07:57:25. [details]
- tkfont-20061222.patch [download] added by patthoyts on 2006-12-22 17:16:37. [details]
- tk-font.patch [download] added by patthoyts on 2004-02-01 06:40:08. [details]
- font.patch [download] added by patthoyts on 2003-07-31 07:57:56. [details]