| 97 | |
| 98 | |
| 99 | def parse_args(args: list[str] | None = None): |
| 100 | parser = argparse.ArgumentParser( |
| 101 | description="✨ Builder and optimizer for Maple Mono", |
| 102 | ) |
| 103 | parser.add_argument( |
| 104 | "-v", |
| 105 | "--version", |
| 106 | action="version", |
| 107 | version=f"Maple Mono Builder v{FONT_VERSION}", |
| 108 | ) |
| 109 | parser.add_argument( |
| 110 | "-d", |
| 111 | "--dry", |
| 112 | dest="dry", |
| 113 | action="store_true", |
| 114 | help="Output config and exit", |
| 115 | ) |
| 116 | parser.add_argument( |
| 117 | "--debug", |
| 118 | action="store_true", |
| 119 | help="Add `Debug` suffix to family name and faster build", |
| 120 | ) |
| 121 | |
| 122 | feature_group = parser.add_argument_group("Feature Options") |
| 123 | feature_group.add_argument( |
| 124 | "-n", |
| 125 | "--normal", |
| 126 | dest="normal", |
| 127 | action="store_true", |
| 128 | help="Use normal preset, just like `JetBrains Mono` with slashed zero", |
| 129 | ) |
| 130 | feature_group.add_argument( |
| 131 | "--feat", |
| 132 | type=lambda x: x.strip().split(","), |
| 133 | help="Freeze font features, splited by `,` (e.g. `--feat zero,cv01,ss07,ss08`). No effect on variable format", |
| 134 | ) |
| 135 | feature_group.add_argument( |
| 136 | "--apply-fea-file", |
| 137 | default=None, |
| 138 | action="store_true", |
| 139 | help="Load feature file from `source/features/{regular,italic}.fea` to variable font", |
| 140 | ) |
| 141 | hint_group = feature_group.add_mutually_exclusive_group() |
| 142 | hint_group.add_argument( |
| 143 | "--hinted", |
| 144 | dest="hinted", |
| 145 | default=None, |
| 146 | action="store_true", |
| 147 | help="Use hinted font as base font in NF / CN / NF-CN (default)", |
| 148 | ) |
| 149 | hint_group.add_argument( |
| 150 | "--no-hinted", |
| 151 | dest="hinted", |
| 152 | default=None, |
| 153 | action="store_false", |
| 154 | help="Use unhinted font as base font in NF / CN / NF-CN", |
| 155 | ) |
| 156 | liga_group = feature_group.add_mutually_exclusive_group() |