Skip to content

Commit

Permalink
upload source code
Browse files Browse the repository at this point in the history
  • Loading branch information
z64me committed Aug 4, 2021
1 parent 1d1a900 commit cbef1fd
Show file tree
Hide file tree
Showing 20 changed files with 6,450 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin/
release/
*.o
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "wowlib"]
path = wowlib
url = https://github.com/z64me/wowlib
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# z64font

`z64font` is a font tool that rasterizes TrueType font (`.ttf`) files
into a format compatible with Ocarina of Time and Majora's Mask.
Whether you're looking to localize these games into new languages that
rely on brand new character sets, or you're just adding a fresh coat of
paint to your romhack, this program makes your job a whole lot easier.

![preview.gif](preview.gif)

## How to use

`z64font` requires you to provide only two files:
- A UTF8-encoded text document containing a sample string and
a list of codepoints.
- The TrueType font (`.ttf`) file you wish to convert.

Here are the latest codepoint files (simply `Ctrl + S` in your browser):
- [Ocarina of Time codepoints](https://raw.githubusercontent.com/z64me/z64font/main/codepoints/oot.txt)
- [Majora's Mask codepoints](https://raw.githubusercontent.com/z64me/z64font/main/codepoints/mm.txt)

You can use your scroll wheel to effortlessly tweak each control. Once
you are happy with how your font is displaying in the preview window,
click the `Export Binaries` button. You will be prompted to select a
location and filename for them. Let's assume you chose the name `wow`.

Once you have done that, two files will be generated: `wow.font_static`
and `wow.font_width`.

What you do next depends on your workflow.

<!--### [`zzrtl`](https://github.com/z64me/zzrtl) users
Overwrite the `font_static` and `font_width` files in your project's
root directory with these new files.
TODO implement external font file support in zzrtl
-->

### Traditional hackers

Inject the files into your decompressed game using a hex editor.
For Windows users, I recommend [HxD](https://mh-nexus.de/en/hxd/).

| Game | .font_static | .font_width |
| ------------- | --------------- | ----------------------------- |
| OoT debug | `0x008C1000` | `0x00BCABA0` |
| OoT NTSC 1.0 | `0x00928000` | `0x00B88EA0` |
| MM USA | `0x00ACC000` | `0x00C669B0` and `0x00C66E50` |

If you don't know how to decompress your copy of the game, look no
further than [`z64decompress`](https://github.com/z64me/z64decompress).

### [OoT decomp](https://github.com/zeldaret/oot) and [MM decomp](https://github.com/zeldaret/mm) users

The OoT/MM decomps will be made targetable as each finalizes
its font handling.

145 changes: 145 additions & 0 deletions codepoints/mm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
This is sample text.\nStepping Stones in the Pond\nIf you boldly go in the direction\nyou want to jump, you will leap\nautomatically.\n¥ºªÀÁÂÄÇÈÉÊËÌÍÎÏÑÒÓÔÖÙÚÛÜβàáâäçèéêëìíîïñòóôöùúûü¡¿

!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
¥
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
º
À
Á
Â
Ä
Ç
È
É
Ê
Ë
Ì
Í
Î
Ï
Ñ
Ò
Ó
Ô
Ö
Ù
Ú
Û
Ü
β
à
á
â
ä
ç
è
é
ê
ë
ì
í
î
ï
ñ
ò
ó
ô
ö
ù
ú
û
ü
¡
¿
ª
127 changes: 127 additions & 0 deletions codepoints/oot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
This is sample text.\nStepping Stones in the Pond\nIf you boldly go in the direction\nyou want to jump, you will leap\nautomatically.\n¥ÀîÂÄÇÈÉÊËÏÔÖÙÛÜβàáâäçèéêëïôöùûü

!
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
¥
\
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
À
î
Â
Ä
Ç
È
É
Ê
Ë
Ï
Ô
Ö
Ù
Û
Ü
β
à
á
â
ä
ç
è
é
ê
ë
ï
ô
ö
ù
û
ü
1 change: 1 addition & 0 deletions common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
echo "-DNDEBUG -Wall -flto -lm -Os -s -flto -Iwowlib -DWOW_OVERLOAD_FILE src/*.c -Isrc "
Binary file added preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions release-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mkdir -p bin/release

gcc -o bin/release/z64font-linux -DZ64FONT_GUI `./common.sh` `wowlib/deps/wow_gui_x11.sh`

13 changes: 13 additions & 0 deletions release-win32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mkdir -p bin/release
mkdir -p bin/o/win32

PATH=$PATH:~/c/mxe/usr/bin

# icon
i686-w64-mingw32.static-windres src/icon.rc -o bin/o/win32/icon.o

i686-w64-mingw32.static-gcc -o bin/release/z64font.exe `./common.sh` \
-municode -DZ64FONT_GUI \
`wowlib/deps/wow_gui_win32.sh` \
bin/o/win32/icon.o

Loading

0 comments on commit cbef1fd

Please sign in to comment.