Code Search for Developers
 
 
  

FontScale.py from gramps at Krugle


Show FontScale.py syntax highlighted

#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001  Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
_swiss = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.278,	0.278,	0.355,	0.556,	0.556,	0.889,	0.667,	0.191,
0.333,	0.333,	0.389,	0.584,	0.278,	0.333,	0.278,	0.278,	0.556,	0.556,
0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.278,	0.278,
0.584,	0.584,	0.584,	0.556,	1.015,	0.667,	0.667,	0.722,	0.722,	0.667,
0.611,	0.778,	0.722,	0.278,	0.500,	0.667,	0.556,	0.833,	0.722,	0.778,
0.667,	0.778,	0.722,	0.667,	0.611,	0.722,	0.667,	0.944,	0.667,	0.667,
0.611,	0.278,	0.278,	0.278,	0.469,	0.556,	0.333,	0.556,	0.556,	0.500,
0.556,	0.556,	0.278,	0.556,	0.556,	0.222,	0.222,	0.500,	0.222,	0.833,
0.556,	0.556,	0.556,	0.556,	0.333,	0.500,	0.278,	0.556,	0.500,	0.722,
0.500,	0.500,	0.500,	0.334,	0.260,	0.334,	0.584,	0.350,	0.556,	0.350,
0.222,	0.556,	0.333,	1.000,	0.556,	0.556,	0.333,	1.000,	0.667,	0.333,
1.000,	0.350,	0.611,	0.350,	0.350,	0.222,	0.222,	0.333,	0.333,	0.350,
0.556,	1.000,	0.333,	1.000,	0.500,	0.333,	0.944,	0.350,	0.500,	0.667,
0.278,	0.333,	0.556,	0.556,	0.556,	0.556,	0.260,	0.556,	0.333,	0.737,
0.370,	0.556,	0.584,	0.333,	0.737,	0.333,	0.400,	0.584,	0.333,	0.333,
0.333,	0.556,	0.537,	0.278,	0.333,	0.333,	0.365,	0.556,	0.834,	0.834,
0.834,	0.611,	0.667,	0.667,	0.667,	0.667,	0.667,	0.667,	1.000,	0.722,
0.667,	0.667,	0.667,	0.667,	0.278,	0.278,	0.278,	0.278,	0.722,	0.722,
0.778,	0.778,	0.778,	0.778,	0.778,	0.584,	0.778,	0.722,	0.722,	0.722,
0.722,	0.667,	0.667,	0.611,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,
0.889,	0.500,	0.556,	0.556,	0.556,	0.556,	0.278,	0.278,	0.278,	0.278,
0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.584,	0.611,	0.556,
0.556,	0.556,	0.556,	0.500,	0.556,	0.500]

_swiss_b = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.278,	0.333,	0.474,	0.556,	0.556,	0.889,	0.722,	0.238,
0.333,	0.333,	0.389,	0.584,	0.278,	0.333,	0.278,	0.278,	0.556,	0.556,
0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.333,	0.333,
0.584,	0.584,	0.584,	0.611,	0.975,	0.722,	0.722,	0.722,	0.722,	0.667,
0.611,	0.778,	0.722,	0.278,	0.556,	0.722,	0.611,	0.833,	0.722,	0.778,
0.667,	0.778,	0.722,	0.667,	0.611,	0.722,	0.667,	0.944,	0.667,	0.667,
0.611,	0.333,	0.278,	0.333,	0.584,	0.556,	0.333,	0.556,	0.611,	0.556,
0.611,	0.556,	0.333,	0.611,	0.611,	0.278,	0.278,	0.556,	0.278,	0.889,
0.611,	0.611,	0.611,	0.611,	0.389,	0.556,	0.333,	0.611,	0.556,	0.778,
0.556,	0.556,	0.500,	0.389,	0.280,	0.389,	0.584,	0.350,	0.556,	0.350,
0.278,	0.556,	0.500,	1.000,	0.556,	0.556,	0.333,	1.000,	0.667,	0.333,
1.000,	0.350,	0.611,	0.350,	0.350,	0.278,	0.278,	0.500,	0.500,	0.350,
0.556,	1.000,	0.333,	1.000,	0.556,	0.333,	0.944,	0.350,	0.500,	0.667,
0.278,	0.333,	0.556,	0.556,	0.556,	0.556,	0.280,	0.556,	0.333,	0.737,
0.370,	0.556,	0.584,	0.333,	0.737,	0.333,	0.400,	0.584,	0.333,	0.333,
0.333,	0.611,	0.556,	0.278,	0.333,	0.333,	0.365,	0.556,	0.834,	0.834,
0.834,	0.611,	0.722,	0.722,	0.722,	0.722,	0.722,	0.722,	1.000,	0.722,
0.667,	0.667,	0.667,	0.667,	0.278,	0.278,	0.278,	0.278,	0.722,	0.722,
0.778,	0.778,	0.778,	0.778,	0.778,	0.584,	0.778,	0.722,	0.722,	0.722,
0.722,	0.667,	0.667,	0.611,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,
0.889,	0.556,	0.556,	0.556,	0.556,	0.556,	0.278,	0.278,	0.278,	0.278,
0.611,	0.611,	0.611,	0.611,	0.611,	0.611,	0.611,	0.584,	0.611,	0.611,
0.611,	0.611,	0.611,	0.556,	0.611,	0.556]

