rl_settings.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. #Copyright ReportLab Europe Ltd. 2000-2017
  2. #see license.txt for license details
  3. '''default settings for reportlab
  4. to override these drop a module rl_local_settings.py parallel to this file or
  5. anywhere on the path.
  6. '''
  7. import os, sys
  8. __version__='3.3.0'
  9. __all__=tuple('''allowTableBoundsErrors
  10. shapeChecking
  11. defaultEncoding
  12. defaultGraphicsFontName
  13. pageCompression
  14. useA85
  15. defaultPageSize
  16. defaultImageCaching
  17. ZLIB_WARNINGS
  18. warnOnMissingFontGlyphs
  19. verbose
  20. showBoundary
  21. emptyTableAction
  22. invariant
  23. eps_preview_transparent
  24. eps_preview
  25. eps_ttf_embed
  26. eps_ttf_embed_uid
  27. overlapAttachedSpace
  28. longTableOptimize
  29. autoConvertEncoding
  30. _FUZZ
  31. wrapA85
  32. fsEncodings
  33. odbc_driver
  34. platypus_link_underline
  35. canvas_basefontname
  36. allowShortTableRows
  37. imageReaderFlags
  38. paraFontSizeHeightOffset
  39. canvas_baseColor
  40. ignoreContainerActions
  41. ttfAsciiReadable
  42. pdfMultiLine
  43. pdfComments
  44. debug
  45. rtlSupport
  46. listWrapOnFakeWidth
  47. T1SearchPath
  48. TTFSearchPath
  49. CMapSearchPath
  50. decimalSymbol
  51. errorOnDuplicatePageLabelPage
  52. autoGenerateMissingTTFName
  53. allowTTFSubsetting
  54. spaceShrinkage
  55. underlineWidth
  56. underlineOffset
  57. underlineGap
  58. strikeWidth
  59. strikeOffset
  60. strikeGap
  61. hyphenationLang
  62. uriWasteReduce
  63. embeddedHyphenation
  64. hyphenationMinWordLength
  65. reserveTTFNotdef
  66. documentLang
  67. encryptionStrength
  68. trustedHosts
  69. trustedSchemes
  70. renderPMBackend'''.split())
  71. allowTableBoundsErrors = 1 # set to 0 to die on too large elements in tables in debug (recommend 1 for production use)
  72. shapeChecking = 1
  73. defaultEncoding = 'WinAnsiEncoding' # 'WinAnsi' or 'MacRoman'
  74. defaultGraphicsFontName= 'Times-Roman' #initializer for STATE_DEFAULTS in shapes.py
  75. pageCompression = 1 # default page compression mode
  76. useA85 = 1 #set to 0 to disable Ascii Base 85 stream filters
  77. defaultPageSize = 'A4' #default page size
  78. defaultImageCaching = 0 #set to zero to remove those annoying cached images
  79. ZLIB_WARNINGS = 1
  80. warnOnMissingFontGlyphs = 0 #if 1, warns of each missing glyph
  81. verbose = 0
  82. showBoundary = 0 # turns on and off boundary behaviour in Drawing
  83. emptyTableAction= 'error' # one of 'error', 'indicate', 'ignore'
  84. invariant= 0 #produces repeatable,identical PDFs with same timestamp info (for regression testing)
  85. eps_preview_transparent= None #set to white etc
  86. eps_preview= 1 #set to False to disable
  87. eps_ttf_embed= 1 #set to False to disable
  88. eps_ttf_embed_uid= 0 #set to 1 to enable
  89. overlapAttachedSpace= 1 #if set non false then adajacent flowable space after
  90. #and space before are merged (max space is used).
  91. longTableOptimize = 1 #default do use Henning von Bargen's long table optimizations
  92. autoConvertEncoding = 0 #convert internally as needed (experimental)
  93. _FUZZ= 1e-6 #fuzz for layout arithmetic
  94. wrapA85= 0 #set to 1 to get old wrapped line behaviour
  95. fsEncodings=('utf8','cp1252','cp430') #encodings to attempt utf8 conversion with
  96. odbc_driver= 'odbc' #default odbc driver
  97. platypus_link_underline= 0 #paragraph links etc underlined if true
  98. canvas_basefontname= 'Helvetica' #this is used to initialize the canvas; if you override to make
  99. #something else you are responsible for ensuring the font is registered etc etc
  100. #this will be used everywhere and the font family connections will be made
  101. #if the bold/italic/bold italic fonts are also registered and defined as a family.
  102. allowShortTableRows=1 #allows some rows in a table to be short
  103. imageReaderFlags=0 #attempt to convert images into internal memory files to reduce
  104. #the number of open files (see lib.utils.ImageReader)
  105. #if imageReaderFlags&2 then attempt autoclosing of those files
  106. #if imageReaderFlags&4 then cache data
  107. #if imageReaderFlags==-1 then use Ralf Schmitt's re-opening approach
  108. paraFontSizeHeightOffset= 1 #if true paragraphs start at height-fontSize
  109. canvas_baseColor= None #initialize the canvas fill and stroke colors if this is set
  110. ignoreContainerActions= 1 #if true then action flowables in flowable _Containers will be ignored
  111. ttfAsciiReadable= 1 #smaller subsets when set to 0
  112. pdfMultiLine= 0 #use more lines in pdf etc
  113. pdfComments= 0 #put in pdf comments
  114. debug= 0 #for debugging code
  115. rtlSupport= 0 #set to 1 to attempt import of RTL assistance eg fribidi etc etc
  116. listWrapOnFakeWidth= 1 #set to 0/False to force platypus.flowables._listWrapOn to report correct widths
  117. #else it reports minimum(required,available) width
  118. underlineWidth= '' #empty to use canvas strokeWidth or a distance or number*<letter>
  119. # num * <letter> make value proportional to a font size
  120. # P paragraph font size
  121. # L line max font size
  122. # f first use font size
  123. # F max fontsize in the tag
  124. underlineOffset= '-0.125*F' #fraction of fontSize from baseline to draw underlines at.
  125. underlineGap= '1' #gap for double/triple underline
  126. strikeWidth= ''
  127. strikeOffset= '0.25*F' #fraction of fontSize from baseline to draw strike through at.
  128. strikeGap= '1' #gap for double/triple strike
  129. #by default typical value 0.05. may be overridden on a parastyle.
  130. decimalSymbol= '.' #what we use to align floats numerically
  131. errorOnDuplicatePageLabelPage= 0 #if True will cause repeated PageLabel page numbers to raise an error.
  132. autoGenerateMissingTTFName=0 #if true we try to auto generate any missing TTF font name
  133. allowTTFSubsetting= [] #list of font file names that will be subsetted even when they
  134. #have the no subsetting flag set. These should be fonts for which
  135. #the user has explicit permission from the rights holder(s).
  136. #This flag could already be overcome by hacking the code.
  137. #ReportLab takes no responsibility for the use of this setting.
  138. spaceShrinkage=0.05 #allowable space shrinkage to make lines fit
  139. hyphenationLang='' #if pyphen installed set this to the language of your choice
  140. #eg 'en_GB'
  141. uriWasteReduce=0 #split URI if we would waste 0.3 of a line or if the URI#
  142. #would not fit on the next line; if zero then no splitting
  143. #is attempted. suggested value = 0.3
  144. embeddedHyphenation=0 #if true attempt hypenation of words with embedded hyphens
  145. hyphenationMinWordLength=5 #minimum length of words that can be hyphenated
  146. reserveTTFNotdef=0 #if true force subset element 0 to be zero(.notdef)
  147. #helps to fix bug in edge
  148. documentLang=None #pdf document catalog Lang value xx-xx not ee_xx
  149. encryptionStrength=40 #the bits for standard encryption 40, 128 or 256 (AES)
  150. trustedHosts=None #set to a list of trusted for access hosts None means
  151. #all are trusted glob patterns eg *.reportlab.com are
  152. #allowed. In environment use a comma separated string.
  153. trustedSchemes=['file', 'rml', 'data', 'https', #these url schemes are trusted
  154. 'http', 'ftp']
  155. renderPMBackend='_renderPM' #or 'rlPyCairo' if available
  156. # places to look for T1Font information
  157. T1SearchPath = (
  158. 'c:/Program Files/Adobe/Acrobat 9.0/Resource/Font',
  159. 'c:/Program Files/Adobe/Acrobat 8.0/Resource/Font',
  160. 'c:/Program Files/Adobe/Acrobat 7.0/Resource/Font',
  161. 'c:/Program Files/Adobe/Acrobat 6.0/Resource/Font', #Win32, Acrobat 6
  162. 'c:/Program Files/Adobe/Acrobat 5.0/Resource/Font', #Win32, Acrobat 5
  163. 'c:/Program Files/Adobe/Acrobat 4.0/Resource/Font', #Win32, Acrobat 4
  164. '%(disk)s/Applications/Python %(sys_version)s/reportlab/fonts', #Mac?
  165. '/usr/lib/Acrobat9/Resource/Font', #Linux, Acrobat 5?
  166. '/usr/lib/Acrobat8/Resource/Font', #Linux, Acrobat 5?
  167. '/usr/lib/Acrobat7/Resource/Font', #Linux, Acrobat 5?
  168. '/usr/lib/Acrobat6/Resource/Font', #Linux, Acrobat 5?
  169. '/usr/lib/Acrobat5/Resource/Font', #Linux, Acrobat 5?
  170. '/usr/lib/Acrobat4/Resource/Font', #Linux, Acrobat 4
  171. '/usr/local/Acrobat9/Resource/Font', #Linux, Acrobat 5?
  172. '/usr/local/Acrobat8/Resource/Font', #Linux, Acrobat 5?
  173. '/usr/local/Acrobat7/Resource/Font', #Linux, Acrobat 5?
  174. '/usr/local/Acrobat6/Resource/Font', #Linux, Acrobat 5?
  175. '/usr/local/Acrobat5/Resource/Font', #Linux, Acrobat 5?
  176. '/usr/local/Acrobat4/Resource/Font', #Linux, Acrobat 4
  177. '/usr/share/fonts/default/Type1', #Linux, Fedora
  178. '%(REPORTLAB_DIR)s/fonts', #special
  179. '%(REPORTLAB_DIR)s/../fonts', #special
  180. '%(REPORTLAB_DIR)s/../../fonts', #special
  181. '%(CWD)s/fonts', #special
  182. '~/fonts',
  183. '~/.fonts',
  184. '%(XDG_DATA_HOME)s/fonts',
  185. '~/.local/share/fonts',
  186. )
  187. # places to look for TT Font information
  188. TTFSearchPath = (
  189. 'c:/winnt/fonts',
  190. 'c:/windows/fonts',
  191. '/usr/lib/X11/fonts/TrueType/',
  192. '/usr/share/fonts/truetype',
  193. '/usr/share/fonts', #Linux, Fedora
  194. '/usr/share/fonts/dejavu', #Linux, Fedora
  195. '%(REPORTLAB_DIR)s/fonts', #special
  196. '%(REPORTLAB_DIR)s/../fonts', #special
  197. '%(REPORTLAB_DIR)s/../../fonts',#special
  198. '%(CWD)s/fonts', #special
  199. '~/fonts',
  200. '~/.fonts',
  201. '%(XDG_DATA_HOME)s/fonts',
  202. '~/.local/share/fonts',
  203. #mac os X - from
  204. #http://developer.apple.com/technotes/tn/tn2024.html
  205. '~/Library/Fonts',
  206. '/Library/Fonts',
  207. '/Network/Library/Fonts',
  208. '/System/Library/Fonts',
  209. )
  210. # places to look for CMap files - should ideally merge with above
  211. CMapSearchPath = (
  212. '/usr/lib/Acrobat9/Resource/CMap',
  213. '/usr/lib/Acrobat8/Resource/CMap',
  214. '/usr/lib/Acrobat7/Resource/CMap',
  215. '/usr/lib/Acrobat6/Resource/CMap',
  216. '/usr/lib/Acrobat5/Resource/CMap',
  217. '/usr/lib/Acrobat4/Resource/CMap',
  218. '/usr/local/Acrobat9/Resource/CMap',
  219. '/usr/local/Acrobat8/Resource/CMap',
  220. '/usr/local/Acrobat7/Resource/CMap',
  221. '/usr/local/Acrobat6/Resource/CMap',
  222. '/usr/local/Acrobat5/Resource/CMap',
  223. '/usr/local/Acrobat4/Resource/CMap',
  224. 'C:\\Program Files\\Adobe\\Acrobat\\Resource\\CMap',
  225. 'C:\\Program Files\\Adobe\\Acrobat 9.0\\Resource\\CMap',
  226. 'C:\\Program Files\\Adobe\\Acrobat 8.0\\Resource\\CMap',
  227. 'C:\\Program Files\\Adobe\\Acrobat 7.0\\Resource\\CMap',
  228. 'C:\\Program Files\\Adobe\\Acrobat 6.0\\Resource\\CMap',
  229. 'C:\\Program Files\\Adobe\\Acrobat 5.0\\Resource\\CMap',
  230. 'C:\\Program Files\\Adobe\\Acrobat 4.0\\Resource\\CMap',
  231. '%(REPORTLAB_DIR)s/fonts/CMap', #special
  232. '%(REPORTLAB_DIR)s/../fonts/CMap', #special
  233. '%(REPORTLAB_DIR)s/../../fonts/CMap', #special
  234. '%(CWD)s/fonts/CMap', #special
  235. '%(CWD)s/fonts', #special
  236. '~/fonts/CMap',
  237. '~/.fonts/CMap',
  238. '%(XDG_DATA_HOME)s/fonts/CMap',
  239. '~/.local/share/fonts/CMap',
  240. )
  241. if sys.platform.startswith('linux'):
  242. def _findFontDirs(*ROOTS):
  243. R = [].append
  244. for rootd in ROOTS:
  245. for root, dirs, files in os.walk(rootd):
  246. if not files: continue
  247. R(root)
  248. return tuple(R.__self__)
  249. T1SearchPath = T1SearchPath + _findFontDirs(
  250. '/usr/share/fonts/type1',
  251. '/usr/share/fonts/Type1',
  252. )
  253. TTFSearchPath = TTFSearchPath + _findFontDirs(
  254. '/usr/share/fonts/truetype',
  255. '/usr/share/fonts/TTF',
  256. )