Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try using a new font with wider character support #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shippy
Copy link
Owner

@shippy shippy commented Jul 23, 2022

Currently doesn't display anything in the ship HUD and replaces everything, so we should probably pick a different font, but this works somewhat for now! (The font is Open Sans by Google.)

I'll write up how I packed it into an asset bundle in a bit.

Will close #24 once done.

shippy and others added 2 commits July 23, 2022 23:42
Currently doesn't display _anything_ in the ship HUD and replaces _everything_.
@shippy
Copy link
Owner Author

shippy commented Jul 24, 2022

Note to self: the variable-weight font bundle ain't it, since (at least in the current way the bundle is loaded) it uses the thinnest available font cut (probably because it's first?) for all fonts, which obviously doesn't work, and still doesn't fix the monospace issue.

@shippy
Copy link
Owner Author

shippy commented Jul 24, 2022

One other annoying thing - the menu markers are tuned to a particular character width, and infringe on the text when the font is wider. This could maybe be hacked by leaving spaces around the translated menu text.

@shippy
Copy link
Owner Author

shippy commented Jul 24, 2022

Writing this partially for a future myself that needs it and partially for a future myself that hopefully makes a Loom of this.

How to make an asset bundle with a font and avoid going insane

  1. Install Unity Hub
  2. Go to the list of Unity editor versions and download 2019.4.27f (pick the Unity Hub version)
  3. Create a new Unity project (from any template). If this results in an open project in the Unity editor, close it for now.
  4. Into the Assets/ subfolder of the new Unity project, drag the font files you've selected (e.g. from Google Fonts), before opening the Unity editor. (The Unity editor will create a bunch of .meta files that will allow the files within the folder to be used inside an asset bundle, but it only appears to do this at launch.)
  5. Open the project in the Unity editor.
  6. In the Package Manager (available through one of the menus), find and enable Asset Bundle Browser.
  7. Open it via Window > AssetBundle Browser.
  8. On the Configure tab, drag from within the Unity editor the font file you wish to bundle. (Don't drag it from Windows Explorer; don't try adding via Inspect tab and Add file/folder.)
  9. Switch to Build tab and click "Build".
  10. Grab the newly created asset bundle (and its .manifest file) and copy it to your mod directory.
  11. Use the api.AddLanguageFont method, listing (1) the path to the asset bundle, (2) the path within the asset bundle to the font. (You can get this from the manifest file!)
  12. Change the .csproj file to include the asset bundles. (Current settings should already do this, so long as they're saved under assets/.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find new font for UI / title screen with full Czech symbol support
2 participants