_swiss_i = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.278,	0.278,	0.355,	0.556,	0.556,	0.889,	0.667,	0.191,
0.333,	0.333,	0.389,	0.584,	0.278,	0.333,	0.278,	0.278,	0.556,	0.556,
0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.278,	0.278,
0.584,	0.584,	0.584,	0.556,	1.015,	0.667,	0.667,	0.722,	0.722,	0.667,
0.611,	0.778,	0.722,	0.278,	0.500,	0.667,	0.556,	0.833,	0.722,	0.778,
0.667,	0.778,	0.722,	0.667,	0.611,	0.722,	0.667,	0.944,	0.667,	0.667,
0.611,	0.278,	0.278,	0.278,	0.469,	0.556,	0.333,	0.556,	0.556,	0.500,
0.556,	0.556,	0.278,	0.556,	0.556,	0.222,	0.222,	0.500,	0.222,	0.833,
0.556,	0.556,	0.556,	0.556,	0.333,	0.500,	0.278,	0.556,	0.500,	0.722,
0.500,	0.500,	0.500,	0.334,	0.260,	0.334,	0.584,	0.350,	0.556,	0.350,
0.222,	0.556,	0.333,	1.000,	0.556,	0.556,	0.333,	1.000,	0.667,	0.333,
1.000,	0.350,	0.611,	0.350,	0.350,	0.222,	0.222,	0.333,	0.333,	0.350,
0.556,	1.000,	0.333,	1.000,	0.500,	0.333,	0.944,	0.350,	0.500,	0.667,
0.278,	0.333,	0.556,	0.556,	0.556,	0.556,	0.260,	0.556,	0.333,	0.737,
0.370,	0.556,	0.584,	0.333,	0.737,	0.333,	0.400,	0.584,	0.333,	0.333,
0.333,	0.556,	0.537,	0.278,	0.333,	0.333,	0.365,	0.556,	0.834,	0.834,
0.834,	0.611,	0.667,	0.667,	0.667,	0.667,	0.667,	0.667,	1.000,	0.722,
0.667,	0.667,	0.667,	0.667,	0.278,	0.278,	0.278,	0.278,	0.722,	0.722,
0.778,	0.778,	0.778,	0.778,	0.778,	0.584,	0.778,	0.722,	0.722,	0.722,
0.722,	0.667,	0.667,	0.611,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,
0.889,	0.500,	0.556,	0.556,	0.556,	0.556,	0.278,	0.278,	0.278,	0.278,
0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.584,	0.611,	0.556,
0.556,	0.556,	0.556,	0.500,	0.556,	0.500]

