Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
cache/
packs/
117 changes: 117 additions & 0 deletions CONFIG_SCHEMA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Emoji Pack Configuration Schema

This document describes the JSON configuration schema for the emoji pack generator.

## Configuration Structure

```json
{
"name": "Pack Name",
"version": "1.0.0",
"source": {
"type": "github",
"repository": "owner/repository-name",
"branch": "main",
"folder": "path/to/assets/folder"
},
"input_structure": {
"metadata_file": "metadata.json",
"image_folders": [
"{style}",
"{skin_tone}/{style}"
],
"image_extensions": ["png"],
"styles": ["3D", "Color", "Flat"],
"skin_tones": ["Default", "Dark", "Medium-Dark", "Medium-Light", "Light"]
},
"output": {
"type": "minecraft_resource_pack",
"pack_format": 15,
"description_template": "Pack Description with {style} and {skin_tone}",
"output_directory": "./packs/{name}-{style}-{skin_tone}",
"textures_path": "assets/minecraft/textures/font",
"font_path": "assets/minecraft/font/default.json",
"pack_meta_path": "pack.mcmeta",
"pack_icon_source": "1f603"
},
"file_processing": {
"filename_from_metadata": "unicode",
"character_from_metadata": "glyph",
"unicode_processing": {
"skip_if_contains_space": true,
"handle_variation_selector": {
"enabled": true,
"pattern": " fe0f",
"action": "remove_and_convert"
}
}
},
"font_config": {
"provider_type": "bitmap",
"height": 7,
"ascent": 7,
"file_template": "minecraft:font/{filename}.png"
}
}
```

## Field Descriptions

### Root Level
- `name`: Human-readable name of the emoji pack
- `version`: Version of this configuration
- `source`: Configuration for where to download emoji assets from
- `input_structure`: Describes the expected structure of the input data
- `output`: Configuration for the generated output format
- `file_processing`: Rules for processing individual files
- `font_config`: Font-specific configuration for Minecraft resource packs

### Source Configuration
- `type`: Type of source ("github" currently supported)
- `repository`: GitHub repository in "owner/repo" format
- `branch`: Git branch to download from
- `folder`: Folder within the repository to extract

### Input Structure
- `metadata_file`: Name of the metadata file in each emoji folder
- `image_folders`: Array of folder patterns to search for images (supports {style}, {skin_tone} variables)
- `image_extensions`: Supported image file extensions
- `styles`: Available styles for this emoji set
- `skin_tones`: Available skin tones for this emoji set

### Output Configuration
- `type`: Output format type
- `pack_format`: Minecraft pack format version
- `description_template`: Template for pack description (supports variables)
- `output_directory`: Where to generate the pack (supports variables)
- `textures_path`: Path within pack for texture files
- `font_path`: Path for font configuration JSON
- `pack_meta_path`: Path for pack metadata file
- `pack_icon_source`: Unicode value to use as pack icon

### File Processing
- `filename_from_metadata`: Metadata field to use for filename
- `character_from_metadata`: Metadata field to use for character mapping
- `unicode_processing`: Rules for processing unicode values

### Font Configuration
- `provider_type`: Minecraft font provider type
- `height`: Font height in pixels
- `ascent`: Font ascent in pixels
- `file_template`: Template for texture file references

## Variable Substitution

The following variables can be used in templates:
- `{style}`: Current style being processed
- `{skin_tone}`: Current skin tone being processed
- `{filename}`: Processed filename from metadata
- `{name}`: Pack name from root configuration

## Wildcard Support

The system supports wildcards in the `image_folders` configuration:
- `{style}`: Matches any style from the styles array
- `{skin_tone}`: Matches any skin tone from the skin_tones array

This allows flexible folder structure matching without hardcoding paths.
193 changes: 193 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# Emoji Pack Generator

A flexible, configuration-driven system for generating emoji resource packs from various sources.

## Features

- **JSON Configuration**: Define emoji pack sources, structure, and output formats via JSON
- **Multiple Source Support**: Currently supports GitHub repositories
- **Flexible Input Structure**: Support for wildcard patterns in folder structures
- **Multiple Output Formats**: Currently supports Minecraft resource packs
- **Skin Tone & Style Support**: Generate packs for different styles and skin tones
- **Backward Compatibility**: Legacy FluentUI script still works

## Quick Start

### Using the New Configuration System

1. **Generate a pack using an existing configuration:**
```bash
python emoji_pack_generator.py --config configs/fluentui-3d-only.json --download
```

2. **Generate for specific style/skin tone:**
```bash
python emoji_pack_generator.py --config configs/fluentui-3d-only.json --style 3D --skin-tone Dark --download
```

3. **Use existing downloaded files:**
```bash
python emoji_pack_generator.py --config configs/fluentui-3d-only.json --extract-to ./cache/assets/
```

### Using the Legacy System

The original fluentui-emoji.py still works for backward compatibility:

```bash
# Legacy mode (deprecated)
python fluentui-emoji.py --download --style 3D --skin-tone Default

# Legacy mode with new configuration
python fluentui-emoji.py --config configs/fluentui-3d-only.json --style 3D --skin-tone Default
```

## Configuration

### Example Configuration Files

- `configs/fluentui-3d-only.json` - FluentUI emojis, 3D style only
- `configs/fluentui-emoji.json` - FluentUI emojis, all styles (includes SVG)
- `configs/twemoji-example.json` - Example Twemoji configuration

### Configuration Schema

See [CONFIG_SCHEMA.md](CONFIG_SCHEMA.md) for detailed documentation of the JSON schema.

