From 48c1ae7b1494a2eeddee242bcfa8308a68467700 Mon Sep 17 00:00:00 2001 From: The Gears of Progress Date: Mon, 26 Jan 2026 11:47:28 -0500 Subject: [PATCH] Adding font generator --- .gitignore | 2 + font_helper/main.py | 160 ++++++++++++++++++++ graphics/latin_normal.png | Bin 0 -> 3077 bytes graphics/unused graphics/latin_normal.png | Bin 10115 -> 0 bytes graphics/unused graphics/latin_short.png | Bin 1361 -> 1455 bytes include/latin_short.h | 21 --- source/japanese_small.s | 163 --------------------- source/latin_short.s | 163 --------------------- source/text_engine.cpp | 14 +- text_helper/main.py | 169 +++++++++++++++++++++- 10 files changed, 335 insertions(+), 357 deletions(-) create mode 100644 font_helper/main.py create mode 100644 graphics/latin_normal.png delete mode 100644 graphics/unused graphics/latin_normal.png delete mode 100644 include/latin_short.h delete mode 100644 source/japanese_small.s delete mode 100644 source/latin_short.s diff --git a/.gitignore b/.gitignore index 371a6c5..55d9a35 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ include/translated_text.h source/translated_text.cpp text_helper/output.json text_helper/text.xlsx +include/latin_normal.h +source/latin_normal.c diff --git a/font_helper/main.py b/font_helper/main.py new file mode 100644 index 0000000..8265056 --- /dev/null +++ b/font_helper/main.py @@ -0,0 +1,160 @@ +import os +import math +from PIL import Image +import numpy as np + +# THIS PROGRAM ASSUMES THAT THE FIRST TWO COLORS IN THE PALETTE ARE THE BACKGROUND AND CELL BACKGROUND! + +dir = os.curdir +BACKGROUND_PAL_INDEX = 0 +CELL_PAL_INDEX = 1 + +class Font: + def __init__(self, fileName, numColors, numChars, numCharsX, numCharsY, cellWidth, cellHeight): + self.fileName = fileName + self.numColors = numColors + self.numChars = numChars + self.numCharsX = numCharsX + self.numCharsY = numCharsY + self.cellWidth = cellWidth + self.cellHeight = cellHeight + + self.bpp = int(math.log(numColors, 2)) + 1 + self.numWords = self.numChars * self.cellWidth * self.cellHeight * self.bpp // (8 * 4) + self.numBytes = self.numWords * 4 + + self.charWordTable = [0] * self.numWords + self.charWidthTable = [0] * self.numBytes + + +def build_h(myFont): + with open(dir + "/include/" + myFont.fileName + ".h", 'w') as f: + f.write(f''' +#ifndef __{myFont.fileName.upper()}__ +#define __{myFont.fileName.upper()}__ + +extern const TFont {myFont.fileName}Font; + +#define {myFont.fileName}GlyphsLen {myFont.numBytes} +extern const unsigned int {myFont.fileName}Glyphs[{myFont.numBytes}]; + +#define {myFont.fileName}WidthsLen {myFont.numChars} +extern const unsigned char {myFont.fileName}Widths[{myFont.numChars}]; + +#endif +''') + f.close() + +def build_c(myFont): + with open(dir + "/source/" + myFont.fileName + ".c", 'w') as f: + f.write(f'''typedef struct TFont +{{ + const void *data; //!< Character data. + const unsigned char *widths; //!< Width table for vwf. + const unsigned char *heights; //!< Height table for vhf. + unsigned short charOffset; //!< Character offset. + unsigned short charnumChars; //!< Character numChars. + unsigned char charW; //!< Character width (fwf). + unsigned char charH; //!< Character height. + unsigned char cellW; //!< Glyph cell width. + unsigned char cellH; //!< Glyph cell height. + unsigned short cellSize; //!< Cell-size (bytes). + unsigned char bpp; //!< Font bitdepth; + unsigned char extra; //!< Padding. Free to use. +}} TFont;\n +''') + + f.write(f'const unsigned int {myFont.fileName}Glyphs[{myFont.numWords}] __attribute__((aligned(4)))=\n{{\n\t') + + for i in range(myFont.numWords): + f.write(f'{myFont.charWordTable[i]:#010x},') + if (i == myFont.numWords - 1): + f.write("\n};\n\n") + elif (i % 64 == 63): + f.write("\n\n\t") + elif (i % 8 == 7): + f.write("\n\t") + + f.write(f'const unsigned char {myFont.fileName}Widths[{myFont.numChars}] __attribute__((aligned(4)))=\n{{\n\t') + + for i in range(myFont.numChars): + f.write(f'{myFont.charWidthTable[i]:#04x}, ') + if (i == myFont.numChars - 1): + f.write("\n};\n\n") + elif (i % 128 == 127): + f.write("\n\n\t") + elif (i % 16 == 15): + f.write("\n\t") + + f.write(f'''const TFont {myFont.fileName}Font= +{{ + {myFont.fileName}Glyphs, + {myFont.fileName}Widths, + 0, // All heights are the same + 0, // Character offset, is set to zero + {myFont.numChars}, + {myFont.cellWidth}, {myFont.cellHeight}, + {myFont.cellWidth}, {myFont.cellHeight}, + {myFont.numBytes // myFont.numChars}, + {myFont.bpp}, + 0, // Padding, left blank +}}; + ''') + + f.close() + +def generate_tables(myFont): + img = Image.open(f'{dir}/graphics/{myFont.fileName}.png') + if (img.mode != "P"): + print("Error: Image file does not contain a palette") + exit() + pixels = img.load() + + bitsPerWord = 32 + pixelsPerTileX = 8 + pixelsPerTileY = 8 + tilesPerCharX = myFont.cellWidth // pixelsPerTileX + tilesPerCharY = myFont.cellHeight // pixelsPerTileY + charsPerChartX = myFont.numCharsX + charsPerChartY = myFont.numCharsY + + globalX = 0 + globalY = 0 + bitTotal = 0 + + for charY in range(charsPerChartY): + for charX in range(charsPerChartX): + for tileY in range(tilesPerCharY): + for tileX in range(tilesPerCharX): + for pixelY in range(pixelsPerTileY): + for pixelX in range(pixelsPerTileX): + + arrayIndex = bitTotal // bitsPerWord + bitIndex = bitTotal % bitsPerWord + + globalX = pixelX + (tileX * pixelsPerTileX) + (charX * tilesPerCharX * pixelsPerTileX) + globalY = pixelY + (tileY * pixelsPerTileY) + (charY * tilesPerCharY * pixelsPerTileY) + + val = (pixels[globalX, globalY] - 2) & ((1 << myFont.bpp) - 1) + myFont.charWordTable[arrayIndex] |= val << bitIndex + + #print(f'globalX: {globalX}, globalY: {globalY}, arrayIndex:{arrayIndex}, bitIndex:{bitIndex}, val:{val}') + bitTotal += myFont.bpp + + #print(f'{charX, charY}') + + myFont.charWidthTable[(charY * charsPerChartX) + charX] = (tilesPerCharX * pixelsPerTileX) + for x in range(tilesPerCharX * pixelsPerTileX): + globalX = x + (charX * tilesPerCharX * pixelsPerTileX) + globalY = 0 + (charY * tilesPerCharY * pixelsPerTileY) + #print(f'x: {globalX}, y: {globalY}') + if (pixels[globalX, globalY] == BACKGROUND_PAL_INDEX): + myFont.charWidthTable[(charY * charsPerChartX) + charX] = x + break + +# Main: +latin_normal = Font("latin_normal", 1, 256, 16, 16, 16, 16) +generate_tables(latin_normal) +build_h(latin_normal) +build_c(latin_normal) + diff --git a/graphics/latin_normal.png b/graphics/latin_normal.png new file mode 100644 index 0000000000000000000000000000000000000000..e3f323b60e9cc91492d554866bb17aaee0fb6eee GIT binary patch literal 3077 zcmbtW`8U*m`+mJ=CX;0pLP(^9EXg|dNhV9y#8^HtJ|sdTOV)T-(xNn#N*TK(Vy4Kx zOe7=46haz1^RZN z(v2BDWzgYyaL5Meu5qhnV8;_du8k`AoTN{Pnc3>PQf%?z&njD`{LE)41X^i)UE~qP9_RW3u_Pkk}cci`yBry~?x%?{q;xCQ%tL)7Eljy6A zbL2IGzma-fQGw`MEAPzD%7|mE80BIAC-cOHVJ&!Dv{j!~bD1pj<&~E0FxDhq0_U_L zG~^6_x(J5!=^qJ70?esuSD4~;1Q7-<*WR%VXdoPRS7D<-aD+6jJe4QwZGx`=`}t|g zR=!XgIplUP@tSMAlo4= zlJLy83Hx-QLW%ooIA=UfG;5N7YIP%ID^)jajtw^F!hiEK{5@?ES?j{p%lZaXPC;RO zcW*Sy#1YlKXSNuilS=9z1bCAWv`0TKq6_jTxq9#~JhM)M2dCS&OQAI5TL@#}WU>r^ zf^~5D3D~j8m|zil+aYDJ8`Pp@*{=b|rQH)VBp+)4#G7ZgCxur?iBPaE-CvIGsz}0~ zWN+4iuDctMY#5L1sUzOFS|c>4b}2sbDH5>ZDE>Gpkook!1A6dQEJl{A8WF6%&PD&@ zfnq6pRrtEJM`)O_(!Y*_Z2SMe9ZNfncLA##`_Jg5HO^J7>DN-Y3Ckl2NXFRXpPwN0 zX)=}@|9Nm@_O(<5>llLk>ThFu*vEFIq6zWV--dr;G!|xJ^K@X>doN#C5`_yuSnXq8 zhiUMWPYns5ln#b)Pp`N-n%>m#P0=R;dj-Wdq&8%2nErcJ4` zyD+D9;2F23ys(Y{-Fh`H@l}i-+9?Xx>|^M|hEdIjIjiAGPf{Z-&G z6e~3}=X1(MfK{&S&JH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ff --git a/graphics/unused graphics/latin_short.png b/graphics/unused graphics/latin_short.png index 75ec62c95fa15811f5fce198ec5a140237163cb3..52e40dfda3984b6ae1d501c9e1ff4e6df8d627bb 100644 GIT binary patch delta 1395 zcmV-(1&sR93a<;0DF!$=IRF3ukufNL003npK41U<1v*JYK~#90?VF31>naF_;SKQp zUv@|2S0Jgi$yu}7v$T_GbMX_bAYMx4NW#ZII*$6D&iQzWT@UAWpIQ$6D^lMnp5uN= z=eSQLC59M_NddJ~94a00=_u~Hf1Xh4c$L#pTpgeu@VWrhQc5`90=%eD5NXd5%j7oPF~_BX&?rubj-K3MzzjKQeVPBut#GF>5h%GE_y5#$hUG zn`Z+=rz6h9t9e8TxJfYF%h_MRY7LOZ&;H4*E?XzRPyuzI*HP6IAEA{PooXvrnDsz~ zqfUC=%)Z7?(gyq#ptlu1?9my28wLA*5oA;+Gg@eEqQg4rDrm^(y}8$bg6ahaSXH4* z;5`jgP%*u|Gnu&U7}u*Eh{Zw)kgSmdAbX^$!W=+TKs^_tsRZR6;3Pq+1BO4)Bdb8Z z4j!fr_WQ6mb4*<2DKLE_4fxiKWJXE21#oGWHVaYuJ(rUE$g)MP^12$j-HedrD z0QxADwNq&kxpq&fXFyRL`wZ&i;QDr?qg$-QXAv8Sx5&9=I>OJEnKJ&Z9WnMApad0` z04eQ3Xf?ggi?Ca!DwPu&e?~za_!rIv8t&cfSQqVR_<`W;ZgHO{2Y`_L=zy^F3 zfSLL{Qr~BT=-$2iX99q9a;Oaj`sOx4NQwVpx-3Z`Z8Oif=>cU0Q2bn4%kUAP3<)qL z(RMnFXrbg& zUPH_+x_uX+eY^rZNgMDr09^_Y9``J922dMD~cU!>*x42CZ4yN>X9Sti*+JrWS z3e0>4xaRG5?sWj$?q|3Ky=^LB8(&bKq9VxZUFAf?fuD*0ou0BOoc`tDCAw5U55%98ntZ#V=Tbg3eBKO37^s9DnMf- zlwLf*S!rn!beM%iy4{$ZN6K~&5C$V2pb~hI3u7#QlV6R+~Z*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bgyt~YEXN%QxcC}G5Kwtgg(yM0ng#-%6C~U3 zN{sd1J;qPqk8=(S{|oqX``o3)U!xyDClq?CG+k!hdo^=^IcUJC&pagHD}oYyMtJD~ zXUr6;XWB1^4)c?cfU*RMpq~?QW9p`PT?IW#E_R>$!`;UO9F#cLJFaa`1o1J(-|;cF z>&W&C`i_N#iqTNeS#Y>QA->nv-g(O(8|)zgWjg<@x3NvP+m(+Av~71YCGkFxB)YVI z996I-)o#CkDLPM1BvjW3xD#lMgwm50ve;hg+GgLOKR=j3xZi=BcwO)3A*`e+{-1|J%`s5?e(M(E3|$T?`RG0FzE%w z{a+*?j3-c#;D`Wu1_+|#!Dxo*AQD&=x&lT5tZssTNhbot0bNM<3BhNg5O}GD--F!# z0_s}B@^I2C^@nxRzg&z%%p8iY8sG~Fh&|mOs{n#ar;)|(u`#u`rv$
|@P00HZo zNI+atWF85mpP$wsj^?%-oj}QN)Sw^-@b|X559saSN{0(S9{&N=scEZT`1MTy0000< LMNUKnu0mjfim7$^ diff --git a/include/latin_short.h b/include/latin_short.h deleted file mode 100644 index 6e61434..0000000 --- a/include/latin_short.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "debug_mode.h" -#include "pokemon_data.h" - -#if PTGB_BUILD_LANGUAGE != JPN_ID - -//{{BLOCK(latin_short) - -#ifndef __LATIN_SHORT__ -#define __LATIN_SHORT__ - -extern const TFont latin_shortFont; - -#define latin_shortGlyphsLen 4096 -extern const unsigned int latin_shortGlyphs[1024]; -#define BUILD_FONT &latin_shortFont - -#endif // __LATIN_SHORT__ - -//}}BLOCK(latin_short) - -#endif \ No newline at end of file diff --git a/source/japanese_small.s b/source/japanese_small.s deleted file mode 100644 index 3238a8c..0000000 --- a/source/japanese_small.s +++ /dev/null @@ -1,163 +0,0 @@ - -@{{BLOCK(japanese_small) - - .section .rodata - .align 2 - .global japanese_smallFont -japanese_smallFont: - .word japanese_smallGlyphs, 0, 0 - .hword 0, 256 - .byte 8, 10 - .byte 8, 16 - .hword 16 - .byte 1, 0 - - .section .rodata - .align 2 - .global japanese_smallGlyphs @ 4096 unsigned chars -japanese_smallGlyphs: - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x3F040000,0x49553E04,0x00000026,0x00000000 - .word 0x21000000,0x0A414141,0x00000004,0x00000000,0x001E0000,0x1020201E,0x0000000C,0x00000000 - .word 0x001E0000,0x120C101F,0x00000061,0x00000000,0x5F440000,0x45453E04,0x00000026,0x00000000 - .word 0x4F220000,0x10111252,0x0000000C,0x00000000,0x3F080000,0x01107E08,0x0000003E,0x00000000 - .word 0x08100000,0x08040204,0x00000010,0x00000000,0x79200000,0x21212121,0x00000012,0x00000000 - .word 0x1F000000,0x01000020,0x0000003E,0x00000000,0x7F080000,0x01013E10,0x0000003E,0x00000000 - .word 0x02020000,0x42420202,0x0000003C,0x00000000,0x7F200000,0x203C223C,0x00000018,0x00000000 - .word 0x22220000,0x0212227F,0x0000003C,0x00000000,0x081E0000,0x020C3F04,0x0000001C,0x00000000 - - .word 0x3F040000,0x09027A02,0x00000071,0x00000000,0x3F040000,0x40423E02,0x00000038,0x00000000 - .word 0x3F000000,0x20404040,0x0000001C,0x00000000,0x307F0000,0x08040408,0x00000030,0x00000000 - .word 0x34040000,0x0101010E,0x0000007E,0x00000000,0x4F240000,0x623C2102,0x0000001C,0x00000000 - .word 0x01790000,0x05050101,0x00000079,0x00000000,0x12120000,0x55654B3E,0x00000032,0x00000000 - .word 0x37040000,0x5566444C,0x00000074,0x00000000,0x2A1C0000,0x49494949,0x00000026,0x00000000 - .word 0x79210000,0x65392121,0x00000019,0x00000000,0x240F0000,0x11312262,0x0000000E,0x00000000 - .word 0x101C0000,0x51511208,0x0000000C,0x00000000,0x04000000,0x4020110A,0x00000000,0x00000000 - .word 0x21790000,0x65392179,0x00000019,0x00000000,0x207C0000,0x623C207C,0x0000003C,0x00000000 - - .word 0x280E0000,0x25653E28,0x00000012,0x00000000,0x5F440000,0x46450506,0x0000003C,0x00000000 - .word 0x1A120000,0x4D495536,0x00000032,0x00000000,0x1F040000,0x44041F04,0x00000038,0x00000000 - .word 0x3F120000,0x04324252,0x00000004,0x00000000,0x3D080000,0x3C515153,0x00000008,0x00000000 - .word 0x38080000,0x093E0808,0x00000006,0x00000000,0x011C0000,0x2020231D,0x0000001E,0x00000000 - .word 0x22220000,0x10202222,0x0000000C,0x00000000,0x081E0000,0x524C413E,0x0000003C,0x00000000 - .word 0x37040000,0x2526444C,0x00000044,0x00000000,0x183E0000,0x4040423C,0x00000038,0x00000000 - .word 0x37040000,0x4546444C,0x00000024,0x00000000,0x3E040000,0x04143A0C,0x00000038,0x00000000 - .word 0x04040000,0x11120E04,0x00000061,0x00000000,0x04000000,0x351E143F,0x0000002E,0x00000000 - - .word 0x00000000,0x0A212111,0x00000004,0x00000000,0x1E000000,0x10201E00,0x0000000C,0x00000000 - .word 0x0E000000,0x1E081F00,0x00000031,0x00000000,0x24000000,0x251E042F,0x00000016,0x00000000 - .word 0x0A000000,0x14222B1E,0x00000004,0x00000000,0x08000000,0x1C292B1D,0x00000008,0x00000000 - .word 0x08000000,0x190E0818,0x0000000E,0x00000000,0x2F025050,0x10115252,0x0000000C,0x00000000 - .word 0x3F085050,0x01107E08,0x0000003E,0x00000000,0x08100000,0x08045254,0x00000010,0x00000000 - .word 0x79205050,0x21212121,0x00000012,0x00000000,0x1F005050,0x01000020,0x0000003E,0x00000000 - .word 0x7F085050,0x01013E10,0x0000003E,0x00000000,0x52020000,0x42420252,0x0000003C,0x00000000 - .word 0x7F205050,0x203C223C,0x00000018,0x00000000,0x22225050,0x0212227F,0x0000003C,0x00000000 - - .word 0x080E5050,0x020C3F04,0x0000001C,0x00000000,0x3F045050,0x09027A02,0x00000071,0x00000000 - .word 0x3F045050,0x40423E02,0x00000038,0x00000000,0x3F005050,0x20404040,0x0000001C,0x00000000 - .word 0x307F5050,0x08040408,0x00000030,0x00000000,0x34045050,0x0101010E,0x0000007E,0x00000000 - .word 0x79215050,0x65392121,0x00000019,0x00000000,0x240F5050,0x11312262,0x0000000E,0x00000000 - .word 0x100C5050,0x51511208,0x0000000C,0x00000000,0x54500000,0x4020110A,0x00000000,0x00000000 - .word 0x21795050,0x65392179,0x00000019,0x00000000,0x79216060,0x65392121,0x00000019,0x00000000 - .word 0x240F6060,0x11312262,0x0000000E,0x00000000,0x101C6060,0x51511208,0x0000000C,0x00000000 - .word 0x34300000,0x4020110A,0x00000000,0x00000000,0x21396060,0x65392179,0x00000019,0x00000000 - - .word 0x00000000,0x0810100F,0x00000006,0x00000000,0x407F0000,0x08083848,0x00000006,0x00000000 - .word 0x10200000,0x08080B0C,0x00000008,0x00000000,0x7F080000,0x20404141,0x00000018,0x00000000 - .word 0x3E000000,0x08080808,0x0000007F,0x00000000,0x7F100000,0x11121418,0x00000018,0x00000000 - .word 0x7E040000,0x42444444,0x00000031,0x00000000,0x7F080000,0x087F0808,0x00000008,0x00000000 - .word 0x223E0000,0x10202021,0x0000000E,0x00000000,0x7E020000,0x10202122,0x0000000C,0x00000000 - .word 0x203F0000,0x20202020,0x0000003F,0x00000000,0x7F220000,0x20202222,0x0000001C,0x00000000 - .word 0x400E0000,0x2040404E,0x0000001E,0x00000000,0x203F0000,0x24181020,0x00000043,0x00000000 - .word 0x7F020000,0x02022242,0x0000003C,0x00000000,0x41410000,0x10202042,0x0000000C,0x00000000 - - .word 0x427E0000,0x2040714E,0x0000001C,0x00000000,0x1E300000,0x08107F10,0x00000006,0x00000000 - .word 0x4A4A0000,0x2040404A,0x0000001C,0x00000000,0x003E0000,0x1010107F,0x0000000C,0x00000000 - .word 0x04040000,0x0404443C,0x00000004,0x00000000,0x7F100000,0x08101010,0x00000006,0x00000000 - .word 0x3E000000,0x00000000,0x0000007F,0x00000000,0x203F0000,0x14081420,0x00000023,0x00000000 - .word 0x7F080000,0x4B2C1820,0x00000008,0x00000000,0x20200000,0x0C101020,0x00000003,0x00000000 - .word 0x12000000,0x41422222,0x00000041,0x00000000,0x31010000,0x0101010F,0x0000007E,0x00000000 - .word 0x407F0000,0x10202040,0x0000000C,0x00000000,0x04000000,0x4020110A,0x00000000,0x00000000 - .word 0x7F080000,0x4A4A2A08,0x00000049,0x00000000,0x407F0000,0x08142240,0x00000010,0x00000000 - - .word 0x001E0000,0x03001C02,0x0000003C,0x00000000,0x04040000,0x41222204,0x0000007F,0x00000000 - .word 0x24200000,0x4C301028,0x00000003,0x00000000,0x043F0000,0x04047F04,0x00000078,0x00000000 - .word 0x7F040000,0x04142444,0x00000004,0x00000000,0x101E0000,0x7F101010,0x00000000,0x00000000 - .word 0x407F0000,0x40407E40,0x0000007F,0x00000000,0x003E0000,0x2040407F,0x0000001C,0x00000000 - .word 0x22220000,0x10202222,0x0000000C,0x00000000,0x0A0A0000,0x4A0A0A0A,0x00000039,0x00000000 - .word 0x02020000,0x1A224202,0x00000006,0x00000000,0x417F0000,0x7F414141,0x00000000,0x00000000 - .word 0x417F0000,0x20404041,0x0000001C,0x00000000,0x407F0000,0x20407E40,0x0000001E,0x00000000 - .word 0x40470000,0x20404040,0x0000001F,0x00000000,0x00000000,0x0C14101F,0x00000002,0x00000000 - - .word 0x00000000,0x080E0810,0x00000008,0x00000000,0x00000000,0x08111F04,0x00000006,0x00000000 - .word 0x00000000,0x04040E00,0x0000001F,0x00000000,0x00000000,0x0A0C1F08,0x00000009,0x00000000 - .word 0x00000000,0x0A121F02,0x00000002,0x00000000,0x00000000,0x08080E00,0x0000001F,0x00000000 - .word 0x00000000,0x080F080F,0x0000000F,0x00000000,0x7E045050,0x42444444,0x00000031,0x00000000 - .word 0x7F085050,0x087F0808,0x00000008,0x00000000,0x223E5050,0x10202021,0x0000000E,0x00000000 - .word 0x7E025050,0x10202122,0x0000000C,0x00000000,0x203F5050,0x20202020,0x0000003F,0x00000000 - .word 0x7F225050,0x20202222,0x0000001C,0x00000000,0x400E5050,0x2040404E,0x0000001E,0x00000000 - .word 0x203F5050,0x24181020,0x00000043,0x00000000,0x7F025050,0x02022242,0x0000003C,0x00000000 - - .word 0x41015050,0x10202042,0x0000000C,0x00000000,0x427E5050,0x2040714E,0x0000001C,0x00000000 - .word 0x1E305050,0x08107F10,0x00000006,0x00000000,0x4A0A5050,0x2040404A,0x0000001C,0x00000000 - .word 0x003E5050,0x1010107F,0x0000000C,0x00000000,0x04045050,0x0404443C,0x00000004,0x00000000 - .word 0x12005050,0x41422222,0x00000041,0x00000000,0x31015050,0x0101010F,0x0000007E,0x00000000 - .word 0x407F5050,0x10202040,0x0000000C,0x00000000,0x54500000,0x4020110A,0x00000000,0x00000000 - .word 0x7F085050,0x4A4A2A08,0x00000049,0x00000000,0x12606000,0x41422222,0x00000041,0x00000000 - .word 0x19616000,0x01010107,0x0000007E,0x00000000,0x7F606000,0x10202040,0x0000000C,0x00000000 - .word 0x34300000,0x4020110A,0x00000000,0x00000000,0x7F686000,0x4A4A2A08,0x00000049,0x00000000 - - .word 0x00000000,0x08101515,0x00000006,0x00000000,0x1C000000,0x26636332,0x0000001C,0x00000000 - .word 0x18000000,0x1818181C,0x0000007E,0x00000000,0x3E000000,0x071E7063,0x0000007F,0x00000000 - .word 0x7E000000,0x63601C30,0x0000003E,0x00000000,0x38000000,0x7F33363C,0x00000030,0x00000000 - .word 0x3F000000,0x63603F03,0x0000003E,0x00000000,0x3E000000,0x63633F03,0x0000003E,0x00000000 - .word 0x7F000000,0x0C183063,0x0000000C,0x00000000,0x3E000000,0x63633E63,0x0000003E,0x00000000 - .word 0x3E000000,0x607E6363,0x0000003E,0x00000000,0x3C3C0000,0x1800183C,0x00000018,0x00000000 - .word 0x673E0000,0x18001873,0x00000018,0x00000000,0x00000000,0x0A0E0000,0x0000000E,0x00000000 - .word 0x00000000,0x00003F00,0x00000000,0x00000000,0x00000000,0x00181800,0x00000000,0x00000000 - - .word 0x00000000,0x00220000,0x00000000,0x00000000,0x447C0000,0x1C141474,0x00000000,0x00000000 - .word 0x1C000000,0x11171414,0x0000001F,0x00000000,0x10700000,0x00001010,0x00000000,0x00000000 - .word 0x00000000,0x04040400,0x00000007,0x00000000,0x2A1C0000,0x22221C08,0x0000001C,0x00000000 - .word 0x221C0000,0x3E081C22,0x00000808,0x00000000,0x497F0000,0x41417F49,0x00000061,0x00000000 - .word 0x00000000,0x0C0C0000,0x00000000,0x00000000,0x22000000,0x22140814,0x00000000,0x00000000 - .word 0x20400000,0x02040810,0x00000001,0x00000000,0x361C0000,0x637F6363,0x00000063,0x00000000 - .word 0x633F0000,0x63633F63,0x0000003F,0x00000000,0x673E0000,0x67030303,0x0000003E,0x00000000 - .word 0x331F0000,0x33636363,0x0000001F,0x00000000,0x037F0000,0x03033F03,0x0000007F,0x00000000 - - .word 0x037F0000,0x03033F03,0x00000003,0x00000000,0x077E0000,0x67637303,0x0000007E,0x00000000 - .word 0x63630000,0x63637F63,0x00000063,0x00000000,0x187E0000,0x18181818,0x0000007E,0x00000000 - .word 0x60600000,0x63636060,0x0000003E,0x00000000,0x63630000,0x63331F33,0x00000063,0x00000000 - .word 0x06060000,0x06060606,0x0000007E,0x00000000,0x63410000,0x636B7F77,0x00000063,0x00000000 - .word 0x67630000,0x737B7F6F,0x00000063,0x00000000,0x633E0000,0x63636363,0x0000003E,0x00000000 - .word 0x633F0000,0x033F6363,0x00000003,0x00000000,0x633E0000,0x3B636363,0x0000006E,0x00000000 - .word 0x633F0000,0x3B1F7363,0x00000073,0x00000000,0x331E0000,0x63603E03,0x0000003E,0x00000000 - .word 0x187E0000,0x18181818,0x00000018,0x00000000,0x63630000,0x63636363,0x0000003E,0x00000000 - - .word 0x63630000,0x1C3E7763,0x00000008,0x00000000,0x63630000,0x777F7F6B,0x00000063,0x00000000 - .word 0x63630000,0x63361C36,0x00000063,0x00000000,0x66660000,0x18183C66,0x00000018,0x00000000 - .word 0x707F0000,0x070E1C38,0x0000007F,0x00000000,0x00000000,0x667E603C,0x0000007C,0x00000000 - .word 0x06000000,0x66663E06,0x0000003E,0x00000000,0x00000000,0x6606663C,0x0000003C,0x00000000 - .word 0x60000000,0x66667C60,0x0000007C,0x00000000,0x00000000,0x067E663C,0x0000003C,0x00000000 - .word 0x38000000,0x0C0C3E0C,0x0000000C,0x00000000,0x7C000000,0x607C6666,0x0000003E,0x00000000 - .word 0x06000000,0x66663E06,0x00000066,0x00000000,0x18000000,0x18181800,0x00000018,0x00000000 - .word 0x30000000,0x33303000,0x0000001E,0x00000000,0x06000000,0x361E3666,0x00000066,0x00000000 - - .word 0x0E000000,0x0C0C0C0C,0x0000000C,0x00000000,0x00000000,0x6B6B6B3F,0x00000063,0x00000000 - .word 0x00000000,0x6666663E,0x00000066,0x00000000,0x00000000,0x6666663C,0x0000003C,0x00000000 - .word 0x00000000,0x3E66663C,0x00000006,0x00000000,0x00000000,0x7C66663C,0x00000060,0x00000000 - .word 0x00000000,0x0C0C1C6C,0x0000000C,0x00000000,0x00000000,0x303E063C,0x0000001E,0x00000000 - .word 0x0C000000,0x0C0C0C1E,0x0000001C,0x00000000,0x00000000,0x66666666,0x0000007C,0x00000000 - .word 0x00000000,0x36666666,0x0000001C,0x00000000,0x00000000,0x6B6B6B63,0x00000037,0x00000000 - .word 0x00000000,0x361C3663,0x00000063,0x00000000,0x00000000,0x607C6666,0x0000003C,0x00000000 - .word 0x00000000,0x0C18307E,0x0000007E,0x00000000,0x0E060000,0x0E1E3E1E,0x00000006,0x00000000 - - .word 0x00000000,0x08000008,0x00000000,0x00000000,0x00660000,0x7F63361C,0x00000063,0x00000000 - .word 0x00660000,0x6363633E,0x0000003E,0x00000000,0x00660000,0x63636363,0x0000003E,0x00000000 - .word 0x00660000,0x667E603C,0x0000007C,0x00000000,0x00660000,0x6666663C,0x0000003C,0x00000000 - .word 0x00660000,0x66666666,0x0000007C,0x00000000,0xFFFFFE7C,0xC68339EF,0x0000007C,0x00000000 - .word 0x01010000,0x00010101,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - -@}}BLOCK(japanese_small) diff --git a/source/latin_short.s b/source/latin_short.s deleted file mode 100644 index 8bdf1bb..0000000 --- a/source/latin_short.s +++ /dev/null @@ -1,163 +0,0 @@ - -@{{BLOCK(latin_short) - - .section .rodata - .align 2 - .global latin_shortFont -latin_shortFont: - .word latin_shortGlyphs, 0, 0 - .hword 0, 256 - .byte 6, 10 - .byte 8, 16 - .hword 16 - .byte 1, 0 - - .section .rodata - .align 2 - .global latin_shortGlyphs @ 4096 unsigned chars -latin_shortGlyphs: - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x0E000806,0x111F1111,0x00000011,0x00000000 - .word 0x0E00020C,0x111F1111,0x00000011,0x00000000,0x0E000A04,0x111F1111,0x00000011,0x00000000 - .word 0x01110E00,0x040E1101,0x00000002,0x00000000,0x1F000806,0x01010F01,0x0000001F,0x00000000 - .word 0x1F00020C,0x01010F01,0x0000001F,0x00000000,0x1F000A04,0x01010F01,0x0000001F,0x00000000 - .word 0x1F000011,0x01010F01,0x0000001F,0x00000000,0x1F000806,0x04040404,0x0000001F,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x1F000A04,0x04040404,0x0000001F,0x00000000 - .word 0x1F000011,0x04040404,0x0000001F,0x00000000,0x0E000806,0x11111111,0x0000000E,0x00000000 - .word 0x0E00020C,0x11111111,0x0000000E,0x00000000,0x0E000A04,0x11111111,0x0000000E,0x00000000 - - .word 0x76000000,0x19117119,0x00000076,0x00000000,0x11000806,0x11111111,0x0000000E,0x00000000 - .word 0x1100020C,0x11111111,0x0000000E,0x00000000,0x11000A04,0x11111111,0x0000000E,0x00000000 - .word 0x11001926,0x11191513,0x00000011,0x00000000,0x09090700,0x09110907,0x00000001,0x00000000 - .word 0x00080600,0x1911111E,0x00000016,0x00000000,0x00020C00,0x1911111E,0x00000016,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x110E0000,0x040E1101,0x00000002,0x00000000 - .word 0x00080600,0x011F110E,0x0000001E,0x00000000,0x00020C00,0x011F110E,0x0000001E,0x00000000 - .word 0x000A0400,0x011F110E,0x0000001E,0x00000000,0x00001100,0x011F110E,0x0000001E,0x00000000 - .word 0x00080600,0x04040404,0x00000004,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x000A0400,0x04040404,0x00000004,0x00000000,0x00001100,0x04040404,0x00000004,0x00000000 - .word 0x00080600,0x1111110E,0x0000000E,0x00000000,0x00020C00,0x1111110E,0x0000000E,0x00000000 - .word 0x000A0400,0x1111110E,0x0000000E,0x00000000,0x00000000,0x09794936,0x00000076,0x00000000 - .word 0x00080600,0x09090909,0x00000016,0x00000000,0x00020C00,0x09090909,0x00000016,0x00000000 - .word 0x000A0400,0x09090909,0x00000016,0x00000000,0x00192600,0x1212120E,0x00000012,0x00000000 - .word 0x1111110E,0x0000000E,0x00000000,0x00000000,0x0909090E,0x00000016,0x00000000,0x00000000 - .word 0x212F69A6,0x0000002E,0x00000000,0x00000000,0x08141408,0x12121428,0x0000002C,0x00000000 - .word 0x00000000,0x083E0808,0x00000008,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x11010100,0x47A1A111,0x00000000,0x00000000,0x013E0000,0x00003E01,0x00000000,0x00000000 - .word 0x00060600,0x04060600,0x00000002,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x1111111F,0x11111111,0x0000001F,0x00000000,0x04000404,0x11111106,0x0000000E,0x00000000 - .word 0x04000404,0x04040404,0x00000004,0x00000000,0x57555507,0x50515131,0x00000050,0x00000000 - .word 0x59494F09,0x49696959,0x00000048,0x00000000,0xBF858587,0x28A9A9A9,0x00000038,0x00000000 - .word 0x39021222,0x280A3A2A,0x00000038,0x00000000,0x95951300,0x95959593,0x00000073,0x00000000 - .word 0x8AAA9100,0xAA8A8A8A,0x00000091,0x00000000,0x02040400,0x04020101,0x00000004,0x00000000 - .word 0x1F00020C,0x04040404,0x0000001F,0x00000000,0x15252700,0x74080817,0x00725254,0x00000000 - .word 0x02020204,0x02020202,0x00000004,0x00000000,0x04040402,0x04040404,0x00000002,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x000A0400,0x1911111E,0x00000016,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00020C00,0x04040404,0x00000004,0x00000000 - - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0xFE7C3810,0x7C7C7CFF,0x00000000,0x00000000 - .word 0x7C7C7C00,0x387CFEFF,0x00000010,0x00000000,0xFEFC1810,0x18FCFEFF,0x00000010,0x00000000 - .word 0xFE7E3010,0x307EFEFE,0x00000010,0x00000000,0x00000000,0x00000001,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x010F0906,0x0000000E,0x00000000,0x00000000,0x04081020,0x10080402,0x00000020,0x00000000 - .word 0x10080402,0x04081020,0x00000002,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - - .word 0x09794B35,0x00000071,0x00000000,0x00000000,0x1111110E,0x11111111,0x0000000E,0x00000000 - .word 0x04040604,0x04040404,0x0000000E,0x00000000,0x1011110E,0x01020408,0x0000001F,0x00000000 - .word 0x1010110E,0x1110100C,0x0000000E,0x00000000,0x090A0A0C,0x081F0909,0x00000008,0x00000000 - .word 0x0101011F,0x1110100F,0x0000000E,0x00000000,0x0101110E,0x1111110F,0x0000000E,0x00000000 - .word 0x1010101F,0x04040808,0x00000004,0x00000000,0x1111110E,0x1111110E,0x0000000E,0x00000000 - .word 0x1111110E,0x1110101E,0x0000000E,0x00000000,0x04040404,0x04000404,0x00000004,0x00000000 - .word 0x1111110E,0x0400040C,0x00000004,0x00000000,0x00000000,0x06000000,0x00000006,0x00000000 - .word 0x00000000,0x0000001F,0x00000000,0x00000000,0x00000000,0x00000606,0x00000000,0x00000000 - - .word 0x00000000,0x00000000,0x00150000,0x00000000,0x1B1B0912,0x00000000,0x00000000,0x00000000 - .word 0x09121B1B,0x00000000,0x00000000,0x00000000,0x03030102,0x00000000,0x00000000,0x00000000 - .word 0x01020303,0x00000000,0x00000000,0x00000000,0x04150E04,0x1111110E,0x0000000E,0x00000000 - .word 0x1111110E,0x041F040E,0x00000004,0x00000000,0x1C24241C,0x3E043E04,0x00000004,0x00000000 - .word 0x00000000,0x04060600,0x00000002,0x00000000,0x42000000,0x24181824,0x00000042,0x00000000 - .word 0x08081000,0x02020404,0x00000001,0x00000000,0x11110E00,0x11111F11,0x00000011,0x00000000 - .word 0x11110F00,0x1111110F,0x0000000F,0x00000000,0x01110E00,0x11010101,0x0000000E,0x00000000 - .word 0x11110F00,0x11111111,0x0000000F,0x00000000,0x01011F00,0x0101010F,0x0000001F,0x00000000 - - .word 0x01011F00,0x0101010F,0x00000001,0x00000000,0x11110E00,0x11111901,0x0000000E,0x00000000 - .word 0x11111100,0x1111111F,0x00000011,0x00000000,0x04041F00,0x04040404,0x0000001F,0x00000000 - .word 0x10101000,0x11101010,0x0000000E,0x00000000,0x05091100,0x09050303,0x00000011,0x00000000 - .word 0x01010100,0x01010101,0x0000001F,0x00000000,0x1B1B1100,0x11111515,0x00000011,0x00000000 - .word 0x13131100,0x11191915,0x00000011,0x00000000,0x11110E00,0x11111111,0x0000000E,0x00000000 - .word 0x11110F00,0x01010F11,0x00000001,0x00000000,0x11110E00,0x19171111,0x0000002E,0x00000000 - .word 0x11110F00,0x11090F11,0x00000011,0x00000000,0x01110E00,0x11100806,0x0000000E,0x00000000 - .word 0x04041F00,0x04040404,0x00000004,0x00000000,0x11111100,0x11111111,0x0000000E,0x00000000 - - .word 0x11111100,0x040A0A11,0x00000004,0x00000000,0x15111100,0x1B1B1515,0x00000011,0x00000000 - .word 0x0A111100,0x110A0404,0x00000011,0x00000000,0x0A111100,0x0404040A,0x00000004,0x00000000 - .word 0x08101F00,0x01020404,0x0000001F,0x00000000,0x00000000,0x1911111E,0x00000016,0x00000000 - .word 0x01010100,0x1111110F,0x0000000F,0x00000000,0x00000000,0x1101110E,0x0000000E,0x00000000 - .word 0x10101000,0x1111111E,0x0000001E,0x00000000,0x00000000,0x011F110E,0x0000001E,0x00000000 - .word 0x02020C00,0x0202020F,0x00000002,0x00000000,0x00000000,0x101E111E,0x0000000E,0x00000000 - .word 0x01010100,0x1111110F,0x00000011,0x00000000,0x00000200,0x02020202,0x00000002,0x00000000 - .word 0x00000800,0x09090808,0x00000006,0x00000000,0x01010100,0x05030509,0x00000009,0x00000000 - - .word 0x04040600,0x04040404,0x00000004,0x00000000,0x00000000,0x1515150F,0x00000015,0x00000000 - .word 0x00000000,0x09090907,0x00000009,0x00000000,0x00000000,0x1111110E,0x0000000E,0x00000000 - .word 0x00000000,0x0F11110F,0x00000001,0x00000000,0x00000000,0x1E11111E,0x00000010,0x00000000 - .word 0x00000000,0x0101030D,0x00000001,0x00000000,0x00000000,0x0806010F,0x0000000F,0x00000000 - .word 0x02020000,0x0202020F,0x0000000E,0x00000000,0x00000000,0x09090909,0x00000016,0x00000000 - .word 0x00000000,0x0A0A1111,0x00000004,0x00000000,0x00000000,0x15151515,0x0000000A,0x00000000 - .word 0x00000000,0x0A040A11,0x00000011,0x00000000,0x00000000,0x101E1111,0x0000000F,0x00000000 - .word 0x00000000,0x0204081F,0x0000001F,0x00000000,0x1E0E0602,0x060E1E3E,0x00000002,0x00000000 - - .word 0x06060000,0x06060000,0x00000000,0x00000000,0x0E000011,0x111F1111,0x00000011,0x00000000 - .word 0x0E000011,0x11111111,0x0000000E,0x00000000,0x11000011,0x11111111,0x0000000E,0x00000000 - .word 0x00001100,0x1911111E,0x00000016,0x00000000,0x00001100,0x1111110E,0x0000000E,0x00000000 - .word 0x00001100,0x09090909,0x00000016,0x00000000,0x3F3F3E3C,0x0603392F,0x0000003C,0x00000000 - .word 0x07070301,0x03060407,0x00000001,0x00000000,0x10020702,0x0E041038,0x00000004,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - .word 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000 - -@}}BLOCK(latin_short) diff --git a/source/text_engine.cpp b/source/text_engine.cpp index 2a8efb7..01fd39f 100644 --- a/source/text_engine.cpp +++ b/source/text_engine.cpp @@ -8,7 +8,8 @@ #include "debug_mode.h" #include "button_menu.h" #include "sprite_data.h" -#include "latin_short.h" +//#include "latin_short.h" +#include "latin_normal.h" #include "japanese_small.h" #include "text_data_table.h" #include "background_engine.h" @@ -64,16 +65,17 @@ void init_text_engine() // Load the TTE // tte_init_se(3, BG_CBB(TEXT_CBB) | BG_SBB(TEXT_SBB) | BG_PRIO(0), 0, CLR_WHITE, 14, &japanese_smallFont, NULL); - tte_init_chr4c(3, // BG 0 - BG_CBB(TEXT_CBB) | BG_SBB(TEXT_SBB), // Charblock 0; screenblock 31 + tte_init_chr4c(3, // BG 3 + BG_CBB(TEXT_CBB) | BG_SBB(TEXT_SBB), // Charblock 0; screenblock 10 0xF000, // Screen-entry offset bytes2word( // Color attributes: - 15, // Text color - 0, // Shadow color + 13, // Text color + 15, // Shadow color 0, // Paper 0), // Special CLR_WHITE, // White text - BUILD_FONT, // Custom font + //&latin_shortFont, // Custom font + &latin_normalFont, // Custom font NULL // Use default chr4 renderer ); tte_init_con(); diff --git a/text_helper/main.py b/text_helper/main.py index 03ef573..8d1481f 100755 --- a/text_helper/main.py +++ b/text_helper/main.py @@ -7,6 +7,9 @@ from collections import defaultdict import sys from pathlib import Path import hashlib +import math +from PIL import Image +import numpy as np class Languages(Enum): Japanese = 0 @@ -21,7 +24,7 @@ FIRST_TRANSLATION_COL_INDEX = 8 BASE_DIR = Path(__file__).resolve().parent # read by default 1st sheet of an excel file -dir = os.curdir + "/text_helper" +textDir = os.curdir + "/text_helper" url = 'https://docs.google.com/spreadsheets/d/14LLs5lLqWasFcssBmJdGXjjYxARAJBa_QUOUhXZt4v8/export?format=xlsx' new_file_path = BASE_DIR / 'new_text.xlsx' @@ -463,7 +466,7 @@ def download_xlsx_file(): def transfer_xlsx_to_dict(): print("\tGetting character arrays") - currSheet = pd.read_excel(dir + "/text.xlsx", sheet_name="Character Arrays", header=None) + currSheet = pd.read_excel(textDir + "/text.xlsx", sheet_name="Character Arrays", header=None) offset = 0 for key, value in charArrays.items(): for r in range(16): @@ -478,7 +481,7 @@ def transfer_xlsx_to_dict(): print("\tGetting string data") - currSheet = pd.read_excel(dir + "/text.xlsx", sheet_name="Translations") + currSheet = pd.read_excel(textDir + "/text.xlsx", sheet_name="Translations") for row in currSheet.iterrows(): currRow = row[1]["Text Section"] @@ -581,11 +584,169 @@ def output_json_file(): outText += str(byte) mainDict[lang.name][section][item]["text"] = outText - with open(dir + '/output.json', 'w') as jsonFile: + with open(textDir + '/output.json', 'w') as jsonFile: jsonFile.write(json.dumps(mainDict)) + +# This is for the font generation +fontDir = os.curdir +BACKGROUND_PAL_INDEX = 0 +CELL_PAL_INDEX = 1 + +class Font: + def __init__(self, fileName, numColors, numChars, numCharsX, numCharsY, cellWidth, cellHeight): + self.fileName = fileName + self.numColors = numColors + self.numChars = numChars + self.numCharsX = numCharsX + self.numCharsY = numCharsY + self.cellWidth = cellWidth + self.cellHeight = cellHeight + + self.bpp = int(math.log(numColors, 2)) + 1 + self.numWords = self.numChars * self.cellWidth * self.cellHeight * self.bpp // (8 * 4) + self.numBytes = self.numWords * 4 + + self.charWordTable = [0] * self.numWords + self.charWidthTable = [0] * self.numBytes + +def build_h(myFont): + with open(fontDir + "/include/" + myFont.fileName + ".h", 'w') as f: + f.write(f''' +#ifndef __{myFont.fileName.upper()}__ +#define __{myFont.fileName.upper()}__ + +extern const TFont {myFont.fileName}Font; + +#define {myFont.fileName}GlyphsLen {myFont.numBytes} +extern const unsigned int {myFont.fileName}Glyphs[{myFont.numBytes}]; + +#define {myFont.fileName}WidthsLen {myFont.numChars} +extern const unsigned char {myFont.fileName}Widths[{myFont.numChars}]; + +#endif +''') + f.close() + +def build_c(myFont): + with open(fontDir + "/source/" + myFont.fileName + ".c", 'w') as f: + f.write(f'''typedef struct TFont +{{ + const void *data; //!< Character data. + const unsigned char *widths; //!< Width table for vwf. + const unsigned char *heights; //!< Height table for vhf. + unsigned short charOffset; //!< Character offset. + unsigned short charnumChars; //!< Character numChars. + unsigned char charW; //!< Character width (fwf). + unsigned char charH; //!< Character height. + unsigned char cellW; //!< Glyph cell width. + unsigned char cellH; //!< Glyph cell height. + unsigned short cellSize; //!< Cell-size (bytes). + unsigned char bpp; //!< Font bitdepth; + unsigned char extra; //!< Padding. Free to use. +}} TFont;\n +''') + + f.write(f'const unsigned int {myFont.fileName}Glyphs[{myFont.numWords}] __attribute__((aligned(4)))=\n{{\n\t') + + for i in range(myFont.numWords): + f.write(f'{myFont.charWordTable[i]:#010x},') + if (i == myFont.numWords - 1): + f.write("\n};\n\n") + elif (i % 64 == 63): + f.write("\n\n\t") + elif (i % 8 == 7): + f.write("\n\t") + + f.write(f'const unsigned char {myFont.fileName}Widths[{myFont.numChars}] __attribute__((aligned(4)))=\n{{\n\t') + + for i in range(myFont.numChars): + f.write(f'{myFont.charWidthTable[i]:#04x}, ') + if (i == myFont.numChars - 1): + f.write("\n};\n\n") + elif (i % 128 == 127): + f.write("\n\n\t") + elif (i % 16 == 15): + f.write("\n\t") + + f.write(f'''const TFont {myFont.fileName}Font= +{{ + {myFont.fileName}Glyphs, + {myFont.fileName}Widths, + 0, // All heights are the same + 0, // Character offset, is set to zero + {myFont.numChars}, + {myFont.cellWidth}, {myFont.cellHeight}, + {myFont.cellWidth}, {myFont.cellHeight}, + {myFont.numBytes // myFont.numChars}, + {myFont.bpp}, + 0, // Padding, left blank +}}; + ''') + + f.close() + +def generate_tables(myFont): + img = Image.open(f'{fontDir}/graphics/{myFont.fileName}.png') + if (img.mode != "P"): + print("Error: Image file does not contain a palette") + exit() + pixels = img.load() + + bitsPerWord = 32 + pixelsPerTileX = 8 + pixelsPerTileY = 8 + tilesPerCharX = myFont.cellWidth // pixelsPerTileX + tilesPerCharY = myFont.cellHeight // pixelsPerTileY + charsPerChartX = myFont.numCharsX + charsPerChartY = myFont.numCharsY + + globalX = 0 + globalY = 0 + bitTotal = 0 + + for charY in range(charsPerChartY): + for charX in range(charsPerChartX): + for tileY in range(tilesPerCharY): + for tileX in range(tilesPerCharX): + for pixelY in range(pixelsPerTileY): + for pixelX in range(pixelsPerTileX): + + arrayIndex = bitTotal // bitsPerWord + bitIndex = bitTotal % bitsPerWord + + globalX = pixelX + (tileX * pixelsPerTileX) + (charX * tilesPerCharX * pixelsPerTileX) + globalY = pixelY + (tileY * pixelsPerTileY) + (charY * tilesPerCharY * pixelsPerTileY) + + val = (pixels[globalX, globalY] - 2) & ((1 << myFont.bpp) - 1) + myFont.charWordTable[arrayIndex] |= val << bitIndex + + #print(f'globalX: {globalX}, globalY: {globalY}, arrayIndex:{arrayIndex}, bitIndex:{bitIndex}, val:{val}') + bitTotal += myFont.bpp + + #print(f'{charX, charY}') + + myFont.charWidthTable[(charY * charsPerChartX) + charX] = (tilesPerCharX * pixelsPerTileX) + for x in range(tilesPerCharX * pixelsPerTileX): + globalX = x + (charX * tilesPerCharX * pixelsPerTileX) + globalY = 0 + (charY * tilesPerCharY * pixelsPerTileY) + #print(f'x: {globalX}, y: {globalY}') + if (pixels[globalX, globalY] == BACKGROUND_PAL_INDEX): + myFont.charWidthTable[(charY * charsPerChartX) + charX] = x + break + +def generate_font(): + latin_normal = Font("latin_normal", 1, 256, 16, 16, 16, 16) + generate_tables(latin_normal) + build_h(latin_normal) + build_c(latin_normal) + + + # Main print("Running text_helper:") +print("\tGenerating font") +generate_font() download_xlsx_file() transfer_xlsx_to_dict() generate_header_file()