_swiss_bi = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.278,	0.333,	0.474,	0.556,	0.556,	0.889,	0.722,	0.238,
0.333,	0.333,	0.389,	0.584,	0.278,	0.333,	0.278,	0.278,	0.556,	0.556,
0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,	0.333,	0.333,
0.584,	0.584,	0.584,	0.611,	0.975,	0.722,	0.722,	0.722,	0.722,	0.667,
0.611,	0.778,	0.722,	0.278,	0.556,	0.722,	0.611,	0.833,	0.722,	0.778,
0.667,	0.778,	0.722,	0.667,	0.611,	0.722,	0.667,	0.944,	0.667,	0.667,
0.611,	0.333,	0.278,	0.333,	0.584,	0.556,	0.333,	0.556,	0.611,	0.556,
0.611,	0.556,	0.333,	0.611,	0.611,	0.278,	0.278,	0.556,	0.278,	0.889,
0.611,	0.611,	0.611,	0.611,	0.389,	0.556,	0.333,	0.611,	0.556,	0.778,
0.556,	0.556,	0.500,	0.389,	0.280,	0.389,	0.584,	0.350,	0.556,	0.350,
0.278,	0.556,	0.500,	1.000,	0.556,	0.556,	0.333,	1.000,	0.667,	0.333,
1.000,	0.350,	0.611,	0.350,	0.350,	0.278,	0.278,	0.500,	0.500,	0.350,
0.556,	1.000,	0.333,	1.000,	0.556,	0.333,	0.944,	0.350,	0.500,	0.667,
0.278,	0.333,	0.556,	0.556,	0.556,	0.556,	0.280,	0.556,	0.333,	0.737,
0.370,	0.556,	0.584,	0.333,	0.737,	0.333,	0.400,	0.584,	0.333,	0.333,
0.333,	0.611,	0.556,	0.278,	0.333,	0.333,	0.365,	0.556,	0.834,	0.834,
0.834,	0.611,	0.722,	0.722,	0.722,	0.722,	0.722,	0.722,	1.000,	0.722,
0.667,	0.667,	0.667,	0.667,	0.278,	0.278,	0.278,	0.278,	0.722,	0.722,
0.778,	0.778,	0.778,	0.778,	0.778,	0.584,	0.778,	0.722,	0.722,	0.722,
0.722,	0.667,	0.667,	0.611,	0.556,	0.556,	0.556,	0.556,	0.556,	0.556,
0.889,	0.556,	0.556,	0.556,	0.556,	0.556,	0.278,	0.278,	0.278,	0.278,
0.611,	0.611,	0.611,	0.611,	0.611,	0.611,	0.611,	0.584,	0.611,	0.611,
0.611,	0.611,	0.611,	0.556,	0.611,	0.556]

_roman = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.250,	0.333,	0.408,	0.500,	0.500,	0.833,	0.778,	0.180,
0.333,	0.333,	0.500,	0.564,	0.250,	0.333,	0.250,	0.278,	0.500,	0.500,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.278,	0.278,
0.564,	0.564,	0.564,	0.444,	0.921,	0.722,	0.667,	0.667,	0.722,	0.611,
0.556,	0.722,	0.722,	0.333,	0.389,	0.722,	0.611,	0.889,	0.722,	0.722,
0.556,	0.722,	0.667,	0.556,	0.611,	0.722,	0.722,	0.944,	0.722,	0.722,
0.611,	0.333,	0.278,	0.333,	0.469,	0.500,	0.333,	0.444,	0.500,	0.444,
0.500,	0.444,	0.333,	0.500,	0.500,	0.278,	0.278,	0.500,	0.278,	0.778,
0.500,	0.500,	0.500,	0.500,	0.333,	0.389,	0.278,	0.500,	0.500,	0.722,
0.500,	0.500,	0.444,	0.480,	0.200,	0.480,	0.541,	0.350,	0.500,	0.350,
0.333,	0.500,	0.444,	1.000,	0.500,	0.500,	0.333,	1.000,	0.556,	0.333,
0.889,	0.350,	0.611,	0.350,	0.350,	0.333,	0.333,	0.444,	0.444,	0.350,
0.500,	1.000,	0.333,	0.980,	0.389,	0.333,	0.722,	0.350,	0.444,	0.722,
0.250,	0.333,	0.500,	0.500,	0.500,	0.500,	0.200,	0.500,	0.333,	0.760,
0.276,	0.500,	0.564,	0.333,	0.760,	0.333,	0.400,	0.564,	0.300,	0.300,
0.333,	0.500,	0.453,	0.250,	0.333,	0.300,	0.310,	0.500,	0.750,	0.750,
0.750,	0.444,	0.722,	0.722,	0.722,	0.722,	0.722,	0.722,	0.889,	0.667,
0.611,	0.611,	0.611,	0.611,	0.333,	0.333,	0.333,	0.333,	0.722,	0.722,
0.722,	0.722,	0.722,	0.722,	0.722,	0.564,	0.722,	0.722,	0.722,	0.722,
0.722,	0.722,	0.556,	0.500,	0.444,	0.444,	0.444,	0.444,	0.444,	0.444,
0.667,	0.444,	0.444,	0.444,	0.444,	0.444,	0.278,	0.278,	0.278,	0.278,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.564,	0.500,	0.500,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500]

_roman_b = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.250,	0.333,	0.555,	0.500,	0.500,	1.000,	0.833,	0.278,
0.333,	0.333,	0.500,	0.570,	0.250,	0.333,	0.250,	0.278,	0.500,	0.500,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.333,	0.333,
0.570,	0.570,	0.570,	0.500,	0.930,	0.722,	0.667,	0.722,	0.722,	0.667,
0.611,	0.778,	0.778,	0.389,	0.500,	0.778,	0.667,	0.944,	0.722,	0.778,
0.611,	0.778,	0.722,	0.556,	0.667,	0.722,	0.722,	1.000,	0.722,	0.722,
0.667,	0.333,	0.278,	0.333,	0.581,	0.500,	0.333,	0.500,	0.556,	0.444,
0.556,	0.444,	0.333,	0.500,	0.556,	0.278,	0.333,	0.556,	0.278,	0.833,
0.556,	0.500,	0.556,	0.556,	0.444,	0.389,	0.333,	0.556,	0.500,	0.722,
0.500,	0.500,	0.444,	0.394,	0.220,	0.394,	0.520,	0.350,	0.500,	0.350,
0.333,	0.500,	0.500,	1.000,	0.500,	0.500,	0.333,	1.000,	0.556,	0.333,
1.000,	0.350,	0.667,	0.350,	0.350,	0.333,	0.333,	0.500,	0.500,	0.350,
0.500,	1.000,	0.333,	1.000,	0.389,	0.333,	0.722,	0.350,	0.444,	0.722,
0.250,	0.333,	0.500,	0.500,	0.500,	0.500,	0.220,	0.500,	0.333,	0.747,
0.300,	0.500,	0.570,	0.333,	0.747,	0.333,	0.400,	0.570,	0.300,	0.300,
0.333,	0.556,	0.540,	0.250,	0.333,	0.300,	0.330,	0.500,	0.750,	0.750,
0.750,	0.500,	0.722,	0.722,	0.722,	0.722,	0.722,	0.722,	1.000,	0.722,
0.667,	0.667,	0.667,	0.667,	0.389,	0.389,	0.389,	0.389,	0.722,	0.722,
0.778,	0.778,	0.778,	0.778,	0.778,	0.570,	0.778,	0.722,	0.722,	0.722,
0.722,	0.722,	0.611,	0.556,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,
0.722,	0.444,	0.444,	0.444,	0.444,	0.444,	0.278,	0.278,	0.278,	0.278,
0.500,	0.556,	0.500,	0.500,	0.500,	0.500,	0.500,	0.570,	0.500,	0.556,
0.556,	0.556,	0.556,	0.500,	0.556,	0.500]

_roman_i = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.250,	0.333,	0.420,	0.500,	0.500,	0.833,	0.778,	0.214,
0.333,	0.333,	0.500,	0.675,	0.250,	0.333,	0.250,	0.278,	0.500,	0.500,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.333,	0.333,
0.675,	0.675,	0.675,	0.500,	0.920,	0.611,	0.611,	0.667,	0.722,	0.611,
0.611,	0.722,	0.722,	0.333,	0.444,	0.667,	0.556,	0.833,	0.667,	0.722,
0.611,	0.722,	0.611,	0.500,	0.556,	0.722,	0.611,	0.833,	0.611,	0.556,
0.556,	0.389,	0.278,	0.389,	0.422,	0.500,	0.333,	0.500,	0.500,	0.444,
0.500,	0.444,	0.278,	0.500,	0.500,	0.278,	0.278,	0.444,	0.278,	0.722,
0.500,	0.500,	0.500,	0.500,	0.389,	0.389,	0.278,	0.500,	0.444,	0.667,
0.444,	0.444,	0.389,	0.400,	0.275,	0.400,	0.541,	0.350,	0.500,	0.350,
0.333,	0.500,	0.556,	0.889,	0.500,	0.500,	0.333,	1.000,	0.500,	0.333,
0.944,	0.350,	0.556,	0.350,	0.350,	0.333,	0.333,	0.556,	0.556,	0.350,
0.500,	0.889,	0.333,	0.980,	0.389,	0.333,	0.667,	0.350,	0.389,	0.556,
0.250,	0.389,	0.500,	0.500,	0.500,	0.500,	0.275,	0.500,	0.333,	0.760,
0.276,	0.500,	0.675,	0.333,	0.760,	0.333,	0.400,	0.675,	0.300,	0.300,
0.333,	0.500,	0.523,	0.250,	0.333,	0.300,	0.310,	0.500,	0.750,	0.750,
0.750,	0.500,	0.611,	0.611,	0.611,	0.611,	0.611,	0.611,	0.889,	0.667,
0.611,	0.611,	0.611,	0.611,	0.333,	0.333,	0.333,	0.333,	0.722,	0.667,
0.722,	0.722,	0.722,	0.722,	0.722,	0.675,	0.722,	0.722,	0.722,	0.722,
0.722,	0.556,	0.611,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,
0.667,	0.444,	0.444,	0.444,	0.444,	0.444,	0.278,	0.278,	0.278,	0.278,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.675,	0.500,	0.500,
0.500,	0.500,	0.500,	0.444,	0.500,	0.444]

