/usr/share/font-manager/constants.py is in font-manager 0.5.7-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | """
.
"""
# Font Manager, a font management application for the GNOME desktop
#
# Copyright (C) 2009, 2010 Jerry Casiano
#
# 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 3 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:
#
# Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301, USA.
# Disable warnings related to gettext
# pylint: disable-msg=E0602
import os
import glib
import pango
from os.path import join, splitext
from fontutils import pango_get_sample_string
PACKAGE = 'font-manager'
if os.path.exists(os.path.join(os.path.dirname(__file__), 'font-manager.in')):
VERSION = 'is not installed'
PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__))
LOCALEDIR = os.path.join(os.path.dirname(__file__), '../po')
else:
VERSION = '0.5.7'
PACKAGE_DIR = '/usr/share/font-manager'
LOCALEDIR = '/usr/share/locale'
import locale
import gettext
try:
locale.setlocale(locale.LC_ALL, '')
locale.bindtextdomain(PACKAGE, LOCALEDIR)
except locale.Error:
pass
gettext.textdomain(PACKAGE)
gettext.install(PACKAGE, LOCALEDIR)
gettext.bindtextdomain(PACKAGE, LOCALEDIR)
LANG = splitext(os.getenv('LANG', 'en_US'))[0]
PACKAGE_DATA_DIR = join(PACKAGE_DIR, 'data')
CACHE_DIR = join(glib.get_user_cache_dir(), PACKAGE)
DATABASE_FILE = join(CACHE_DIR, 'font-manager.sqlite')
CACHE_FILE = join(CACHE_DIR, 'font-manager.cache')
CONFIG_DIR = glib.get_user_config_dir()
APP_LOG = join(CACHE_DIR, 'font-manager.log')
APP_CONFIG_DIR = join(CONFIG_DIR, PACKAGE)
APP_CONFIG = join(APP_CONFIG_DIR, 'preferences.ini')
AUTOSTART_DIR = join(CONFIG_DIR, 'autostart')
DATA_DIR = join(glib.get_user_data_dir(), PACKAGE)
DESKTOP_DIR = glib.get_user_special_dir\
(glib.USER_DIRECTORY_DESKTOP)
HOME = os.getenv('HOME')
USER = os.getenv('USER')
USER_FONT_DIR = join(HOME, '.fonts')
COMPAT_COLLECTIONS = join(CONFIG_DIR, 'fontgroups.xml')
USER_FONT_COLLECTIONS = join(DATA_DIR, 'Collections.xml')
USER_FONT_COLLECTIONS_BAK = join(DATA_DIR, 'Collections.xml.bak')
USER_FONT_CONFIG = join(HOME, '.fonts.conf')
USER_FONT_CONFIG_DIR = join(APP_CONFIG_DIR, 'conf.d')
USER_FONT_CONFIG_DIRS = join(APP_CONFIG_DIR, 'directories.conf')
USER_FONT_CONFIG_RENDER = join(APP_CONFIG_DIR, 'local.conf')
USER_FONT_CONFIG_SELECT = join(APP_CONFIG_DIR, 'select.conf')
USER_FONT_CONFIG_DESELECT = join(APP_CONFIG_DIR, 'select.conf.tmp')
USER_LIBRARY_DIR = join(DATA_DIR, 'Library')
USER_LIBRARY_SYMLINK = join(USER_FONT_DIR, 'Library')
USER_ACTIONS_CONFIG = join(APP_CONFIG_DIR, 'actions.conf')
STANDARD_TEXT = pango_get_sample_string('xx')
LOCALIZED_TEXT = pango_get_sample_string(LANG.lower().replace('_', '-'))
COMPARE_TEXT = "{0}"
PREVIEW_TEXT = """{0}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
1234567890.:,;(*!?')"""
# Standard alias families
ALIAS_FAMILIES = 'Monospace', 'Sans', 'Serif'
# Most common font styles, we try to select one of these if available
DEFAULT_STYLES = ['Regular', 'Roman', 'Medium', 'Normal', 'Book']
# Font types we "support"
FONT_EXTS = ('.pfa', '.pfb', '.ttf', '.ttc', '.otf',
'.PFA', '.PFB', '.TTF', '.TTC', '.OTF')
T1_EXTS = ('.pfa', '.pfb', '.PFA', '.PFB')
FONT_GLOBS = ['*.ttf', '*.ttc', '*.otf', '*.TTF', '*.TTC', '*.OTF']
# Archive types supported by most *nix systems
ARCH_EXTS = ('.zip', '.tar', '.tar.gz', '.tar.bz2',
'.ZIP', '.TAR', '.TAR.GZ', '.TAR.BZ2')
ARCH_GLOBS = ['*.zip', '*.tar*', '*.ZIP', '*.TAR*']
README = \
_("""* This file was placed here by Font Manager because this directory
did not exist, feel free to delete, it will not be generated again.
This is a per-user font directory.
Any fonts ( or folders containing fonts ) present in this directory are
automatically picked up by the system and available, but only to you.
Please note that not only can you specify other directories to scan for
fonts from the applications preferences dialog, but you can also set the
default folder that's opened when 'Open fonts folder' is selected.
If you wish to make fonts available to everyone using the system they will
need to be placed in /usr/share/fonts
""")
USER_FONT_CONFIG_NOTICE = \
_("""
<!--
This file is maintained by Font Manager.
If you wish to make any changes it is suggested you do so using
{0}
Any changes made to this file will be automatically relocated there
at startup and any settings already in that file will be overwritten.
-->
""").format(USER_FONT_CONFIG_RENDER)
USER_FONT_CONFIG_DATA = \
"""{0}
<include ignore_missing=\"yes\">{1}</include>
<include ignore_missing=\"yes\">{2}</include>
<include ignore_missing=\"yes\">{3}</include>
<include ignore_missing=\"yes\">{4}</include>
""".format(USER_FONT_CONFIG_NOTICE, USER_FONT_CONFIG_DIR, USER_FONT_CONFIG_DIRS,
USER_FONT_CONFIG_RENDER, USER_FONT_CONFIG_SELECT)
VALID_USER_FONT_CONFIG = \
"""<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
{0}
</fontconfig>
""".format(USER_FONT_CONFIG_DATA)
OLD_NOTICE = \
"""
<!--
This file modified by Font Manager.
Do NOT edit this file, it will be replaced on startup.
Should you wish to customize anything please use
{0}
-->
""".format(USER_FONT_CONFIG_RENDER)
OLD_FONT_CONFIG = \
"""<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
{0}
<include ignore_missing=\"yes\">{1}</include>
<include ignore_missing=\"yes\">{2}</include>
<include ignore_missing=\"yes\">{3}</include>
<include ignore_missing=\"yes\">{4}</include>
</fontconfig>
""".format(OLD_NOTICE, USER_FONT_CONFIG_DIR, USER_FONT_CONFIG_DIRS,
USER_FONT_CONFIG_RENDER, USER_FONT_CONFIG_SELECT)
OLD_OLD_NOTICE = \
"""
<!--
This file modified by Font Manager.
Do NOT edit this file, it will be replaced on startup.
Should you wish to customize rendering options, use
{0}
-->
""".format(USER_FONT_CONFIG_RENDER)
OLD_OLD_FONT_CONFIG = \
"""<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
{0}
<include ignore_missing=\"yes\">{1}</include>
<include ignore_missing=\"yes\">{2}</include>
<include ignore_missing=\"yes\">{3}</include>
</fontconfig>
""".format(OLD_OLD_NOTICE, USER_FONT_CONFIG_DIRS,
USER_FONT_CONFIG_RENDER, USER_FONT_CONFIG_SELECT)
EMPTY_FONT_CONFIG = \
"""<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
</fontconfig>
"""
# Some of the most common fonts, at least according to http://www.codestyle.org/
# May or may not be valid alias targets...
COMMON_FONTS = ('A Charming Font', 'Abadi MT', 'Academy Engraved LET',
'Adobe Fangsong Std', 'Adobe Garamond', 'Adobe Heiti Std', 'Adobe Kaiti Std',
'Adobe Ming Std', 'Adobe Myungjo Std', 'Adobe Song Std', 'Agency FB', 'Alba',
'Alba Matter', 'Alba Super', 'Algerian', 'American Typewriter', 'Andale Mono',
'Andale Mono IPA', 'Andy', 'Apple Casual', 'Apple Chancery',
'Arabic Typesetting', 'Arial', 'Arial Black', 'Arial Narrow',
'Arial Rounded MT Bold', 'Arial Unicode MS', 'Avant Garde', 'Avenir',
'Baby Kruffy', 'Balker', 'Base', 'Baskerville', 'Baskerville Old Face',
'Batang', 'BatangChe', 'Bauhaus', 'Beesknees ITC', 'Bell MT', 'Belwe', 'Bembo',
'Berlin Sans FB', 'Bernard MT', 'Bernhard Modern Std',
'Berthold Akzidenz Grotesk BE', 'Bickley Script', 'Big Caslon',
'Bitstream Charter', 'Bitstream Vera Sans', 'Bitstream Vera Serif',
'Blackadder ITC', 'Blackletter', 'Bodoni MT', 'Book Antiqua', 'Bookman',
'Bookman Old Style', 'Bradley Hand ITC', 'Braggadocio', 'Britannic Bold',
'Broadway', 'Broadway BT', 'Brush Script MT', 'BudHand', 'CAMPBELL',
'Caflisch Script Pro', 'Calibri', 'Californian FB', 'Calisto MT', 'Calligraph',
'Cambria', 'Cambria Math', 'Candara', 'Capitals', 'Caslon', 'Castellar',
'Casual', 'Cataneo BT', 'Centaur', 'Century Gothic', 'Century Schoolbook',
'Century Schoolbook L', 'Chalkduster', 'Charcoal', 'Charter', 'Chicago',
'Chick', 'Chiller', 'ClearlyU', 'Colonna MT', 'Comic Sans MS', 'Consolas',
'Constantia', 'Cooper Black', 'Copperplate', 'Copperplate Gothic', 'Corbel',
'Courier', 'Courier New', 'Croobie', 'Curlz MT', 'DaunPenh', 'DecoType Naskh',
'DejaVu LGC Sans', 'DejaVu LGC Serif', 'DejaVu Sans', 'DejaVu Serif',
'Desdemona', 'Didot', 'DokChampa', 'DomBold BT', 'Domestic Manners', 'Dotum',
'DotumChe', 'Dustismo', 'Edwardian Script ITC', 'Electron', 'Engravers MT',
'Eras Bold ITC', 'Eras Demi ITC', 'Eras Light ITC', 'Eras Medium ITC',
'Estrangelo Edessa', 'Euphemia', 'Eurostile', 'FIRSTHOME', 'Fat',
'Felix Titling', 'Fine Hand', 'Fixed', 'Forte', 'Franklin Gothic',
'FreeMono', 'FreeSans', 'FreeSerif', 'Freestyle Script', 'French Script MT',
'Freshbot', 'Frosty', 'Futura', 'GENUINE', 'Gadget', 'Garamond', 'Gautami',
'Geneva', 'Georgia', 'Georgia Ref', 'Gigi', 'Gill Sans', 'Gill Sans MT',
'Gill Sans MT', 'GlooGun', 'Goudy Old Style', 'Goudy Stout', 'Gulim',
'GulimChe', 'GungSeo', 'Gungsuh', 'GungsuhChe', 'Haettenschweiler',
'Harlow Solid Italic', 'Harrington', 'Heiti SC', 'Heiti TC', 'Helvetica',
'Helvetica Narrow', 'Helvetica Neue', 'Herculanum', 'High Tower Text',
'Highlight LET', 'Hiragino Kaku Gothic ProN', 'Hiragino Kaku Gothic StdN',
'Hiragino Maru Gothic ProN', 'Hiragino Mincho ProN', 'Hoefler Text',
'ITC Century', 'ITC Franklin Gothic', 'Impact', 'Imprint MT Shadow',
'Informal Roman', 'Interstate', 'Isabella', 'Iskoola Pota', 'Jenkins v',
'John Handy LET', 'Jokerman', 'Jokerman LET', 'Jokewood', 'Juice ITC',
'Junkyard', 'Kabel Ult BT', 'Kailasa', 'Kalinga', 'Kartika', 'Kaufmann',
'Kino MT', 'Kokonor', 'Kristen ITC', 'Kunstler Script', 'La Bamba LET',
'Latha', 'Liberation Mono', 'Liberation Sans', 'Liberation Serif',
'Linux Libertine', 'Linux Libertine C', 'Lucida', 'Lucida Bright',
'Lucida Calligraphy', 'Lucida Console', 'Lucida Fax', 'Lucida Grande',
'Lucida Handwriting', 'Lucida Sans', 'Lucida Sans Typewriter',
'Lucida Sans Unicode', 'Lucida Typewriter', 'LucidaBright', 'Luxi Mono',
'Luxi Sans', 'Luxi Serif', 'MARKETPRO', 'MS Gothic', 'MS Mincho', 'MS PGothic',
'MS PMincho', 'MS Reference Sans Serif', 'MS Reference Serif', 'MS UI Gothic',
'MV Boli', 'Magneto', 'Maiandra GD', 'Mangal', 'Marked Fool', 'Marker Felt',
'Matisse ITC', 'Matura MT Script Capitals', 'Mead Bold', 'Mekanik LET', 'Menlo',
'Mercurius Script MT', 'Metal', 'MgOpen Canonica', 'MgOpen Cosmetica',
'MgOpen Modata', 'MgOpen Moderna', 'Microsoft Sans Serif', 'Microsoft Yi Baiti',
'Milano LET', 'MingLiU', 'Minion Std', 'Minion Web', 'MisterEarl BT', 'Mistral',
'Monaco', 'Mongolian Baiti', 'Monotype Corsiva', 'Monotype.com', 'NSimSun',
'New Century Schoolbook', 'New York', 'News Gothic MT', 'Niagara Engraved',
'Niagara Solid', 'Nice', 'Nimbus Mono L', 'Nimbus Roman No', 'Nimbus Sans L',
'Nyala', 'OCR A Extended', 'OCRB', 'Odessa LET', 'Old English Text MT',
'OldDreadfulNo', 'One Stroke Script LET', 'Onyx', 'Optima', 'Orange LET',
'PMingLiU', 'Palace Script MT', 'Palatino', 'Palatino Linotype', 'Papyrus',
'ParkAvenue BT', 'Penguin Attack', 'Pepita MT', 'Perpetua',
'Perpetua Titling MT', 'Playbill', 'Poornut', 'Porcelain', 'Pristina',
'Pump Demi Bold LET', 'Pussycat', 'Quixley LET', 'Raavi', 'Rage Italic',
'Rage Italic LET', 'Ravie', 'Rockwell', 'RotisSemiSans', 'Ruach LET',
'Runic MT', 'Sand', 'Script MT', 'Scruff LET', 'Segoe Print', 'Segoe Script',
'Segoe UI', 'Shelley', 'Showcard Gothic', 'Shruti', 'SimHei', 'SimSun', 'Skia',
'Smudger LET', 'Snap ITC', 'Square', 'Staccato', 'Stencil', 'Sylfaen', 'Tahoma',
'Techno', 'Tempus Sans ITC', 'Terminal', 'Textile', 'Times', 'Times New Roman',
'Tiranti Solid LET', 'TradeGothic', 'Trebuchet MS', 'Tunga', 'Tw Cen MT',
'URW Bookman L', 'URW Chancery L', 'URW Gothic L', 'URW Palladio L',
'University Roman LET', 'Utopia', 'Vera Sans', 'Vera Sans Mono', 'Vera Serif',
'Verdana', 'Verdana Ref', 'Victorian LET', 'Viner Hand ITC')
FC_BUTTONORDER = ('Anti-Alias', 'Auto-Hint', 'Hinting', 'LCD Filter',
'Force Spacing', 'Use Global Advance data',
'Use Embedded Bitmaps', 'Disable rgba', 'Smaller than',
'Larger than')
FC_CHECKBUTTONS = {
'Anti-Alias' : _('Anti-Alias'),
'Auto-Hint' : _('Auto-Hint'),
'Hinting' : _('Hinting'),
'LCD Filter' : _('LCD Filter'),
'Force Spacing' : _('Force Spacing'),
'Use Global Advance data' : _('Use Global Advance data'),
'Use Embedded Bitmaps' : _('Use Embedded Bitmaps'),
'Disable rgba' : _('Disable rgba'),
'Smaller than' : _('Smaller than'),
'Larger than' : _('Larger than')
}
FC_CONSTS = {
'hintstyle' : {
'0' : 'hintnone',
'1' : 'hintslight',
'2' : 'hintmedium',
'3' : 'hintfull'
},
'lcdfilter' : {
'0' : 'lcdnone',
'1' : 'lcddefault',
'2' : 'lcdlight',
'3' : 'lcdlegacy'
},
'spacing' : {
'0' : 'proportional',
'1' : 'dual',
'2' : 'mono',
'3' : 'charcell'
}
}
FC_CONSTS_MAP = {
'hinting' : 'hintstyle',
'lcdfiltering' : 'lcdfilter',
'forcespacing' : 'spacing'
}
FC_DEFAULTS = {
'antialias' : False,
'autohint' : False,
'embeddedbitmap' : False,
'smallerthan' : False,
'largerthan' : False,
'globaladvance' : False,
'hinting' : False,
'hintstyle' : 0.0,
'lcdfiltering' : False,
'lcdfilter' : 0.0,
'forcespacing' : False,
'spacing' : 0.0,
'min_size' : 0.0,
'max_size' : 0.0,
'disablergba' : False
}
FC_WIDGETMAP = {
'Anti-Alias' : 'antialias',
'Auto-Hint' : 'autohint',
'Hinting' : 'hinting',
'LCD Filter' : 'lcdfiltering',
'Force Spacing' : 'forcespacing',
'Use Global Advance data' : 'globaladvance',
'Use Embedded Bitmaps' : 'embeddedbitmap',
'Smaller than' : 'smallerthan',
'Larger than' : 'largerthan',
'Disable rgba' : 'disablergba',
'HintScale' : 'hintstyle',
'FilterScale' : 'lcdfilter',
'SpacingScale' : 'spacing'
}
# These are basically identical between pango and fc
PSLANT = {
0 : 'roman',
1 : 'oblique',
2 : 'italic'
}
FC_SKIP = ('LCD Filter', 'Force Spacing', 'Exclude size range', 'Disable rgba',
'Smaller than', 'Larger than')
FC_SCALES = {
'Hinting' : 'HintScale',
'LCD Filter' : 'FilterScale',
'Force Spacing' : 'SpacingScale'
}
FC_SCALE_LABELS = {
'HintScale' : {
0.0 : _('None'),
0.1 : _('Slight'),
0.2 : _('Medium'),
0.3 : _('Full')
},
'FilterScale' : {
0.0 : _('None'),
0.1 : _('Default'),
0.2 : _('Light'),
0.3 : _('Legacy')
},
'SpacingScale' : {
0.0 : _('Proportional'),
0.1 : _('Dual'),
0.2 : _('Mono'),
0.3 : _('Charcell')
}
}
FC_SCALE_SENSITIVITY = {
'HintScale' : 'hinting',
'FilterScale' : 'lcdfiltering',
'SpacingScale' : 'forcespacing'
}
FC_SENSITIVITY = {
'Auto-Hint' : 'Hinting',
'Hinting' : 'Auto-Hint',
'Larger than' : 'max_size',
'Smaller than' : 'min_size'
}
# These are basically identical between pango and fc
PWIDTH = {
0 : 'ultracondensed',
1 : 'extracondensed',
2 : 'condensed',
3 : 'semicondensed',
4 : 'normal',
5 : 'semiexpanded',
6 : 'expanded',
7 : 'extraexpanded',
8 : 'ultraexpanded'
}
# Map of pango to fc values
if pango.version() < 12400:
PWEIGHT = {
200 : '0:40',
300 : '40:50',
400 : '50:100',
700 : '180:200',
800 : '200:205',
900 : '205:210'
}
else:
PWEIGHT = {
100 : '0:0',
200 : '0:40',
300 : '40:50',
380 : '50:75',
400 : '75:80',
500 : '80:100',
600 : '100:180',
700 : '180:200',
800 : '200:205',
900 : '205:210',
1000 : '210:210'
}
|