IdreesInc / Monocraft

A monospaced programming font inspired by the Minecraft typeface
https://idreesinc.com
SIL Open Font License 1.1
8.02k stars 115 forks source link

Convert font to Minecraft's .png font format to be used as a font ingame #122

Open InQuognito opened 1 year ago

InQuognito commented 1 year ago

Convert the default font to these .png files in order to make them compatible with resource packs. Minecraft sucks at rendering .ttf and natively uses these files: image

It would be awesome if this pack was useable on here! Thanks.

Dheatly23 commented 1 year ago

I don't think that's possible. For one, there is already Minecraft-Font for faithful Minecraft font. Second, there are ligatures, that Minecraft can't render. And finally, it's more of Minecraft-style font for general use rather than Minecraft-usable one.

lenrik1589 commented 1 year ago

for faithful Minecraft font

This is not what author of this issue is after, I am afraid, i'd love to use this font in-game as well, but as @InQuognito said, minecraft is not particularly strong at rendering pixelated ttfs/otfs and after fiddling with the "oversampling" value of the font for a prolonged period of time I was not able to produce results which would not have artifacts like these: Screenshot_20230428_055904

Andre601 commented 1 year ago

I wouldn't mind wasting my time on making this, tho I have no real idea how exactly the font system works in MC to make an entire font for this...

Andre601 commented 1 year ago

Quickly want to say that I started to work on a MC variant of this font using the PNG bitmap solution here (Not sure how long this is usable after 1.20 and their unicode font change stuff...)

It's actually relatively easy to implement. Most difficult aspect was/is to have the proper padding for characters like dots or semicolon, which I achieve using semi-transparent (7% opacity) pixels, as MC would otherwise cut any empty spaces...

Either way, here's a quick glance at the font right now (Ascii has been made with exception for these special unicode characters, as I can't think of a way to properly display them without issues... grafik

Here's a preview in a title that also has dots, commas, semicolons and colons (They are centered... Maybe changing that later on). 2023-05-15_18 02 15

Andre601 commented 1 year ago

I hope I'm not annoying people with these comments, but just in case did I create a repository for the above shown Font, so that people can get the necessary files for their resource pack.

It doesn't cover everything yet (i.e. no accented.png coverage yet), but ascii.png and nonlatin_european.png are mostly covered (With exception of unicode emojis not being monospaced yet).

Would appreciate any input and help on this, thanks.

https://github.com/Andre601/Monocraft-Bitmap

Dheatly23 commented 1 year ago

Well good luck on your journey i guess. Just a bit of pointer: maybe use scripting to automate generating the imagefile (and resourcepack). I think pillow should help with imagefile. And submodules too, to link it to this repository.

Andre601 commented 1 year ago

No idea what you mean with that tbh...

lenrik1589 commented 1 year ago

I have already made the script that generates both bitmap of the font, and the json file to go along too, but i am making this for a (for now a part of) private project

lenrik1589 commented 1 year ago

also, please, for the love of god (or whatever), use proper script structure with

if __name__ == "__main__":
  #execute main code here
  generateFont()
  generateExamples(characters, ligatures, charactersByCodepoint)

(hmm, i think i will post that custom version, i guess)