Menu ▾ ▴

#233 Add standalone custom font support

closed
nobody
None
2026-09-27
2026-09-23
Anonymous
No

Originally created by: RanKaeder

Summary

  • Add custom font AssetBundle path and asset name to the main configuration
  • Prefer the custom font over the translation repository font when configured
  • Preserve the translation repository font as the default fallback
  • Prevent repeated failed loads and handle Unity font hook re-entry
  • Add configuration fields and localized labels

Users must provide a Unity AssetBundle containing a compatible Font asset. Custom fonts may require line-spacing adjustments.

Testing

  • Tested with a Unity 2022.3.62f3 AssetBundle containing a Font asset

Closes [#70]

image

Related

Tickets: #70

Discussion

  • Anonymous

    Anonymous - 2026-09-23

    Originally posted by: kairusds

    The problem with this feaure is that it's still hacky/janky, it never solves the issue of the process being too complex just to load a custom font (the reason why the issue is still left open). You'd either need to install Unity 2022.3 (the entire edtor) just to make a new asset bundle with the font, or do the steps below:

    Find asset bundle with font (from umatl for example, the includes_win and includes_android files) -> use UABEA -> replace Font asset with custom static otf/ttf font -> put the output asset bundle in the hachimi folder and copy the config from umatl:

    "extra_asset_bundle": {"windows": "includes_win", "android": "includes_android"}, "replacement_font_name": "assets/rodinwanpakupro-umatl.otf",

    I also thought of dynamically loading the raw font and compiling it as an asset bundle at init time but that's out of scope for this project when similar tools exist (like UABEA).

     
  • Anonymous

    Anonymous - 2026-09-23

    Originally posted by: RanKaeder

    @kairusds
    Yeah, that’s true. [#86] could actually be implemented using the same method as well, but I don’t think the feature itself has enough general use cases.

    That said, custom fonts can be shared within a specific community, so I think it’s still practical to provide them as dedicated font packs. This way, people wouldn’t need to learn how to use Unity and build the asset bundles themselves.

     

    Related

    Tickets: #86

  • Anonymous

    Anonymous - 2026-09-24

    Originally posted by: kairusds

    @kairusds Yeah, that’s true. [#86] could actually be implemented using the same method as well, but I don’t think the feature itself has enough general use cases.

    That said, custom fonts can be shared within a specific community, so I think it’s still practical to provide them as dedicated font packs. This way, people wouldn’t need to learn how to use Unity and build the asset bundles themselves.

    Okay that's fair

     

    Related

    Tickets: #86

  • Anonymous

    Anonymous - 2026-09-24

    Originally posted by: kairusds

    I'll do some tests for now and maybe make this feature a bit more frictionless so people won't have to manually type the asset path everytime. I'll convert this to a draft PR for now and merge it once it's ready

     
  • Anonymous

    Anonymous - 2026-09-24

    Originally posted by: searinminecraft

    This PR is cool and all, but the screenshot made me throw up lmao

     
  • Anonymous

    Anonymous - 2026-09-24

    Originally posted by: kairusds

    Summary

    • Add custom font AssetBundle path and asset name to the main configuration
    • Prefer the custom font over the translation repository font when configured
    • Preserve the translation repository font as the default fallback
    • Prevent repeated failed loads and handle Unity font hook re-entry
    • Add configuration fields and localized labels

    Users must provide a Unity AssetBundle containing a compatible Font asset. Custom fonts may require line-spacing adjustments.

    Testing

    • Tested with a Unity 2022.3.62f3 AssetBundle containing a Font asset

    Closes [#70]

    image

    Right, I forgot to mention but please refrain from posting images like what you just sent next time

     

    Related

    Tickets: #70

  • Anonymous

    Anonymous - 2026-09-24

    Originally posted by: kairusds

    @RanKaeder Check if this is much better and also test it in Windows since I'm not on my PC right now. Also please check if the translations for custom_font_file and custom_font_none_found are proper.

    Instead of importing an asset bundle, the new change is to make it a "font pack" with the file extension .hachifont (it's basically just a ZIP file with a different extension) and it only contains 3 files: includes_android, includes_win (the asset bundles that contains the font) and font_path.txt which contains the asset path/name to the font.

    The .hachifont pack structure is like this:

    example_pack.hachifont
    ├── includes_android
    ├── includes_win
    └── font_path.txt
    

    Users can select fonts via the custom_font_file option in the ConfigEditor at the General tab. It scans the hachimi folder for these files every 3 seconds while the editor window is open.

    And the limits are 2GB per asset bundle and 4KB for the font_path.txt file. Along with this change, I also made it so that the custom fonts gets loaded via memory asynchronously instead of from the disk.

    This should make it easier for non-tech savvy users to import and use custom fonts with ease.

     
  • Anonymous

    Anonymous - 2026-09-24

    Originally posted by: kairusds

    Example .hachifont file: https://litter.catbox.moe/o5jw44mgl66gt7lk.hachifont

     
  • Anonymous

    Anonymous - 2026-09-25

    Originally posted by: RanKaeder

    @kairusds
    I tested this on the Windows DMM client. A .hachifont pack I created works correctly, including Chinese text.

    However, Chinese text does not render correctly when using the o5jw44mgl66gt7lk.hachifont pack you provided. There are no related errors in the log, so this may be caused by the bundled font not including the required Chinese glyphs rather than an issue with the loader.

     
  • Anonymous

    Anonymous - 2026-09-25

    Originally posted by: kairusds

    @kairusds I tested this on the Windows DMM client. A .hachifont pack I created works correctly, including Chinese text.

    However, Chinese text does not render correctly when using the o5jw44mgl66gt7lk.hachifont pack you provided. There are no related errors in the log, so this may be caused by the bundled font not including the required Chinese glyphs rather than an issue with the loader.

    Yep, the font in the bundle doesn't have Chinese characters and is just the rodin font UmaTL uses so that shouldn't be a big deal

     
  • Anonymous

    Anonymous - 2026-09-25

    Originally posted by: kairusds

    @RanKaeder Let me know if everything's good to go now and I'll merge it

     
  • Anonymous

    Anonymous - 2026-09-27

    Originally posted by: RanKaeder

    @kairusds Everything looks good on my end. You can merge it.

     
  • Anonymous

    Anonymous - 2026-09-27

    Ticket changed by: kairusds

    • status: open --> closed
     

Log in to post a comment.