_roman_bi = [
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,	0.000,
0.000,	0.000,	0.250,	0.389,	0.555,	0.500,	0.500,	0.833,	0.778,	0.278,
0.333,	0.333,	0.500,	0.570,	0.250,	0.333,	0.250,	0.278,	0.500,	0.500,
0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.333,	0.333,
0.570,	0.570,	0.570,	0.500,	0.832,	0.667,	0.667,	0.667,	0.722,	0.667,
0.667,	0.722,	0.778,	0.389,	0.500,	0.667,	0.611,	0.889,	0.722,	0.722,
0.611,	0.722,	0.667,	0.556,	0.611,	0.722,	0.667,	0.889,	0.667,	0.611,
0.611,	0.333,	0.278,	0.333,	0.570,	0.500,	0.333,	0.500,	0.500,	0.444,
0.500,	0.444,	0.333,	0.500,	0.556,	0.278,	0.278,	0.500,	0.278,	0.778,
0.556,	0.500,	0.500,	0.500,	0.389,	0.389,	0.278,	0.556,	0.444,	0.667,
0.500,	0.444,	0.389,	0.348,	0.220,	0.348,	0.570,	0.350,	0.500,	0.350,
0.333,	0.500,	0.500,	1.000,	0.500,	0.500,	0.333,	1.000,	0.556,	0.333,
0.944,	0.350,	0.611,	0.350,	0.350,	0.333,	0.333,	0.500,	0.500,	0.350,
0.500,	1.000,	0.333,	1.000,	0.389,	0.333,	0.722,	0.350,	0.389,	0.611,
0.250,	0.389,	0.500,	0.500,	0.500,	0.500,	0.220,	0.500,	0.333,	0.747,
0.266,	0.500,	0.606,	0.333,	0.747,	0.333,	0.400,	0.570,	0.300,	0.300,
0.333,	0.576,	0.500,	0.250,	0.333,	0.300,	0.300,	0.500,	0.750,	0.750,
0.750,	0.500,	0.667,	0.667,	0.667,	0.667,	0.667,	0.667,	0.944,	0.667,
0.667,	0.667,	0.667,	0.667,	0.389,	0.389,	0.389,	0.389,	0.722,	0.722,
0.722,	0.722,	0.722,	0.722,	0.722,	0.570,	0.722,	0.722,	0.722,	0.722,
0.722,	0.611,	0.611,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,	0.500,
0.722,	0.444,	0.444,	0.444,	0.444,	0.444,	0.278,	0.278,	0.278,	0.278,
0.500,	0.556,	0.500,	0.500,	0.500,	0.500,	0.500,	0.570,	0.500,	0.556,
0.556,	0.556,	0.556,	0.444,	0.500,	0.444]

_font_array = [ [_swiss, _swiss_b, _swiss_i, _swiss_bi ],
                [_roman, _roman_b, _roman_i, _roman_bi ] ]

#-------------------------------------------------------------------------
#
# 
#
#-------------------------------------------------------------------------
def string_width(font,text):
    i = font.get_type_face()
    j = font.get_bold() + font.get_italic()*2
    s = font.get_size()
    l = _font_array[i][j]
    r = 0
    for c in text:
        try:
            r = r + l[ord(c)]
        except:
            r = r + l[ord('n')]
    return (r+1)*s

