Text
TEXT HELPERS
NO_DIALOG = DialogModes.DisplayNoDialogs
module-attribute
TEXT UTILITIES
apply_text_key(text_layer, text_key)
Applies a TextKey action descriptor to a given TextLayer. @param text_layer: ArtLayer which must be a TextLayer kind. @param text_key: TextKey extracted from a TextLayer that has been modified.
Source code in src/helpers/text.py
47 48 49 50 51 52 53 54 55 56 57 |
|
get_font_size(layer)
Get scale factor adjusted font size of a given text layer. @param layer: Text layer to get size of.
Source code in src/helpers/text.py
28 29 30 31 32 33 |
|
get_line_count(layer=None)
Get the number of lines in a paragraph text layer. @param layer: Text layer that contains a paragraph TextItem. @return: Number of lines in the TextItem.
Source code in src/helpers/text.py
60 61 62 63 64 65 66 |
|
get_text_key(layer)
Get the textKey action reference from a TextLayer. @param layer: ArtLayer which must be a TextLayer kind.
Source code in src/helpers/text.py
36 37 38 39 40 41 42 43 44 |
|
get_text_scale_factor(layer=None, axis='yy', text_key=None)
Get the scale factor of the document for changing text size. @param layer: The layer to make active and run the check on. @param axis: Scale axis or list of scale axis to check (xx: horizontal, yy: vertical) @param text_key: textKey action descriptor @return: Float scale factor
Source code in src/helpers/text.py
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 |
|
remove_leading_text(layer, idx)
Remove text up to a certain index from a TextLayer. @param layer: TextLayer containing the text to modify. @param idx: Index to remove up to.
Source code in src/helpers/text.py
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 |
|
remove_trailing_text(layer, idx)
Remove text up to a certain index from a TextLayer. @param layer: TextLayer containing the text to modify. @param idx: Index to remove up to.
Source code in src/helpers/text.py
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 |
|
replace_text(layer, find, replace)
Replaces target "find" text with "replace" text in a given TextLayer. @param layer: ArtLayer which must be a TextLayer kind. @param find: Text to find in the layer. @param replace: Text to replace the found text with.
Source code in src/helpers/text.py
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 |
|
replace_text_robust(layer, find, replace, targeted_replace=True)
Replace all instances of replace_this
in the specified layer with replace_with
, using Photoshop's built-in search and replace feature. Slower than replace_text
, but can handle multi-style strings. @param layer: Layer object to search through. @param find: Text string to search for. @param replace: Text string to replace matches with. @param targeted_replace: Disables layer targeting if False, if True may cause a crash on older PS versions.
Source code in src/helpers/text.py
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 |
|
set_composer_single_line(layer)
Set text layer to single line composer. @param layer: Layer containing TextItem to set composer for.
Source code in src/helpers/text.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
|
set_font(layer, font_name)
Set the font of a given TextItem layer using a given name. @param layer: ArtLayer containing TextItem. @param font_name: Name of the font to set.
Source code in src/helpers/text.py
354 355 356 357 358 359 360 |
|
set_text_leading(layer, size)
Manually assign font leading to a layer using action descriptors. @param layer: Layer containing TextItem to change leading of. @param size: New textItem font leading.
Source code in src/helpers/text.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
set_text_size(layer, size)
Manually assign font size to a layer using action descriptors. @param layer: Layer containing TextItem to change size of. @param size: New textItem font size.
Source code in src/helpers/text.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
|