Move font files to folder

This commit is contained in:
Isaiah Odhner 2023-05-13 20:13:31 -04:00
parent b74914e841
commit 6c3c34d3ac
8 changed files with 11 additions and 11 deletions

View File

Before

Width:  |  Height:  |  Size: 908 B

After

Width:  |  Height:  |  Size: 908 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -263,8 +263,8 @@ class MetaGlyphFont:
covered_characters = R""" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"""
meta_glyph_fonts: dict[int, MetaGlyphFont] = {
2: MetaGlyphFont(os.path.join(os.path.dirname(__file__), "../../NanoTiny_v14_2x2.flf"), 2, 2, covered_characters),
# 4: MetaGlyphFont(os.path.join(os.path.dirname(__file__), "../../NanoTiny_v14_4x4.flf"), 4, 4, covered_characters),
2: MetaGlyphFont(os.path.join(os.path.dirname(__file__), "../../fonts/NanoTiny/NanoTiny_v14_2x2.flf"), 2, 2, covered_characters),
# 4: MetaGlyphFont(os.path.join(os.path.dirname(__file__), "../../fonts/NanoTiny/NanoTiny_v14_4x4.flf"), 4, 4, covered_characters),
# TODO: less specialized (more practical) fonts for larger sizes
}

View File

@ -387,16 +387,16 @@ def extract_textures(image_path: str):
return extracted_image, half_size_font.createFigFileData(), full_size_font.createFigFileData()
base_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
samples_folder = os.path.join(base_folder, 'samples')
image_path = os.path.join(samples_folder, 'NanoTiny_v14.png')
output_path = os.path.join(samples_folder, 'NanoTiny_v14_no_border.png')
half_size_flf_output_path = os.path.join(base_folder, 'NanoTiny_v14_2x2.flf')
full_size_flf_output_path = os.path.join(base_folder, 'NanoTiny_v14_4x4.flf')
repo_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
font_folder = os.path.join(repo_folder, 'fonts/NanoTiny')
image_input_path = os.path.join(font_folder, 'NanoTiny_v14.png')
image_output_path = os.path.join(font_folder, 'NanoTiny_v14_no_border.png')
half_size_flf_output_path = os.path.join(font_folder, 'NanoTiny_v14_2x2.flf')
full_size_flf_output_path = os.path.join(font_folder, 'NanoTiny_v14_4x4.flf')
extracted_image, extracted_text_half, extracted_text_full = extract_textures(image_path)
extracted_image.save(output_path)
print(f'Wrote extracted textures to {output_path}')
extracted_image, extracted_text_half, extracted_text_full = extract_textures(image_input_path)
extracted_image.save(image_output_path)
print(f'Wrote extracted textures to {image_output_path}')
with open(full_size_flf_output_path, 'w') as f:
f.write(extracted_text_full)
print(f'Wrote FIGlet font {full_size_flf_output_path}')