def string_trim(font, text, width, ellipses = "..."):
    """
    Like string_width, but this makes sure the length of the
    string is <= width. Optionally, add ellipses (...).
    """
    i = font.get_type_face()
    j = font.get_bold() + font.get_italic()*2
    s = font.get_size()
    l = _font_array[i][j]
    ellipses_length = 0
    # get length of each letter
    for c in ellipses:
        try:
            ellipses_length += l[ord(c)]
        except:
            ellipses_length += l[ord('n')]
    # find the part that is < width
    retval = ""
    sumlen = 0
    length = 0
    for i in range(len(text)):
        c = text[i]
        try:
            length = l[ord(c)]
        except:
            length = l[ord('n')]
        # too long:
        if (sumlen + length + 1) * s > width:
            if ellipses_length > 0:
                # try again with ellipses
                retval += c
                sumlen += length
                break
            else:
                # return just this so far
                return retval
        retval += c
        sumlen += length
    # if exited out the bottom:
    if (sumlen + 1) * s <= width:
        return text
    # too long; try again with ellipses
    retval = ""
    sumlen = 0
    length = 0
    for i in range(len(text)):
        c = text[i]
        try:
            length = l[ord(c)]
        except:
            length = l[ord('n')]
        if (sumlen + length + 1) * s > width:
            return retval
        if (sumlen + length + ellipses_length + 1) * s > width:
            return retval + ellipses
        retval += c
        sumlen += length
    # should not exit out the bottom!
    return text




See more files for this project here

gramps

GRAMPS is a GNOME genealogy program for Linux and FreeBSD that allows you to easily build\r\nand keep track of your family tree.

Project homepage: http://sourceforge.net/projects/gramps
Programming language(s): Python
License: other

  BasicUtils/
    Makefile.am
    _NameDisplay.py
    _UpdateCallback.py
    __init__.py
  Config/
    Makefile.am
    _GrampsConfigKeys.py
    _GrampsGconfKeys.py
    _GrampsIniKeys.py
    __init__.py
    gen_schema_keys.py
  DataViews/
    Makefile.am
    _EventView.py
    _FamilyList.py
    _MapView.py
    _MediaView.py
    _NoteView.py
    _PedigreeView.py
    _PersonView.py
    _PlaceView.py
    _RelationView.py
    _RepositoryView.py
    _SourceView.py
    __init__.py
  DateHandler/
    Makefile.am
    _DateDisplay.py
    _DateHandler.py
  DisplayModels/
  DisplayTabs/
  Editors/
  FilterEditor/
  Filters/
  GrampsDb/
  GrampsDbUtils/
  GrampsLocale/
  GrampsLogger/
  Merge/
  Mime/
  Models/
  ObjectSelector/
  PluginUtils/
  RelLib/
  ReportBase/
  Selectors/
  Simple/
  TreeViews/
  data/
  docgen/
  glade/
  images/
  plugins/
  AddMedia.py
  ArgHandler.py
  Assistant.py
  AutoComp.py
  BaseDoc.py
  Bookmarks.py
  ColumnOrder.py
  Date.py
  DateEdit.py
  DbLoader.py
  DbManager.py
  DbState.py
  DdTargets.py
  DisplayState.py
  Errors.py
  ExportAssistant.py
  ExportOptions.py
  FontScale.py
  GrampsCfg.py
  GrampsDisplay.py
  GrampsWidgets.py
  ImgManip.py
  LdsUtils.py
  ListModel.py
  Lru.py
  Makefile.am
  ManagedWindow.py
  MarkupText.py
  Navigation.py
  PageView.py
  PlaceUtils.py
  ProgressDialog.py
  QuestionDialog.py
  QuickReports.py
  RecentFiles.py
  Relationship.py
  Reorder.py
  ScratchPad.py
  Sort.py
  Spell.py
  SubstKeywords.py
  TipOfDay.py
  ToolTips.py
  TransUtils.py
  TreeTips.py
  UndoHistory.py
  Utils.py
  ViewManager.py
  accent.py
  ansel_utf8.py
  build_cmdplug
  const.py.in
  date_test.py
  gramps.py
  gramps_main.py
  soundex.py