Metadata-Version: 2.3
Name: NotYAFC
Version: 1.0.1
Summary: Not Yet Another Font Converter: a free and open-source font converter for desktop and command-line use, written in Python.
Author: Cesare Gilento
Author-email: Cesare Gilento <ftCLI@proton.me>
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: X11 Applications :: Qt
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Text Processing :: Fonts
Requires-Dist: cffsubr>=0.4.0
Requires-Dist: fonttools[pathops,woff]>=4.68.0
Requires-Dist: pathvalidate>=3.3.1
Requires-Dist: pyside6>=6.8
Requires-Dist: typer==0.28.0
Requires-Dist: ttfautohint-py>=0.6.1
Requires-Python: >=3.11
Project-URL: homepage, https://github.com/ftCLI/NotYAFC
Description-Content-Type: text/markdown

# NotYAFC — Not Yet Another Font Converter
> A free, open-source desktop app and CLI for batch font conversion. Local, controllable, and built on trusted tools.

<p align="center">
  <img src="https://raw.githubusercontent.com/ftCLI/NotYAFC/main/src/font_converter/assets/notyafc-1024.png" alt="NotYAFC logo" width="256" height="256">
</p>

<p align="center">
  <a href="https://github.com/ftCLI/NotYAFC/actions/workflows/ci.yml"><img src="https://img.shields.io/github/check-runs/ftCLI/NotYAFC/main?nameFilter=Tests%20%28ubuntu-latest%29&label=Tests%20%28Linux%29" alt="Tests (Linux)"></a>
  <a href="https://github.com/ftCLI/NotYAFC/actions/workflows/ci.yml"><img src="https://img.shields.io/github/check-runs/ftCLI/NotYAFC/main?nameFilter=Tests%20%28windows-latest%29&label=Tests%20%28Windows%29" alt="Tests (Windows)"></a>
  <a href="https://github.com/ftCLI/NotYAFC/actions/workflows/ci.yml"><img src="https://img.shields.io/github/check-runs/ftCLI/NotYAFC/main?nameFilter=Tests%20%28macos-latest%29&label=Tests%20%28macOS%29" alt="Tests (macOS)"></a>
  <a href="https://github.com/ftCLI/NotYAFC/actions/workflows/ci.yml"><img src="https://img.shields.io/github/check-runs/ftCLI/NotYAFC/main?nameFilter=Lint%20and%20type%20check&label=Lint" alt="Lint"></a>
  <a href="https://pypi.org/project/notyafc/"><img src="https://img.shields.io/pypi/v/notyafc?label=PyPI" alt="PyPI version"></a>
</p>

## Overview

NotYAFC converts fonts between formats — TrueType, PostScript, WOFF, WOFF2 — and can extract fonts from collections or export variable-font instances as static files. It runs entirely on your machine, supports batch processing, and gives you fine-grained control over every conversion parameter.

It provides two interfaces:

- **GUI** — A PySide6 desktop application with drag-and-drop, progress tracking, and per-profile options.
- **CLI** — A Typer-based command-line tool for scripting and repeatable workflows.

Both interfaces share the same conversion engine, so you get identical results regardless of how you use NotYAFC.

## Why NotYAFC?

