Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import pygame
pygame.init()
width = 1024
height = 1024
screen = pygame.display.set_mode((width, height))
bg = pygame.Surface((width, height), pygame.SRCALPHA)
font = pygame.font.SysFont("Ubuntu", 64)
for row_y in range(0, height, 64):
for col_x in range(0, width, 64):
# Find the correct character
char_index = (row_y // 64) * 16 + (col_x // 64)
char = chr(char_index)
print(col_x, row_y, char_index, char)
try:
# Add the character to the font map
char_img = font.render(char, True, (255, 255, 255))
char_img.set_colorkey((0, 0, 0))
char_dimen = char_img.get_rect()
char_dimen.bottomleft = (col_x, row_y + 64)
bg.blit(char_img, char_dimen)
except Exception as e:
print(e)
pass
# Save
pygame.image.save(bg, "result.png")
pygame.quit()
@KTibow
Copy link
Author

KTibow commented Mar 27, 2022

For 1.8.9.
You can change "Ubuntu" to whatever font you want.
To use, create a new resource pack (add the base icon + pack.mcmeta), then move the generated result.png to assets/minecraft/textures/font/ascii.png.

@KTibow
Copy link
Author

KTibow commented Mar 27, 2022

Alternatively, just use the Smooth Font mod's config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment