Important information: this site is currently scheduled to go offline indefinitely by end of the year.

[PC] Nights of Azure - Modifing Font

Need help translating games in other languages? Have your language problems solved here.
Post Reply
User avatar
marcussacana
beginner
Posts: 35
Joined: Wed Jul 22, 2015 10:08 pm
Has thanked: 10 times
Been thanked: 13 times

[PC] Nights of Azure - Modifing Font

Post by marcussacana »

I'm trying modify the font of the Nights of Azure, I take a look in the russian translation and I found a thing,
the glyph coordinates are in the game exe, I tried discovery by myself about the font table structure, and I know this:

Code: Select all

//CNN: 0x9F9BF0 = Font Table
struct Glyph {
	public uint UTF8;//Reversed
	public ushort X;
	public ushort Y;
	public ushort Width;
	public ushort Height;
	public uint Unk2;//1?
	public uint Unk3;//2?
	public uint Unk4;//Padding? Width+1
	public uint Unk5;//0
}
It's probabbly 99% of sure that all unk values are padding, but I don't understand how padding works very well... is there any tool, or someone can see what is those unks to help me Write something?
User avatar
marcussacana
beginner
Posts: 35
Joined: Wed Jul 22, 2015 10:08 pm
Has thanked: 10 times
Been thanked: 13 times

Re: [PC] Nights of Azure - Modifing Font

Post by marcussacana »

After sleep my brain worked again and I finished the tool, sorry for this post.
My final Strcuture

Code: Select all

 //CNN v1.1: 0x9F9BF0 = Font Table
        struct Glyph
        {
            public uint UTF8;
            public ushort X;
            public ushort Y;
            public ushort Width;
            public ushort Height;
            public int PaddingLeft;
            public int PaddingTop;
            public int PaddingRigth;
            public int PaddingBottom;

            public Bitmap Texture;
            public char Char {
                get {
                    if (UTF8 == 0)
                        return char.MinValue;
                    var Bytes = BitConverter.GetBytes(UTF8);
                    while (Bytes.Last() == 0)
                        Array.Resize(ref Bytes, Bytes.Length - 1);
                    Bytes = Bytes.Reverse().ToArray();

                    return Encoding.UTF8.GetString(Bytes).Single();
                } set {
                    var Bytes = Encoding.UTF8.GetBytes(value.ToString());
                    Bytes = Bytes.Reverse().ToArray();

                    byte[] DW = new byte[4];
                    Bytes.CopyTo(DW, 0);

                    UTF8 = BitConverter.ToUInt32(DW, 0);
                }
            }
        }
        
Post Reply