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
|
#Copyright ReportLab Europe Ltd. 2000-2017
#see license.txt for license details
'''default settings for reportlab
to override these drop a module rl_local_settings.py parallel to this file or
anywhere on the path.
'''
import os, sys
__version__='3.3.0'
__all__=tuple('''allowTableBoundsErrors
shapeChecking
defaultEncoding
defaultGraphicsFontName
pageCompression
useA85
defaultPageSize
defaultImageCaching
warnOnMissingFontGlyphs
verbose
showBoundary
emptyTableAction
invariant
eps_preview_transparent
eps_preview
eps_ttf_embed
eps_ttf_embed_uid
overlapAttachedSpace
longTableOptimize
autoConvertEncoding
_FUZZ
wrapA85
fsEncodings
odbc_driver
platypus_link_underline
canvas_basefontname
allowShortTableRows
imageReaderFlags
paraFontSizeHeightOffset
canvas_baseColor
ignoreContainerActions
ttfAsciiReadable
pdfMultiLine
pdfComments
debug
listWrapOnFakeWidth
T1SearchPath
TTFSearchPath
CMapSearchPath
decimalSymbol
errorOnDuplicatePageLabelPage
autoGenerateMissingTTFName
allowTTFSubsetting
spaceShrinkage
underlineWidth
underlineOffset
underlineGap
strikeWidth
strikeOffset
strikeGap
hyphenationLang
uriWasteReduce
embeddedHyphenation
hyphenationMinWordLength
reserveTTFNotdef
documentLang
encryptionStrength
trustedHosts
trustedSchemes
renderPMBackend
xmlParser
textPaths
toColorCanUse
defCWRF
unShapedFontGlob'''.split())
allowTableBoundsErrors = 1 # set to 0 to die on too large elements in tables in debug (recommend 1 for production use)
shapeChecking = 1
defaultEncoding = 'WinAnsiEncoding' # 'WinAnsi' or 'MacRoman'
defaultGraphicsFontName= 'Times-Roman' #initializer for STATE_DEFAULTS in shapes.py
pageCompression = 1 # default page compression mode
useA85 = 1 #set to 0 to disable Ascii Base 85 stream filters
defaultPageSize = 'A4' #default page size
defaultImageCaching = 0 #set to zero to remove those annoying cached images
warnOnMissingFontGlyphs = 0 #if 1, warns of each missing glyph
verbose = 0
showBoundary = 0 # turns on and off boundary behaviour in Drawing
emptyTableAction= 'error' # one of 'error', 'indicate', 'ignore'
invariant= 0 #produces repeatable,identical PDFs with same timestamp info (for regression testing)
eps_preview_transparent= None #set to white etc
eps_preview= 1 #set to False to disable
eps_ttf_embed= 1 #set to False to disable
eps_ttf_embed_uid= 0 #set to 1 to enable
overlapAttachedSpace= 1 #if set non false then adajacent flowable space after
#and space before are merged (max space is used).
longTableOptimize = 1 #default do use Henning von Bargen's long table optimizations
autoConvertEncoding = 0 #convert internally as needed (experimental)
_FUZZ= 1e-6 #fuzz for layout arithmetic
wrapA85= 0 #set to 1 to get old wrapped line behaviour
fsEncodings=('utf8','cp1252','cp430') #encodings to attempt utf8 conversion with
odbc_driver= 'odbc' #default odbc driver
platypus_link_underline= 0 #paragraph links etc underlined if true
canvas_basefontname= 'Helvetica' #this is used to initialize the canvas; if you override to make
#something else you are responsible for ensuring the font is registered etc etc
#this will be used everywhere and the font family connections will be made
#if the bold/italic/bold italic fonts are also registered and defined as a family.
allowShortTableRows=1 #allows some rows in a table to be short
imageReaderFlags=0 #no longer in use
paraFontSizeHeightOffset= 1 #if true paragraphs start at height-fontSize
canvas_baseColor= None #initialize the canvas fill and stroke colors if this is set
ignoreContainerActions= 1 #if true then action flowables in flowable _Containers will be ignored
ttfAsciiReadable= 1 #smaller subsets when set to 0
pdfMultiLine= 0 #use more lines in pdf etc
pdfComments= 0 #put in pdf comments
debug= 0 #for debugging code
listWrapOnFakeWidth= 1 #set to 0/False to force platypus.flowables._listWrapOn to report correct widths
#else it reports minimum(required,available) width
underlineWidth= '' #empty to use canvas strokeWidth or a distance or number*<letter>
# num * <letter> make value proportional to a font size
# P paragraph font size
# L line max font size
# f first use font size
# F max fontsize in the tag
underlineOffset= '-0.125*F' #fraction of fontSize from baseline to draw underlines at.
underlineGap= '1' #gap for double/triple underline
strikeWidth= ''
strikeOffset= '0.25*F' #fraction of fontSize from baseline to draw strike through at.
strikeGap= '1' #gap for double/triple strike
#by default typical value 0.05. may be overridden on a parastyle.
decimalSymbol= '.' #what we use to align floats numerically
errorOnDuplicatePageLabelPage= 0 #if True will cause repeated PageLabel page numbers to raise an error.
autoGenerateMissingTTFName=0 #if true we try to auto generate any missing TTF font name
allowTTFSubsetting= [] #list of font file names that will be subsetted even when they
#have the no subsetting flag set. These should be fonts for which
#the user has explicit permission from the rights holder(s).
#This flag could already be overcome by hacking the code.
#ReportLab takes no responsibility for the use of this setting.
spaceShrinkage=0.05 #allowable space shrinkage to make lines fit
hyphenationLang='' #if pyphen installed set this to the language of your choice
#eg 'en_GB'
uriWasteReduce=0 #split URI if we would waste 0.3 of a line or if the URI#
#would not fit on the next line; if zero then no splitting
#is attempted. suggested value = 0.3
embeddedHyphenation=0 #if true attempt hypenation of words with embedded hyphens
hyphenationMinWordLength=5 #minimum length of words that can be hyphenated
reserveTTFNotdef=1 #if true force subset element 0 to be zero(.notdef)
#helps to fix bug in edge; this is now ignored in code
#PDFUA forbids index 0(.notdef) in strings
documentLang=None #pdf document catalog Lang value xx-xx not ee_xx
encryptionStrength=40 #the bits for standard encryption 40, 128 or 256 (AES)
trustedHosts=None #set to a list of trusted for access hosts None means
#all are trusted glob patterns eg *.reportlab.com are
#allowed. In environment use a comma separated string.
trustedSchemes=['file', 'rml', 'data', 'https', #these url schemes are trusted
'http', 'ftp']
renderPMBackend='rlPyCairo' #or '_renderPM' if available
xmlParser='lxml' #or 'pyrxp' for preferred xml parsing
textPaths='freetype' #freetype or _renderPM or backend
#determines what code is used to create Paths from str
#see reportlab/graphics/utils.py for full horror
toColorCanUse='rl_extended_literal_eval' #change to None or 'rl_safe_eval' depending on trust
defCWRF=0.02 #fraction we can reduce defined column widths for overcommitted
#undefined widths
unShapedFontGlob=None #None or space list of glob patterns that force off shaping
# places to look for T1Font information
T1SearchPath = (
'c:/Program Files/Adobe/Acrobat 9.0/Resource/Font',
'c:/Program Files/Adobe/Acrobat 8.0/Resource/Font',
'c:/Program Files/Adobe/Acrobat 7.0/Resource/Font',
'c:/Program Files/Adobe/Acrobat 6.0/Resource/Font', #Win32, Acrobat 6
'c:/Program Files/Adobe/Acrobat 5.0/Resource/Font', #Win32, Acrobat 5
'c:/Program Files/Adobe/Acrobat 4.0/Resource/Font', #Win32, Acrobat 4
'%(disk)s/Applications/Python %(sys_version)s/reportlab/fonts', #Mac?
'/usr/lib/Acrobat9/Resource/Font', #Linux, Acrobat 5?
'/usr/lib/Acrobat8/Resource/Font', #Linux, Acrobat 5?
'/usr/lib/Acrobat7/Resource/Font', #Linux, Acrobat 5?
'/usr/lib/Acrobat6/Resource/Font', #Linux, Acrobat 5?
'/usr/lib/Acrobat5/Resource/Font', #Linux, Acrobat 5?
'/usr/lib/Acrobat4/Resource/Font', #Linux, Acrobat 4
'/usr/local/Acrobat9/Resource/Font', #Linux, Acrobat 5?
'/usr/local/Acrobat8/Resource/Font', #Linux, Acrobat 5?
'/usr/local/Acrobat7/Resource/Font', #Linux, Acrobat 5?
'/usr/local/Acrobat6/Resource/Font', #Linux, Acrobat 5?
'/usr/local/Acrobat5/Resource/Font', #Linux, Acrobat 5?
'/usr/local/Acrobat4/Resource/Font', #Linux, Acrobat 4
'/usr/share/fonts/default/Type1', #Linux, Fedora
'%(REPORTLAB_DIR)s/fonts', #special
'%(REPORTLAB_DIR)s/../fonts', #special
'%(REPORTLAB_DIR)s/../../fonts', #special
'%(CWD)s/fonts', #special
'~/fonts',
'~/.fonts',
'%(XDG_DATA_HOME)s/fonts',
'~/.local/share/fonts',
'/usr/lib/python3/dist-packages/reportlab/fonts',
'/usr/share/fonts/X11/Type1/',
)
# places to look for TT Font information
TTFSearchPath = (
'c:/winnt/fonts',
'c:/windows/fonts',
'/usr/lib/X11/fonts/TrueType/',
'/usr/share/fonts/truetype',
'/usr/share/fonts', #Linux, Fedora
'/usr/share/fonts/dejavu', #Linux, Fedora
'%(REPORTLAB_DIR)s/fonts', #special
'%(REPORTLAB_DIR)s/../fonts', #special
'%(REPORTLAB_DIR)s/../../fonts',#special
'%(CWD)s/fonts', #special
'~/fonts',
'~/.fonts',
'%(XDG_DATA_HOME)s/fonts',
'~/.local/share/fonts',
#mac os X - from
#http://developer.apple.com/technotes/tn/tn2024.html
'~/Library/Fonts',
'/Library/Fonts',
'/Network/Library/Fonts',
'/System/Library/Fonts',
)
# places to look for CMap files - should ideally merge with above
CMapSearchPath = (
'/usr/lib/Acrobat9/Resource/CMap',
'/usr/lib/Acrobat8/Resource/CMap',
'/usr/lib/Acrobat7/Resource/CMap',
'/usr/lib/Acrobat6/Resource/CMap',
'/usr/lib/Acrobat5/Resource/CMap',
'/usr/lib/Acrobat4/Resource/CMap',
'/usr/local/Acrobat9/Resource/CMap',
'/usr/local/Acrobat8/Resource/CMap',
'/usr/local/Acrobat7/Resource/CMap',
'/usr/local/Acrobat6/Resource/CMap',
'/usr/local/Acrobat5/Resource/CMap',
'/usr/local/Acrobat4/Resource/CMap',
'C:\\Program Files\\Adobe\\Acrobat\\Resource\\CMap',
'C:\\Program Files\\Adobe\\Acrobat 9.0\\Resource\\CMap',
'C:\\Program Files\\Adobe\\Acrobat 8.0\\Resource\\CMap',
'C:\\Program Files\\Adobe\\Acrobat 7.0\\Resource\\CMap',
'C:\\Program Files\\Adobe\\Acrobat 6.0\\Resource\\CMap',
'C:\\Program Files\\Adobe\\Acrobat 5.0\\Resource\\CMap',
'C:\\Program Files\\Adobe\\Acrobat 4.0\\Resource\\CMap',
'%(REPORTLAB_DIR)s/fonts/CMap', #special
'%(REPORTLAB_DIR)s/../fonts/CMap', #special
'%(REPORTLAB_DIR)s/../../fonts/CMap', #special
'%(CWD)s/fonts/CMap', #special
'%(CWD)s/fonts', #special
'~/fonts/CMap',
'~/.fonts/CMap',
'%(XDG_DATA_HOME)s/fonts/CMap',
'~/.local/share/fonts/CMap',
)
if sys.platform.startswith('linux'):
def _findFontDirs(*ROOTS):
R = [].append
for rootd in ROOTS:
for root, dirs, files in os.walk(rootd):
if not files: continue
R(root)
return tuple(R.__self__)
T1SearchPath = T1SearchPath + _findFontDirs(
'/usr/share/fonts/type1',
'/usr/share/fonts/Type1',
)
TTFSearchPath = TTFSearchPath + _findFontDirs(
'/usr/share/fonts/truetype',
'/usr/share/fonts/TTF',
)
|