Metadata-Version: 2.4
Name: twat-font
Version: 2.7.10
Summary: Modern font organization tool for managing and curating font collections
Project-URL: Documentation, https://github.com/twardoch/twat_font#readme
Project-URL: Issues, https://github.com/twardoch/twat_font/issues
Project-URL: Source, https://github.com/twardoch/twat_font
Author-email: Adam Twardoch <adam+github@twardoch.com>
License-Expression: MIT
License-File: LICENSE
Keywords: fonts,fonttools,organization,subsetting,typography
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.12
Requires-Dist: click>=8.0.0
Requires-Dist: fire>=0.7.0
Requires-Dist: fonttools>=4.55.5
Requires-Dist: loguru>=0.7.3
Requires-Dist: pathlib>=1.0.1
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: rich>=13.10.6
Requires-Dist: typing-extensions>=4.12.2
Provides-Extra: all
Requires-Dist: binary; extra == 'all'
Requires-Dist: build; extra == 'all'
Requires-Dist: dev; extra == 'all'
Requires-Dist: docs; extra == 'all'
Requires-Dist: test; extra == 'all'
Requires-Dist: twat-fs[all]>=2.7.7; extra == 'all'
Provides-Extra: binary
Requires-Dist: cx-freeze>=6.15.0; extra == 'binary'
Requires-Dist: pyinstaller>=6.0.0; extra == 'binary'
Provides-Extra: build
Requires-Dist: build>=0.10.0; extra == 'build'
Requires-Dist: hatch-vcs>=0.4.0; extra == 'build'
Requires-Dist: hatchling>=1.27.0; extra == 'build'
Requires-Dist: twine>=4.0.0; extra == 'build'
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5.56; extra == 'docs'
Requires-Dist: mkdocs>=1.6.1; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.28.0; extra == 'docs'
Requires-Dist: pymdown-extensions>=10.14; extra == 'docs'
Provides-Extra: fs
Requires-Dist: twat-fs[all]>=2.7.7; extra == 'fs'
Provides-Extra: test
Requires-Dist: pytest-benchmark[histogram]>=4.0.0; extra == 'test'
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
Requires-Dist: pytest-xdist>=3.5.0; extra == 'test'
Requires-Dist: pytest>=7.0.0; extra == 'test'
Description-Content-Type: text/markdown

# Font Organizer: Modern Font Management Tool

