Skip to content

Instantly share code, notes, and snippets.

@KTibow
Last active March 27, 2022 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KTibow/da990ea79afc38ffa7d2ec1c15fca980 to your computer and use it in GitHub Desktop.
Save KTibow/da990ea79afc38ffa7d2ec1c15fca980 to your computer and use it in GitHub Desktop.
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