### Basic Configuration Structure

```json
{
"name": "Pack Name",
"source": {
"type": "github",
"repository": "owner/repo-name",
"branch": "main",
"folder": "assets"
},
"input_structure": {
"metadata_file": "metadata.json",
"image_folders": ["{style}", "{skin_tone}/{style}"],
"image_extensions": ["png"],
"styles": ["3D", "Color", "Flat"],
"skin_tones": ["Default", "Dark", "Light"]
},
"output": {
"type": "minecraft_resource_pack",
"pack_format": 15,
"description_template": "{name} {style}-{skin_tone} Pack",
"output_directory": "./packs/{name}-{style}-{skin_tone}"
},
"file_processing": {
"filename_from_metadata": "unicode",
"character_from_metadata": "glyph"
},
"font_config": {
"provider_type": "bitmap",
"height": 7,
"ascent": 7
}
}
```

## Command Line Options

### emoji_pack_generator.py

```
--config CONFIG Path to JSON configuration file (required)
--extract-to DIR Extraction directory (default: ./cache/assets/)
--style STYLE Emoji style (overrides config)
--skin-tone TONE Skin tone (overrides config)
--download Force download of assets
--commit HASH Specific commit hash to download
```

### fluentui-emoji.py (Legacy)

```
--repo-url URL GitHub repository URL
--folder-name NAME Folder name in repository
--extract-to DIR Extraction directory
--skin-tone TONE Skin tone
--style STYLE Emoji style
--download Force download of assets
--config CONFIG Use JSON configuration (recommended)
```

## Creating Custom Configurations

1. **Create a new JSON configuration file** based on the schema
2. **Define your source repository** and folder structure
3. **Configure input patterns** with wildcard support
4. **Set up output format** and naming conventions
5. **Test with a small subset** before full generation

### Wildcard Support

The system supports these wildcards in folder patterns:
- `{style}` - Matches any style from the configuration
- `{skin_tone}` - Matches any skin tone from the configuration

Example: `["{style}", "{skin_tone}/{style}"]` will match both:
- `3D/` and `Default/3D/`
- `Color/` and `Dark/Color/`

## File Structure

```
emoji_pack/
├── emoji_pack_generator.py # New configuration-based generator
├── fluentui-emoji.py # Legacy script with backward compatibility
├── configs/ # Configuration files
│ ├── fluentui-3d-only.json # FluentUI 3D only (recommended)
│ ├── fluentui-emoji.json # FluentUI all styles
│ └── twemoji-example.json # Example Twemoji config
├── CONFIG_SCHEMA.md # Configuration schema documentation
├── cache/ # Downloaded assets cache
└── packs/ # Generated resource packs
```

## Supported Input Formats

- **PNG images** - Ready for Minecraft resource packs
- **SVG images** - Requires conversion to PNG (not implemented yet)
- **Metadata JSON** - For emoji information and mapping

## Supported Output Formats

- **Minecraft Resource Pack** - Complete pack with textures and font JSON

## Known Limitations

1. **SVG Support**: SVG files are detected but not converted to PNG automatically
2. **Single Source Type**: Only GitHub repositories supported currently
3. **Minecraft Format Only**: Only Minecraft resource pack output implemented

## Contributing

To add support for new source types or output formats:

1. Extend the `EmojiPackProcessor` class
2. Add new configuration options to the schema
3. Update validation in `EmojiPackConfig`
4. Test with example configurations

## Examples

### Generate FluentUI 3D Pack
```bash
python emoji_pack_generator.py --config configs/fluentui-3d-only.json --download
```

### Generate for Specific Skin Tone
```bash
python emoji_pack_generator.py --config configs/fluentui-3d-only.json --skin-tone Dark
```

### Use Specific Commit
```bash
python emoji_pack_generator.py --config configs/fluentui-3d-only.json --commit abc123 --download
```

The generated packs will be in the `packs/` directory and can be installed as Minecraft resource packs.
49 changes: 49 additions & 0 deletions configs/fluentui-3d-only.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "FluentUI 3D Emoji Pack",
"version": "1.0.0",
"description": "FluentUI Emoji Pack configured for 3D style only (PNG files)",
"source": {
"type": "github",
"repository": "microsoft/fluentui-emoji",
"branch": "main",
"folder": "assets"
},
"input_structure": {
"metadata_file": "metadata.json",
"image_folders": [
"{style}",
"{skin_tone}/{style}"
],
"image_extensions": ["png"],
"styles": ["3D"],
"skin_tones": ["Default", "Dark", "Medium-Dark", "Medium-Light", "Light"]
},
"output": {
"type": "minecraft_resource_pack",
"pack_format": 15,
"description_template": "FluentUi {style}-{skin_tone} Emoji Resource Pack",
"output_directory": "./packs/FluentUi-{style}-{skin_tone}-Emoji",
"textures_path": "assets/minecraft/textures/font",
"font_path": "assets/minecraft/font/default.json",
"pack_meta_path": "pack.mcmeta",
"pack_icon_source": "1f603"
},
"file_processing": {
"filename_from_metadata": "unicode",
"character_from_metadata": "glyph",
"unicode_processing": {
"skip_if_contains_space": true,
"handle_variation_selector": {
"enabled": true,
"pattern": " fe0f",
"action": "remove_and_convert"
}
}
},
"font_config": {
"provider_type": "bitmap",
"height": 7,
"ascent": 7,
"file_template": "minecraft:font/{filename}.png"
}
}
Loading
Loading