Answers the main root style tha contains all default style attributes of PageBot. To be overwritten when needed by calling applications. CAPITALIZED attribute names are for reference only. Not used directly from styles. They can be copied on other style attributes. Note that if the
(u=None, w=None, h=None, **kwargs)
| 97 | return new |
| 98 | |
| 99 | def getRootStyle(u=None, w=None, h=None, **kwargs): |
| 100 | """Answers the main root style tha contains all default style attributes of |
| 101 | PageBot. To be overwritten when needed by calling applications. |
| 102 | |
| 103 | CAPITALIZED attribute names are for reference only. Not used directly from |
| 104 | styles. They can be copied on other style attributes. Note that if the |
| 105 | overall unit style.u is changed by the calling application, also the |
| 106 | U-based values must be recalculated for proper measures. |
| 107 | |
| 108 | >>> rs = getRootStyle() |
| 109 | >>> rs['name'] |
| 110 | 'root' |
| 111 | >>> rs['pt'] # Padding top: U*7 |
| 112 | 42pt |
| 113 | """ |
| 114 | if u is None: |
| 115 | u = U # Use default unit size from constants. |
| 116 | |
| 117 | # Make sure to convert to units if not already. |
| 118 | u = units(u) |
| 119 | |
| 120 | # Some calculations to show dependencies. |
| 121 | defaultLeading = DEFAULT_LEADING |
| 122 | baselineGrid = pt(BASELINE_GRID) |
| 123 | |
| 124 | # Indent of lists. Needs to be the same as in tabs, to position rightly |
| 125 | # after bullets. The order or multiplication matters, in case u is a Unit |
| 126 | # instance. |
| 127 | listIndent = 0.8 * u |
| 128 | # Make default gutter equal to the page unit. |
| 129 | gutter = u |
| 130 | |
| 131 | pt0 = pt(0) # Standard initialize on Unit zero |
| 132 | em0 = em(0) |
| 133 | |
| 134 | # Answer the default root style. Style is a dictionary. |
| 135 | rs = dict( |
| 136 | # Name of the style, key in document.getRootstyle( ) |
| 137 | name = 'root', |
| 138 | # Optional CSS class of local element. Ignored if None. |
| 139 | cssClass = None, |
| 140 | # Optional marker to match the style with the running tag. |
| 141 | tag = None, |
| 142 | # If set to False, then the element does not evaluate in the |
| 143 | # self.elements loop. |
| 144 | show = True, |
| 145 | |
| 146 | # Basic page/template/element positions. Can contain number values or |
| 147 | # Unit instances. |
| 148 | x = pt0, # Default local origin, relative to parent. |
| 149 | y = pt0, |
| 150 | z = pt0, |
| 151 | |
| 152 | # Basic page/template/element proportions of box. Can contain number |
| 153 | # values or Unit instances. |
| 154 | |
| 155 | # Default page width, basic size of the document. Point rounding of |
| 156 | # 210mm, international generic fit. |