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

Any user-friendly font making util? #161

Open
CaiMiao opened this issue Mar 12, 2022 · 3 comments
Open

Any user-friendly font making util? #161

CaiMiao opened this issue Mar 12, 2022 · 3 comments

Comments

@CaiMiao
Copy link

CaiMiao commented Mar 12, 2022

as the current script requires PBM font and I did not able to find a proper script for that

@Epicpkmn11
Copy link
Member

The PBM fonts are just images, you can edit them any image editor I think, I know GIMP works.

For converting a normal font to PBM anything that can export a font as an image should work, then just use GIMP or such to convert to PBM if it gave you something else, I just used PBM since that's what GodMode9 used before.

@CaiMiao
Copy link
Author

CaiMiao commented Mar 14, 2022

For converting a normal font to PBM anything that can export a font as an image should work, then just use GIMP or such to convert to PBM if it gave you something else, I just used PBM since that's what GodMode9 used before.

one need to feed the script a map.txt, and i can't find a proper script to generates the pair, and gm9 did not use this as well.

(im making CJK compatible font)

@Epicpkmn11
Copy link
Member

The map.txt is just a very simple list of Unicode codepoints in the exact order they appear in the image, the map will be sorted and have any duplicates removed by the generator so you have any blank spaces (such as in the default font, since it's based on JIS X 0208) you can just put spaces in the map and they'll all be removed automatically.

They just need to be separated by any kind of whitespace so you can split them into lines to match the image or just dump them all separated by spaces, it doesn't make a difference.

For example, this is a very simple Python script that will take a file and convert it to a space separated list of all the codepoints in that file:

#!/usr/bin/env python3

import struct

with open("in.txt") as input, open("out.txt", "w") as output:
	str = input.read()
	output.write(" ".join(f"0x{ord(char):04X}" for char in str))

abc -> 0x0061 0x0062 0x0063

For the ones I've done I've just looked up the encoding of what I'm doing, convert that to Unicode codepoints, then pasted that into a .txt file, and added any additional characters manually. Probably some way to get the exact list from a normal font file but not sure exactly.

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

No branches or pull requests

2 participants