[![Build & Test](https://github.com/twardoch/font-organizer/actions/workflows/push.yml/badge.svg)](https://github.com/twardoch/font-organizer/actions/workflows/push.yml)
[![Release](https://github.com/twardoch/font-organizer/actions/workflows/release.yml/badge.svg)](https://github.com/twardoch/font-organizer/actions/workflows/release.yml)
[![PyPI version](https://badge.fury.io/py/font-organizer.svg)](https://badge.fury.io/py/font-organizer)

**Font Organizer is a powerful Python-based tool for managing and organizing font collections. It provides intelligent font detection, automated organization, subsetting capabilities, and comprehensive analysis features to help you manage large font libraries efficiently.**

## 🚀 Features

- 🔍 **Smart Font Detection**: Automatically discover fonts across your system
- 📁 **Intelligent Organization**: Sort and categorize fonts by various criteria (family, style, weight)
- 🔤 **Font Subsetting**: Extract specific character sets for optimized web fonts
- 📊 **Analysis Tools**: Examine font metrics, character coverage, and OpenType features
- 🚀 **High Performance**: Efficient processing of large font collections with multi-threading support
- 🔄 **Duplicate Detection**: Find and manage duplicate fonts by hash and metadata
- 📈 **Reporting**: Generate detailed HTML/PDF reports about your font collection

## 📦 Installation

### Using pip (Recommended)

```bash
pip install font-organizer
```

### Using uv (Fast Alternative)

```bash
uv pip install font-organizer
```

### From Source

```bash
git clone https://github.com/twardoch/font-organizer.git
cd font-organizer
pip install -e .
```

## 🎯 Quick Start

### Basic Usage

```bash
# Scan a directory for fonts
font-organizer scan ~/Fonts

# Organize fonts by family
font-organizer organize ~/Fonts --by family --output ~/OrganizedFonts

# Get information about a specific font
font-organizer info ~/Fonts/Arial.ttf

# Find duplicate fonts
font-organizer duplicates ~/Fonts

# Create a subset with basic Latin characters
font-organizer subset input.ttf output.woff2 --text "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
```

### Command Overview

```bash
font-organizer --help
```

Available commands:
- `scan` - Scan directories for font files
- `organize` - Organize fonts using various criteria
- `analyze` - Analyze font collections and generate reports
- `subset` - Create font subsets with specific characters
- `duplicates` - Find and manage duplicate fonts
- `info` - Display detailed font information
- `config` - Manage configuration settings

## 🔧 Configuration

Font Organizer can be configured using a YAML configuration file:

```yaml
# ~/.font-organizer/config.yaml
organize:
  default_scheme: family  # family, style, weight, or custom
  copy_mode: true  # true for copy, false for move
  
scan:
  include_system_fonts: true
  recursive: true
  font_extensions:
    - .ttf
    - .otf
    - .woff
    - .woff2
    
subset:
  default_format: woff2
  optimize: true
```

## 📚 Advanced Usage

### Organizing Fonts

```bash
# Organize by multiple criteria
font-organizer organize ~/Fonts --by family,weight --output ~/Organized

# Use custom organization rules
font-organizer organize ~/Fonts --rules my-rules.yaml --output ~/Organized

# Dry run to preview organization
font-organizer organize ~/Fonts --dry-run
```

### Font Analysis

```bash
# Generate comprehensive analysis report
font-organizer analyze ~/Fonts --output report.html

# Export font list to CSV
font-organizer analyze ~/Fonts --format csv --output fonts.csv

# Check character coverage
font-organizer analyze ~/Fonts --coverage "Latin,Cyrillic"
```

### Subsetting Fonts

```bash
# Create subset with Unicode ranges
font-organizer subset input.ttf output.woff2 --unicodes "U+0020-007F,U+00A0-00FF"

# Subset for specific language
font-organizer subset input.ttf output.woff2 --language en,es,fr

# Keep specific OpenType features
font-organizer subset input.ttf output.woff2 --features "kern,liga"
```

## 🐍 Python API

```python
from font_organizer import FontOrganizer, FontInfo

# Initialize organizer
organizer = FontOrganizer()

# Scan for fonts
fonts = organizer.scan_directory("~/Fonts")

# Get font information
for font_path in fonts:
    info = FontInfo(font_path)
    print(f"{info.family} - {info.style} ({info.weight})")
    print(f"  Characters: {len(info.characters)}")
    print(f"  Features: {', '.join(info.features)}")

# Organize fonts
organizer.organize(
    source="~/Fonts",
    destination="~/OrganizedFonts",
    scheme="family"
)

# Find duplicates
duplicates = organizer.find_duplicates("~/Fonts")
for group in duplicates:
    print(f"Duplicate group ({len(group)} files):")
    for font in group:
        print(f"  - {font}")
```

## 🛠️ Development

### Setting up Development Environment

```bash
# Clone the repository
git clone https://github.com/twardoch/font-organizer.git
cd font-organizer

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

# Run linting
ruff check src tests
mypy src tests
```

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=font_organizer --cov-report=html

# Run specific test file
pytest tests/test_font_info.py
```

## 📖 Documentation

Full documentation is available at [https://twardoch.github.io/font-organizer/](https://twardoch.github.io/font-organizer/)

## 🤝 Contributing

Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- Built with [fonttools](https://github.com/fonttools/fonttools) for font manipulation
- Uses [rich](https://github.com/Textualize/rich) for beautiful terminal output
- Powered by [fire](https://github.com/google/python-fire) for CLI interface

## 📬 Contact

Adam Twardoch - [@adamtwar](https://twitter.com/adamtwar) - adam+github@twardoch.com

Project Link: [https://github.com/twardoch/font-organizer](https://github.com/twardoch/font-organizer)