Package nMOLDYN :: Package GUI :: Package HTMLReader :: Module tkfont |
[hide private]
[frames] | no frames]

# Source Code for Module nMOLDYN.GUI.HTMLReader.tkfont

     1  ## vim:ts=4:et:nowrap
     2  ##
     3  ##---------------------------------------------------------------------------##
     4  ##
     5  ## PySol -- a Python Solitaire game
     6  ##
     7  ## Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
     8  ## Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
     9  ## Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
    10  ## Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
    11  ## Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
    12  ## Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
    13  ## All Rights Reserved.
    14  ##
    15  ## This program is free software; you can redistribute it and/or modify
    16  ## it under the terms of the GNU General Public License as published by
    17  ## the Free Software Foundation; either version 2 of the License, or
    18  ## (at your option) any later version.
    19  ##
    20  ## This program is distributed in the hope that it will be useful,
    21  ## but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23  ## GNU General Public License for more details.
    24  ##
    25  ## You should have received a copy of the GNU General Public License
    26  ## along with this program; see the file COPYING.
    27  ## If not, write to the Free Software Foundation, Inc.,
    28  ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    29  ##
    30  ## Markus F.X.J. Oberhumer
    31  ## <markus@oberhumer.com>
    32  ## http://www.oberhumer.com/pysol
    33  ##
    34  ##---------------------------------------------------------------------------##
    35
    36
    37  # imports
    38  import sys, os, re, string, time, types
    39  import Tkinter
    40
    41  # Toolkit imports
    42  import tkinit
    43  from tkconst import tkversion
    44
    45
    46  # /***********************************************************************
    47  # // font
    48  # ************************************************************************/
    49
    50  getFont_cache = {}
    51
    52 -def getFont(name, cardw=0):
    53      key = (name, cardw)
    54      font = getFont_cache.get(key)
    55      if font:
    56          return font
    57      # default
    58      font = ("Helvetica", "-14")
    59      #
    60      if name in ("canvas", "canvas_small", "small", "tree_small",):
    61          font = ("Helvetica", "-12")
    62      elif name in ("canvas_large",):
    63          font = ("Helvetica", "-18")
    64      elif name in ("canvas_card",):
    65          if cardw >= 71:
    66              font = getFont("canvas_large")
    67          elif cardw >= 57:
    68              font = ("Helvetica", "-16")
    69          else:
    70              font = ("Helvetica", "-14")
    71      elif name in ("canvas_fixed",):
    72          font = ("Courier", "-12")
    73      elif name in ("fixed",):
    74          font = ("Courier", "-14")
    75      elif not name in ("default",):
    76          pass
    77      #
    78      getFont_cache[key] = font
    79      return font
    80