Internal helper to convert a string alignment (e.g., "left", "center") to the corresponding PP_ALIGN constant. Default to PP_ALIGN.LEFT if unrecognized or None.
(alignment)
| 1244 | return font_size # Assume user provided a Pt object already |
| 1245 | |
| 1246 | def _parse_alignment(alignment): |
| 1247 | """ |
| 1248 | Internal helper to convert a string alignment (e.g., "left", "center") |
| 1249 | to the corresponding PP_ALIGN constant. |
| 1250 | Default to PP_ALIGN.LEFT if unrecognized or None. |
| 1251 | """ |
| 1252 | if not isinstance(alignment, str): |
| 1253 | # If user passed None or something else, default to PP_ALIGN.LEFT |
| 1254 | return PP_ALIGN.LEFT |
| 1255 | |
| 1256 | alignment = alignment.lower().strip() |
| 1257 | alignment_map = { |
| 1258 | "left": PP_ALIGN.LEFT, |
| 1259 | "center": PP_ALIGN.CENTER, |
| 1260 | "right": PP_ALIGN.RIGHT, |
| 1261 | "justify": PP_ALIGN.JUSTIFY, |
| 1262 | } |
| 1263 | return alignment_map.get(alignment, PP_ALIGN.LEFT) |
| 1264 | |
| 1265 | def create_poster(width_inch=48, height_inch=36): |
| 1266 | """ |
no outgoing calls
no test coverage detected