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

Extract the fonts to separate BMP files rather than combined BIN files #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 214 additions & 2 deletions assets/font/font.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,103 @@ _fonttablectlsmall1SegmentRomEnd:

.global font_second_font_table_controller_small
font_second_font_table_controller_small:
.incbin "assets/font/font_second_font_table_controller_small.bin"
.incbin "assets/font/font_second_font_table_controller_small_header.bin"
.incbin "assets/font/small_unknownfont01_08_x_09.bmp", 1146
.incbin "assets/font/small_unknownfont02_08_x_06.bmp", 1146
.incbin "assets/font/small_hashtag_08_x_11.bmp", 1146
.incbin "assets/font/small_dollar_08_x_11.bmp", 1146
.incbin "assets/font/small_percentage_16_x_08.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/small_ampersand_08_x_09.bmp", 1146
.incbin "assets/font/small_unknownfont03_08_x_06.bmp", 1146
.incbin "assets/font/small_leftroundbracket_08_x_09.bmp", 1146
.incbin "assets/font/small_rightroundbracket_08_x_09.bmp", 1146
.incbin "assets/font/small_unknownfont04_08_x_06.bmp", 1146
.incbin "assets/font/small_plus_08_x_10.bmp", 1146
.incbin "assets/font/small_unknownfont05_08_x_05.bmp", 1146
.incbin "assets/font/small_unknownfont06_08_x_03.bmp", 1146
.incbin "assets/font/small_unknownfont07_08_x_04.bmp", 1146
.incbin "assets/font/small_forwardslash_08_x_09.bmp", 1146
.incbin "assets/font/small_0_08_x_09.bmp", 1146
.incbin "assets/font/small_1_08_x_09.bmp", 1146
.incbin "assets/font/small_2_08_x_09.bmp", 1146
.incbin "assets/font/small_3_08_x_09.bmp", 1146
.incbin "assets/font/small_4_08_x_09.bmp", 1146
.incbin "assets/font/small_5_08_x_09.bmp", 1146
.incbin "assets/font/small_6_08_x_09.bmp", 1146
.incbin "assets/font/small_7_08_x_09.bmp", 1146
.incbin "assets/font/small_8_08_x_09.bmp", 1146
.incbin "assets/font/small_9_08_x_09.bmp", 1146
.incbin "assets/font/small_unknownfont08_08_x_08.bmp", 1146
.incbin "assets/font/small_unknownfont09_08_x_09.bmp", 1146
.incbin "assets/font/small_leftarrow_08_x_08.bmp", 1146
.incbin "assets/font/small_unknownfont10_08_x_06.bmp", 1146
.incbin "assets/font/small_rightarrow_08_x_08.bmp", 1146
.incbin "assets/font/small_questionmark_08_x_09.bmp", 1146
.incbin "assets/font/small_downarrow_08_x_06.bmp", 1146
.incbin "assets/font/small_A01_08_x_09.bmp", 1146
.incbin "assets/font/small_B01_08_x_09.bmp", 1146
.incbin "assets/font/small_C01_08_x_09.bmp", 1146
.incbin "assets/font/small_D01_08_x_09.bmp", 1146
.incbin "assets/font/small_E01_08_x_09.bmp", 1146
.incbin "assets/font/small_F01_08_x_09.bmp", 1146
.incbin "assets/font/small_G01_08_x_09.bmp", 1146
.incbin "assets/font/small_H01_08_x_09.bmp", 1146
.incbin "assets/font/small_I01_08_x_09.bmp", 1146
.incbin "assets/font/small_J01_08_x_09.bmp", 1146
.incbin "assets/font/small_K01_08_x_09.bmp", 1146
.incbin "assets/font/small_L01_08_x_09.bmp", 1146
.incbin "assets/font/small_M01_08_x_09.bmp", 1146
.incbin "assets/font/small_N01_08_x_09.bmp", 1146
.incbin "assets/font/small_O01_08_x_09.bmp", 1146
.incbin "assets/font/small_P01_08_x_09.bmp", 1146
.incbin "assets/font/small_Q01_08_x_10.bmp", 1146
.incbin "assets/font/small_R01_08_x_09.bmp", 1146
.incbin "assets/font/small_S01_08_x_09.bmp", 1146
.incbin "assets/font/small_T01_08_x_09.bmp", 1146
.incbin "assets/font/small_U01_08_x_09.bmp", 1146
.incbin "assets/font/small_V01_08_x_09.bmp", 1146
.incbin "assets/font/small_W01_16_x_08.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/small_X01_08_x_09.bmp", 1146
.incbin "assets/font/small_Y01_08_x_09.bmp", 1146
.incbin "assets/font/small_Z01_08_x_09.bmp", 1146
.incbin "assets/font/small_leftsquarebracket_08_x_09.bmp", 1146
.incbin "assets/font/small_X03_08_x_09.bmp", 1146
.incbin "assets/font/small_rightsquarebracket_08_x_09.bmp", 1146
.incbin "assets/font/small_uparrow_08_x_06.bmp", 1146
.incbin "assets/font/small_unknownfont11_08_x_04.bmp", 1146
.incbin "assets/font/small_unknownfont12_08_x_04.bmp", 1146
.incbin "assets/font/small_A02_08_x_08.bmp", 1146
.incbin "assets/font/small_B02_08_x_08.bmp", 1146
.incbin "assets/font/small_C02_08_x_08.bmp", 1146
.incbin "assets/font/small_D02_08_x_08.bmp", 1146
.incbin "assets/font/small_E02_08_x_08.bmp", 1146
.incbin "assets/font/small_F02_08_x_08.bmp", 1146
.incbin "assets/font/small_G02_08_x_08.bmp", 1146
.incbin "assets/font/small_H02_08_x_08.bmp", 1146
.incbin "assets/font/small_I02_08_x_08.bmp", 1146
.incbin "assets/font/small_J02_08_x_08.bmp", 1146
.incbin "assets/font/small_K02_08_x_08.bmp", 1146
.incbin "assets/font/small_L02_08_x_08.bmp", 1146
.incbin "assets/font/small_M02_08_x_08.bmp", 1146
.incbin "assets/font/small_N02_08_x_08.bmp", 1146
.incbin "assets/font/small_O02_08_x_08.bmp", 1146
.incbin "assets/font/small_P02_08_x_08.bmp", 1146
.incbin "assets/font/small_Q02_08_x_09.bmp", 1146
.incbin "assets/font/small_R02_08_x_08.bmp", 1146
.incbin "assets/font/small_S02_08_x_08.bmp", 1146
.incbin "assets/font/small_T02_08_x_08.bmp", 1146
.incbin "assets/font/small_U02_08_x_08.bmp", 1146
.incbin "assets/font/small_V02_08_x_08.bmp", 1146
.incbin "assets/font/small_W02_08_x_08.bmp", 1146
.incbin "assets/font/small_X02_08_x_08.bmp", 1146
.incbin "assets/font/small_Y02_08_x_08.bmp", 1146
.incbin "assets/font/small_Z02_08_x_08.bmp", 1146
.incbin "assets/font/small_leftcurlybracket_08_x_13.bmp", 1146
.incbin "assets/font/small_unknownfont13_08_x_15.bmp", 1146
.incbin "assets/font/small_rightcurlybracket_08_x_13.bmp", 1146
.incbin "assets/font/small_unknownfont14_08_x_04.bmp", 1146
font_second_font_table_controller_small_end:

.global _fonttablectllarge1SegmentRomStart
Expand All @@ -17,5 +113,121 @@ _fonttablectllarge1SegmentRomEnd:

.global font_second_font_table_controller_large
font_second_font_table_controller_large:
.incbin "assets/font/font_second_font_table_controller_large.bin"
.incbin "assets/font/font_second_font_table_controller_large_header.bin"
.incbin "assets/font/large_unknownfont01_08_x_13.bmp", 1146
.incbin "assets/font/large_unknownfont02_08_x_07.bmp", 1146
.incbin "assets/font/large_hashtag_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_dollar_08_x_14.bmp", 1146
.incbin "assets/font/large_percentage_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_ampersand_08_x_13.bmp", 1146
.incbin "assets/font/large_unknownfont03_08_x_07.bmp", 1146
.incbin "assets/font/large_leftroundbracket_08_x_15.bmp", 1146
.incbin "assets/font/large_rightroundbracket_08_x_15.bmp", 1146
.incbin "assets/font/large_asterisk_08_x_07.bmp", 1146
.incbin "assets/font/large_plus_16_x_10.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_unknownfont04_08_x_05.bmp", 1146
.incbin "assets/font/large_unknownfont05_08_x_04.bmp", 1146
.incbin "assets/font/large_unknownfont06_08_x_04.bmp", 1146
.incbin "assets/font/large_forwardslash_08_x_14.bmp", 1146
.incbin "assets/font/large_0_08_x_13.bmp", 1146
.incbin "assets/font/large_1_08_x_12.bmp", 1146
.incbin "assets/font/large_2_08_x_13.bmp", 1146
.incbin "assets/font/large_3_08_x_13.bmp", 1146
.incbin "assets/font/large_4_08_x_12.bmp", 1146
.incbin "assets/font/large_5_08_x_12.bmp", 1146
.incbin "assets/font/large_6_08_x_13.bmp", 1146
.incbin "assets/font/large_7_08_x_12.bmp", 1146
.incbin "assets/font/large_8_08_x_13.bmp", 1146
.incbin "assets/font/large_9_08_x_13.bmp", 1146
.incbin "assets/font/large_unknownfont07_08_x_10.bmp", 1146
.incbin "assets/font/large_unknownfont08_08_x_11.bmp", 1146
.incbin "assets/font/large_leftarrow_16_x_08.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_unknownfont09_16_x_05.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_rightarrow_16_x_08.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_questionmark_08_x_13.bmp", 1146
.incbin "assets/font/large_atsign_16_x_14.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseA_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseB_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseC_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseD_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseE_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseF_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseG_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseH_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseI_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseJ_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseK_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseL_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseM_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseN_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseO_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseP_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseQ_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseR_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseS_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseT_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseU_08_x_13.bmp", 1146
.incbin "assets/font/large_uppercaseV_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseW_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseX_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseY_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_uppercaseZ_08_x_13.bmp", 1146
.incbin "assets/font/large_leftsquarebracket_08_x_15.bmp", 1146
.incbin "assets/font/large_X03_16_x_12.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_rightsquarebracket_08_x_15.bmp", 1146
.incbin "assets/font/large_uparrow_16_x_06.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_unknownfont10_08_x_03.bmp", 1146
.incbin "assets/font/large_unknownfont11_08_x_05.bmp", 1146
.incbin "assets/font/large_lowercaseA_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseB_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseC_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseD_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseE_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseF_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseG_08_x_12.bmp", 1146
.incbin "assets/font/large_lowercaseH_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseI_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseJ_08_x_15.bmp", 1146
.incbin "assets/font/large_lowercaseK_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseL_08_x_13.bmp", 1146
.incbin "assets/font/large_lowercaseM_16_x_09.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_lowercaseN_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseO_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseP_08_x_12.bmp", 1146
.incbin "assets/font/large_lowercaseQ_08_x_12.bmp", 1146
.incbin "assets/font/large_lowercaseR_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseS_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseT_08_x_11.bmp", 1146
.incbin "assets/font/large_lowercaseU_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseV_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseW_16_x_09.bmp", 1146
.incbin "assets/font/paddingafter16pxwidefonts_08_x_01.bmp", 1146
.incbin "assets/font/large_lowercaseX_08_x_10.bmp", 1146
.incbin "assets/font/large_lowercaseY_08_x_12.bmp", 1146
.incbin "assets/font/large_lowercaseZ_08_x_10.bmp", 1146
.incbin "assets/font/large_leftcurlybracket_08_x_16.bmp", 1146
.incbin "assets/font/large_unknownfont12_08_x_16.bmp", 1146
.incbin "assets/font/large_rightcurlybracket_08_x_15.bmp", 1146
.incbin "assets/font/large_unknownfont13_08_x_07.bmp", 1146
font_second_font_table_controller_large_end:
18 changes: 18 additions & 0 deletions extract_baserom.u.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,21 @@ if [ "$DOALL" == "1" ] || [ $1 == 'images' ]; then
#formatting matters, no comments, no extra lines, unix line endings only
#and always end with a newline
fi

for file in assets/font/*.bmp
do
#add the BMP header to the raw font image data
sed -i -e '1 e cat font_bmp_header.bin' $file
#extract the width and height from the filename
width=$((10#$(echo ${file: (( ${#file} - 11)) :2})))
height=$((10#$(echo ${file: (( ${#file} - 6)) :2})))
#invert the height, as the fonts are upside-down
height=$((256 - $height))
#convert the width and height from decimal to hexadecimal
printf -v width "%X" "$width"
printf -v height "%X" "$height"
#write the width and height values to the BMP header
echo -n -e \\x$width | dd conv=notrunc bs=1 seek=18 of=$file
echo -n -e \\x$height | dd conv=notrunc bs=1 seek=22 of=$file
echo -n -e \\xFF\\xFF\\xFF | dd conv=notrunc bs=1 seek=23 of=$file
done
Loading