#125 TIP 145: Font handling enhancements

TIP Implementation
open-remind
Pat Thoyts
9
2010-01-17
2003-07-31
Pat Thoyts
No

This is the implementation for TIP 145: Enhanced Tk
Font handling.

Discussion

1 2 > >> (Page 1 of 2)
  • Pat Thoyts
    Pat Thoyts
    2003-07-31

    initial patch version

     
    Attachments
  • Pat Thoyts
    Pat Thoyts
    2003-08-13

    • assigned_to: hobbs --> patthoyts
     
    • milestone: --> TIP Implementation
     
  • Pat Thoyts
    Pat Thoyts
    2004-01-31

    Logged In: YES
    user_id=202636

    Uploaded a newer version

     
  • Pat Thoyts
    Pat Thoyts
    2004-01-31

    Improved implementation

     
    Attachments
    • priority: 5 --> 9
     
  • Joe English
    Joe English
    2004-06-15

    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?

     
  • Vince Darley
    Vince Darley
    2004-09-01

    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...

     
  • 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...

     
  • 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...

     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2006-12-08

    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.

     
  • Pat Thoyts
    Pat Thoyts
    2006-12-20

    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)

     
  • Pat Thoyts
    Pat Thoyts
    2006-12-22

    Updated TIP #145 implementation

     
    Attachments
  • Pat Thoyts
    Pat Thoyts
    2006-12-22

    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

     
  • 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.)

     
  • 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.

     
  • 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.

     
  • 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).

     
  • Pat Thoyts
    Pat Thoyts
    2007-10-23

    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.

     
  • Joe English
    Joe English
    2007-10-24

    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)?

     
  • 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

     
  • Pat Thoyts
    Pat Thoyts
    2008-05-14

    stubs change + multiple weights (unix patch)

     
    Attachments
  • Pat Thoyts
    Pat Thoyts
    2008-05-14

    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

     
  • Don Porter
    Don Porter
    2009-12-10

    status ?

     
    • status: open --> open-remind
     
1 2 > >> (Page 1 of 2)