- **Local** — Your fonts never leave your machine. No uploads, no online services.
- **Batch-ready** — Add files or entire folders, scan recursively, and convert hundreds of fonts at once.
- **Transparent** — Built on [FontTools](https://github.com/fonttools/fonttools), `ttfautohint`, and `cffsubr`. No black-box conversion — just a practical interface around established font tools.
- **Fine-grained control** — Tune curve-conversion tolerance, target UPM, contour optimization, autohinting, subroutinization, and more.
- **Output, organized your way** — Build a custom folder structure from font properties and conversion settings, so even large batches land where you want them.
- **Batch-aware** — Pause, resume, or cancel mid-run. Incompatible fonts are explained, not silently skipped.
- **Dual interface** — Use the GUI for interactive work or the CLI for automation.

## Installation

### With uv (recommended)

```console
uv tool install notyafc
notyafc
```

Try it without installing: `uvx notyafc`. Upgrade later with `uv tool upgrade notyafc`.

The CLI is available as `notyafc-cli`. Run `notyafc-cli --help` for available commands.

### From PyPI with pip

Install the latest release from [PyPI](https://pypi.org/project/notyafc/):

**Windows (PowerShell):**
```powershell
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install notyafc
notyafc
```

**macOS and Linux:**
```console
python3 -m venv .venv
source .venv/bin/activate
python -m pip install notyafc
notyafc
```

To upgrade an existing installation, run `python -m pip install --upgrade notyafc`.
The command-line interface is available as `notyafc-cli`; run `notyafc-cli --help` for usage.

### From source

```console
git clone https://github.com/ftCLI/NotYAFC.git
cd NotYAFC
uv sync
uv run notyafc
```

## Conversion Profiles

| Profile | Description |
|---------|-------------|
| `ttf2otf` | TrueType → PostScript (TTF → OTF) |
| `otf2ttf` | PostScript → TrueType (OTF → TTF) |
| `ft2wf` | TTF / OTF (SFNT) → WOFF / WOFF2 webfonts |
| `woff2ft` | WOFF → TTF / OTF |
| `woff22ft` | WOFF2 → TTF / OTF |
| `ttc2sfnt` | Collection (TTC/OTC) → TTF / OTF |
| `var2static` | Variable font → static instances |

### Profile Options

#### TrueType → PostScript (`ttf2otf`)

- **Tolerance** (0.1–3, default 1) — Controls curve-conversion accuracy in thousandths of an em; the actual deviation scales with UPM. Lower values allow less deviation, but may increase point count and file size.
- **Target UPM** — Scale the font to a chosen units-per-em value.
- **Simplify contours** (0–3, default 0/off) — Experimental: merge neighboring smooth curves to reduce point count. Deviation is a multiple of Tolerance.
- **Subroutinize** (on by default) — Compress PostScript outlines using shared subroutines.

#### PostScript → TrueType (`otf2ttf`)

- **Tolerance** (0–3, default 1) — Controls curve-conversion accuracy in thousandths of an em; the actual deviation scales with UPM. Lower values allow less deviation, but may increase point count and file size.
- **Target UPM** — Scale the font to a chosen units-per-em value.
- **Autohint** (on by default) — Add TrueType hinting instructions via `ttfautohint`.

#### TTF / OTF → WOFF / WOFF2 (`ft2wf`)

- **Format** — Choose WOFF, WOFF2, or both (both selected by default).
- **Obfuscate names** — Replace family, full, and PostScript names with hashes (including in the output filename).
- **Remove unused glyphs** — Drop glyphs not reachable from the character map or OpenType features.
- **Remove non-Windows names** — Strip `name` records for platforms other than Windows (platform ID 3).
- **Remove DSIG table** (WOFF only) — Remove the digital signature table.
- **Create CSS** — Write a `fonts.css` file with `@font-face` rules and classes for detected OpenType features (e.g., `.ft-liga`).

#### WOFF → TTF / OTF (`woff2ft`) / WOFF2 → TTF / OTF (`woff22ft`)

Converts back to the original outline type (TTF or OTF). No extra options needed.

#### Collection (TTC/OTC) → TTF / OTF (`ttc2sfnt`)

Unpacks a TTC/OTC collection into individual font files. No extra options needed.

#### Variable → Static (`var2static`)

Export named or custom variable-font instances as separate static fonts.

- **Named instances** — Pick from the font's predefined instances.
- **Custom instances** — Define your own axis values for any variable font.
- **Target UPM** — Scale the exported fonts.
- **Autohint** (TrueType) / **Subroutinize** (PostScript) — On by default when applicable.

## Usage

### GUI Workflow

![NotYAFC main window](https://raw.githubusercontent.com/ftCLI/NotYAFC/main/docs/images/notyafc-main-window.png)

1. **Add fonts** — Use *Add files…*, *Add folder…*, or drag and drop. The scanner inspects file contents, not extensions, so it finds fonts regardless of naming.
2. **Choose a profile** — The list shows how many scanned fonts are compatible with each conversion. Select a profile before converting; you can also choose one before adding fonts.
3. **Select fonts** — The input table shows each font's name, format, outline type, and UPM. Right-click its header to show the optional Family and Style columns; the choice is remembered, and filtering searches those fields even when hidden. Incompatibility reasons appear beside names when space permits, in tooltips, and below the table for a selected incompatible font. Use *Select compatible fonts* or *Hide incompatible* to filter.
4. **Set output and options** — Converted files are saved next to their sources by default. Choose a separate folder, optionally organize the output, and adjust profile-specific options. Open *Save options…* in the output card for settings shared by all conversions.
5. **Convert** — Check the profile, selection count, and destination, then use the fixed *Convert* button or Ctrl+Enter. Before converting, NotYAFC asks you to confirm that you have the legal right to modify the selected fonts. Choose **Remember this choice** to skip the confirmation on future runs; otherwise, you will be asked again next time. Monitor progress, pause, resume, or cancel mid-run. Afterward, use *View last run* to review or export logs, or *Open output folder* to open the last conversion's output.

For variable fonts, *Variable → Static* changes the input list to a tree of fonts and instances.
Select a font or instance and use *Add custom instance…*. Right-click a custom
instance (or press Shift+F10) to edit or remove it; Delete also removes the selected custom instance.
Use *View* to expand or collapse all variable fonts.

On wider windows the font list stays beside the conversion and output controls, which scroll
independently when needed. On narrower windows these sections stack vertically.
The initial theme follows the system color scheme when available; the theme toggle saves your
preference for future launches. Focus the theme toggle and press Space or Enter to switch themes.

Existing output files are preserved by default: a conflicting name gets a numbered suffix such as
`font#1.otf`. Enable **Overwrite existing files** only when replacing existing output is intended.

### Organize your output

Big batch, tidy folders. In the GUI, **Organize output…** lets you build a folder structure from
properties such as family, output format, outline type, UPM, tolerance, and contour simplification.
The available criteria depend on the conversion profile.

![NotYAFC output organization](https://raw.githubusercontent.com/ftCLI/NotYAFC/main/docs/images/notyafc-output-organization.png)

Add a folder level for each directory you want, then choose one or more criteria for it. Criteria
in the same level are joined with `_`; separate levels create nested folders. For example, putting
**Format** and **Outline type** in the first level and **UPM** in the second could produce:

```text
opentype_ps/upm_1000/font.otf
```

Use the arrows to reorder levels or criteria, and watch the example path update as you go. The
preview also appears below the output controls when folder levels are configured. It is
illustrative: actual folder and file names depend on the fonts and conversion settings.
Each criterion can be used once; if they're all in use, remove one before adding it elsewhere.
Without folder levels, files are saved directly in the chosen output location—alongside their
sources by default.

### CLI Usage

![notyafc-cli.png](https://raw.githubusercontent.com/ftCLI/NotYAFC/main/docs/images/notyafc-cli.png)

```console
# Convert all fonts in a directory to WOFF/WOFF2
notyafc-cli ft2wf ./fonts --recursive --output-dir ./converted

# Convert TTF to OTF with custom tolerance
notyafc-cli ttf2otf ./fonts --tolerance 0.5 --no-subroutinize
```

Run `notyafc-cli --help` or `notyafc-cli <profile> --help` for full options.
Existing output files are preserved by default; use `--overwrite` to replace them explicitly.

## Advanced Settings

Options shared by all profiles:

- **Recalculate bounding boxes** — Rebuild glyph bounds before saving (on by default).
- **Recalculate modified timestamp** — Set a fresh modification timestamp (off by default).
- **Reorder tables on save** — Use a standard table order for compatibility (on by default).

## Requirements

- Python 3.11+
- A desktop environment supported by Qt 6 (for the GUI)

## Development

Clone the repository and install dependencies:

```console
git clone https://github.com/ftCLI/NotYAFC.git
cd NotYAFC
uv sync --group dev
```

Run the test suite:

```console
uv run pytest
```

The project uses `ruff` for linting/formatting and `mypy` for type checking. A coverage threshold of 90% is enforced.

For future packaging, use `src/font_converter/assets/notyafc.ico` as the Windows executable icon. On macOS, create an `.icns` from the individual icon sizes using system tools, without resampling the 512px image. On Linux, point the `.desktop` file to a 256px or 512px PNG. The ICO contains the optimized sizes up to 256px; the supplied `ico.png` is 512px.

## License

MIT — see [LICENSE](LICENSE) for details.

## Acknowledgments

NotYAFC is built on top of excellent open-source tools:

- [FontTools](https://github.com/fonttools/fonttools) — Font parsing and writing
- [ttfautohint](https://freedesktop.org/wiki/Software/ttfautohint/) — TrueType autohinting
- [cffsubr](https://github.com/adobe-type-tools/cffsubr) — CFF subroutinization
- [Skia pathops](https://github.com/google/skia) — Contour overlap removal and winding correction
- DeepMind Sans by Colophon Foundry (SIL Open Font License 1.1) — The icon's letter “a” outline is derived from this font
