# copyright (C) 1997-2005 Jean-Luc Fontaine (mailto:jfontain@free.fr)
# this program is free software: please read the COPYRIGHT file enclosed in this package or use the Help Copyright menu

# $Id: font.tcl,v 2.18 2005/01/02 00:45:07 jfontain Exp $


# Note: on UNIX, for best results, make sure your X Window server has the proper dots-per-inch setting for your screen
# (eventually correct it using the -dpi option of your X server, as I do on my Linux machine)

class font {
    catch {widget::widget}       ;# force widget class load for static data members visibility below, in case of package utilization

    set (mediumBold) [eval font create [font actual $widget::option(button,font)]]
    font configure $(mediumBold) -weight bold                                                                ;# force weight to bold
    set (mediumNormal) [eval font create [font actual $(mediumBold)]]
    font configure $(mediumNormal) -weight normal                                                          ;# force weight to normal
    set (mediumItalic) [eval font create [font actual $(mediumNormal)]]
    font configure $(mediumItalic) -slant italic                                                            ;# force slant to italic
    set (mediumBoldItalic) [eval font create [font actual $(mediumBold)]]
    font configure $(mediumBoldItalic) -slant italic                                                        ;# force slant to italic
    set (smallNormal) [eval font create [font actual $(mediumNormal)]]
    set size [maximum [expr {round(0.8 * [font actual $(mediumNormal) -size])}] 10]              ;# small size is 80% of medium size
    font configure $(smallNormal) -size -$size
    set (tinyNormal) [font create -family [font actual $(mediumNormal) -family] -size -10]
    set (fixedNormal) [font create -family courier -weight normal -size -[font actual $(mediumNormal) -size]]
    if {[package vcompare $::tcl_version 8.5] >= 0} {
        foreach font [list $(mediumBold) $(mediumNormal) $(mediumItalic) $(mediumBoldItalic) $(smallNormal) $(fixedNormal)] {
            font configure $font -size -[font actual $font -size]                        ;### Tk 8.5 needs forcing pixel sizes: bug?
        }
    }
}

