Skip to content

MaruTama/Mengshen-pinyin-font

Repository files navigation

Mengshen(萌神)-pinyin(拼音)-font

OSS の多音字に対応した拼音フォント及びその作成ツールです。 / OpenSource Pinyin font and creation tool that supports homograph (多音字).

Download/下载

version updated

explain_han_serif explain_handwritten characteristic_point

私達は中国語の学習や普及を目的としているグループです。/ We are a group dedicated to learning and promoting the Chinese language.


目的 / Purpose

基本的な日本語、簡体字、繁体字を表示できるフォントであり、 簡体字と繁体字には拼音を併記するフォントの作成です。/ This fonts can display basic Japanese, Simplified Chinese and Traditional Chinese, and We created a font that includes Chinese romanization for both Simplified and Traditional chinese characters.


想定利用者 / Target User

日本語、中国語の学習者 / Japanese and Chinese language learners


フォントのインストール方法 / Font Installation Instructions


使用例 / Use Case

e.g. 微博, Netflix, Lyrics, News and MS Word etc.

Improve your skills on your own, effectively and enjoyably, by watching films and series in the language you study. Subtitles are shown Chinese characters and pinyin. Language Learning with Netflix An-example-of-how-to-use


技術的要素 / Technical Elements

多音字をサポートするためにコンテキスト置換(feature tag of "rclt" at GSUB)を実装しました。 また、Unicode IVS(表意文字バリアントセレクター)を使用して、異なる拼音に切り替えることもできます。/ Implemented contextual replacing to support homograph (多音字). You can also use Unicode IVS (ideographic variant selector) to switch other different pinyin.
using_contextual_replacing using_ideographic_variant_selector

各OSでの動作 / Works on each OS

Platform Automatic pinyin switching (using Contextual Replacement) Manual pinyin switching (using IVS) Notes
Windows
using-contextual-replacing-on-win.mp4
using-ideographic-variant-selector-on-win.mp4
Use IME Pad for IVS
Mac
using-contextual-replacing-on-mac.mov
using-ideographic-variant-selector-on-mac.mov
Use Character Viewer for IVS
Android android-chrome-rclt - zFont Setup Guide
Magisk module (root required, IVS works in Chrome only)

対応している多音字の一覧 / List of Supported Homographs

生成方法 / How to Make Fonts

リファクタコード構成 / Refactored Code Architecture

プロジェクトは現在、レガシー版とリファクタ版の両方をサポートしています。リファクタ版は、モジュラー設計、型安全性、セキュリティ強化を特徴としています。

The project currently supports both legacy and refactored versions. The refactored version features modular design, type safety, and enhanced security.

ディレクトリ構成 / Directory Structure

src/refactored/
├── __init__.py            # Package initialization and version
├── font_types.py          # Font type definitions and enums
├── cli/                   # Command Line Interface
│   ├── __init__.py
│   └── main.py           # CLI entry point with dependency injection
├── config/                # Configuration Management
│   ├── __init__.py
│   ├── font_config.py    # Font types, canvas settings, constants
│   ├── font_name_tables.py # Font naming and metadata
│   └── paths.py          # Project path management
├── data/                  # Data Processing Layer
│   ├── __init__.py
│   ├── character_data.py # Character and pronunciation management
│   ├── mapping_data.py   # Unicode to glyph mapping
│   └── pinyin_data.py    # Pinyin data handling
├── generation/            # Font Generation Core
│   ├── __init__.py
│   ├── font_assembler.py # Font assembly and metadata
│   ├── font_builder.py   # Main font construction orchestrator
│   └── glyph_manager.py  # Glyph generation and management
├── scripts/               # Build Scripts
│   ├── __init__.py
│   ├── make_template_jsons.py     # Font to JSON conversion
│   └── retrieve_latin_alphabet.py # Latin alphabet extraction
├── tables/                # OpenType Table Generation
│   ├── __init__.py
│   ├── cmap_manager.py   # Character mapping table management
│   └── gsub_table_generator.py # OpenType GSUB table generation
└── utils/                 # Utilities and Support
    ├── __init__.py
    ├── logging_config.py # Structured logging configuration
    ├── pinyin_utils.py   # Pinyin processing utilities
    ├── shell_utils.py    # Secure shell command execution
    └── version_utils.py  # Version management utilities

リファクタ版コマンド / Refactored Commands

# フォント生成 / Font generation
PYTHONPATH=src python -m refactored.cli.main -t han_serif
PYTHONPATH=src python -m refactored.cli.main -t handwritten

# Dockerでの生成(推奨) / Docker generation (recommended)
docker-compose -f docker/docker-compose.yml up pipeline-han-serif
docker-compose -f docker/docker-compose.yml up pipeline-handwritten

謝辞 / Acknowledgments

Thank you to the following people and repositories.


カンパ/打赏/Donate

点击进入打赏页面