Dream Han CJK Documentation

repository·main·Indexed 22 days ago

https://github.com/pal3love/dream-han-cjk

A font project that instantiates variable Source Han Sans and Source Han Serif fonts into 27 discrete, compatible weights. It features custom interpolation algorithms for natural weight transitions, fixes Adobe line-height issues, and supports Simplified Chinese, Traditional Chinese, Japanese, and Korean. Available in TTC and TTF formats under the SIL Open Font License.

Tokens
1K
Snippets
0
Records
5
Agent score
29%

What's inside Dream Han CJK

  1. How Dream Han CJK weight interpolation works

    main

    The project uses the variable weight axis (wght) of Source Han Sans and Source Han Serif as a base, but applies custom interpolation to bypass the avar table (which causes non-linear weight increases in Adobe's variable fonts) and to account for the different visual thickening speeds of Sans vs. Serif fonts.

    • Dream Han Serif (Songti): Uses linear interpolation. Weights start at 250 and increase by a constant 25 until 900, resulting in 27 weights (250, 275, 300, ..., 900).
    • Dream Han Sans (Heiti): Uses quadratic interpolation. Weights start at 250 and increase by 19.4 + f^2, where f starts at 1 and increases by 0.1 per step, until 900, resulting in 27 weights.

    Note: Because the avar table is bypassed, the wght values in Dream Han CJK are not identical to the values in the original Source variable fonts. Users should compare them visually to find the closest match.

  2. Compile the fonts from source

    main

    To compile the fonts locally, follow these requirements and steps.

    Requirements

    Disk Space: Running the script generates significant temporary files. You will need approximately 30 GB of total disk space. Temporary files are automatically deleted upon completion.

    Platform Dependencies: Supports WSL (Windows Subsystem for Linux), Linux x86-64 (with Wine), and macOS. Ensure the following are installed:

    • Python 3.8 or higher
    • pip
    • pip install afdko (Adobe Font Development Kit for OpenType)
    • pip install skia-pathops
    • pip install fonttools
    • pip install toml
    • zip (via package manager, e.g., sudo apt install zip for WSL/Linux; macOS has it built-in)

    Execution

    Navigate to the script directory and run the build script using the following syntax:

    • WSL: ./build_fonts.sh wsl <max_parallel_count>
    • Linux: ./build_fonts.sh linux <max_parallel_count>
    • macOS: ./build_fonts.sh mac <max_parallel_count>

    Parameter: <max_parallel_count> Determines the maximum number of fonts processed in parallel. Each font consumes approximately 1.5 CPU threads and up to 1.5 GB of RAM. Adjust this based on your hardware (e.g., for an AMD Ryzen 9 3950X, a value of 28 is suggested).

    Upon completion, the final font ZIP package will be located in a newly created release directory in the root folder.

  3. Download and install Dream Han CJK fonts

    main

    To use the fonts, download the latest compressed package from the Releases page. After extracting, you will find TTF/TTC font files.

    Note for Windows users: Since Windows 10 1809, fonts may be installed to a user folder by default, which can cause some software to fail to find them. It is recommended to right-click the font file and select "Install for all users" to perform a global installation.

  4. Technical specifications of Dream Han CJK

    main

    Dream Han CJK is an instantiation of the variable Source Han Sans/Serif fonts into traditional single-weight fonts to improve compatibility and fix rendering issues.

    Key specifications:

    • Styles: 27 weights (W1 - W27).
    • Character Set: Full version contains 65,535 characters.
    • Variant Support: Simplified Chinese, Traditional Chinese (Taiwan), Traditional Chinese (Hong Kong), Japanese, and Korean.
    • OpenType Features: Full support (including vertical layout).
    • Line Height: Standard line height (fixes the excessive Adobe line height issue found in the original Source series).
    • Microsoft Office Support:
      • Supports Style-Link (Bold button links to W12/W22 for Sans and W7/W20 for Serif).
      • Supports font embedding in Word, Excel, and PowerPoint.
    • Formats: Full version is TrueType Collection (TTC); subset versions are TrueType (TTF).
    • Curve Format: Quadratic Bezier curves.
    • Curve Precision (UPM): 2048 (lossless conversion from original OpenType/CFF cubic curves).
    • Rendering: Full-font subpixel anti-aliasing (Windows 10 and newer).