Tutorial Mi Band 4/5 | How to modify Font file

MagicalUnicorn

Moderator
Staff member
Moderator
Developer
Joined
Jul 4, 2018
Messages
4,714
Likes
4,122
Points
248
#1
How to modify Mi Band 4/5 Font file ?
(At your own risk... We aren't responsible for bricked devices and we won't help in case of other problems)


You don't understand the instructions or you never used CMD/Terminal, use your web browser or don't use the tool.

No question about CMD/Terminal


IMPORTANT
In the decompiled Font folders, edit/add/delete all pictures you want.
Delete picture(s) isn't recommended !
★ Do NOT change size of pictures !
★ Added picture(s) must have exactly same size and format as other already present !



STEP 1
⤳ Download the zip archive : Mi Band 4&5 - Font modification.
⤳ Extract files from .zip archive where you want (Archive contain the tool, the two official fonts (v1 & v2 Beta), and custom Fonts with emoticons).


STEP 2
★ Install Python :
⤳ Command (Terminal) : sudo apt-get install python3.
⤳ Download Python : python.org (Click on the version you want, scroll down and choose "Windows x86-64 executable installer").
⤳ Execute the downloaded file and don't forget check "Add Python to PATH" at installation !


STEP 3
★ Install Pillow:
⤳ Command (Terminal) : sudo apt-get install python3-pil.
★ If you installed Python 3.8.0 :
⤳ Download Pillow.zip and extract "Pillow-6.2.0-cp38-cp38-win_amd64.whl" from it.
⤳ Command (CMD) : pip install Pillow-6.2.0-cp38-cp38-win_amd64.whl.

★ If you installed an older Python version than 3.8.0 :
⤳ Command (CMD) : pip install Pillow.


STEP 4
★ Unpack/Pack your Mi Band 4/5 Font file :
★ Unpack :
⤳ Command (Terminal - Font v1) : ./mi4font.py unpack Mili_cinco.ft.
⤳ Command (Terminal - Font v2) : ./mi4font2.py unpack Mili_cinco.ft.

★ Pack :
⤳ Command (Terminal - Font v1) : ./mi4font.py pack Mili_cinco.ft.
⤳ Command (Terminal - Font v2) : ./mi4font2.py pack Mili_cinco.ft.
★ Unpack :
⤳ Command (CMD - Font v1) : python mi4font.py unpack Mili_cinco.ft.
⤳ Command (CMD - Font v2) : python mi4font2.py unpack Mili_cinco.ft.

★ Pack :
⤳ Command (CMD - Font v1) : python mi4font.py pack Mili_cinco.ft.
⤳ Command (CMD - Font v2) : python mi4font2.py pack Mili_cinco.ft.

No question about CMD/Terminal


CREDITS
⤳ Custom Font v1 - Emoticons & Accented letters: GeekDoing.
⤳ Custom Font v1 - Emoticons HD & Accented letters: GeekDoing.
⤳ Custom Font v2 - Emoticons: GeekDoing.

⤳ mi4font.py: @McArrow (Post #378).

⤳ mi4font2.py:
@McArrow for unpack part (Post #37).
@MagicalUnicorn & xCape for pack part.


Post only in English, else it will be deleted.
 

Attachments

Last edited:
Joined
Oct 7, 2019
Messages
18
Likes
44
Points
13
#11
a small addition to the instruction:
after unpacking there should be 2 folders - "bmp-mib4" and "bmp-mib4-fixed"
images in the "bmp-mib4-fixed" folder have width of 16 pixels, but the bracelet displays only the first 10 pixels. font from this folder is small and used for languages other than chinese and english, and you can not change width of characters.
images in the "bmp-mib4" folder have width of 24 pixels and the last two characters in the file name specify the character width(in hex). font from this folder is used for chinese and english, and you can change width of characters.
 
Joined
Sep 6, 2019
Messages
53
Likes
27
Points
18
#12
I'd like to use bigger proportional font (24x24 px) also for my language (CZ).
Fixed 16x20 is too small for my eyes... :(

My idea is to add missing latin characters to the first font set and prepare custom RES with our language placed also instead of english...

Another problem is the character "@" doesn't display correctly with "other" languages.

 
Joined
Oct 7, 2019
Messages
18
Likes
44
Points
13
#13
I'd like to use bigger proportional font (24x24 px) also for my language (CZ).
Fixed 16x20 is too small for my eyes... :(

My idea is to add missing latin characters to the first font set and prepare custom RES with our language placed also instead of english...
You can't do this.
The font file is used for notifications only.
All menu labels and strings use the font from the Res file.

But you can swap chinese.
 
Joined
Aug 20, 2019
Messages
27
Likes
15
Points
8
#14
You can't do this.
The font file is used for notifications only.
All menu labels and strings use the font from the Res file.

But you can swap chinese.
I think menu is use font same notification but I don't know in another language. Because I can change the font menu that I attached.

 
Joined
Sep 6, 2019
Messages
53
Likes
27
Points
18
#15
You can't do this.
The font file is used for notifications only.
All menu labels and strings use the font from the Res file.

But you can swap chinese.
Yes, the font is used mainly for notifications... and also somewhere else e.g. the weater location, etc.

The menu is part of RES, that's why I mentioned to prepare custom RES with desired language customisation placed over EN. Then force band language to EN... only in this case the bigger font would be used and menu still in own language.
 
Joined
Oct 7, 2019
Messages
18
Likes
44
Points
13
#17
Yes, the font is used mainly for notifications... and also somewhere else e.g. the weater location, etc.

The menu is part of RES, that's why I mentioned to prepare custom RES with desired language customisation placed over EN. Then force band language to EN... only in this case the bigger font would be used and menu still in own language.
if your language does not use letters other than the English alphabet, then yes. otherwise there will be blank spaces instead of letters.
as i stated in this thread, for the English translation a separate truncated chartable is used, only with latin letters.
 
Joined
Aug 20, 2019
Messages
27
Likes
15
Points
8
#18
I tried to non-latin font in English language and It's work !!,
You can add missing font in latin as you as you want, But must be 24x24 pixel and XXXXXYY.bmp
XXXXX = utf-8 code
YY = pixel width in hex
 

nin187

New member
Joined
Oct 17, 2019
Messages
2
Likes
2
Points
3
#19
Hey, I've modified V1 font to support Korean & Japanese half width katakana by following the instructions on this post.

Download

Supports
Mi band 4 Chinese & Gloval version

Supported languages
Korean
Japanese(including half width katakana)
Chinese
English
Spanish
Russian
...etc.

Tested with
Mi band 4 Chinese version / firm v1.0.6.16+res v62 & firm v1.0.7.20+res v70
iPhone xs v13.2 beta3 / Mi Fit v4.0.9 / AmazTools v1.0.3
Galaxy S7 Android 8.0.0 / Mi Fit v4.0.10 / Notify & Fitness for Mi Band v8.14.10

Screenshots

 

Attachments

Last edited:

MSDarwish

New member
Joined
Oct 26, 2019
Messages
1
Likes
2
Points
3
#20
Hello,

I didn't notice this topic and thought that there ware no tools available for unpacking NEZK fonts (Fonts of Mi Band 4), so I've spent sometime trying to get the full format of it, and now I think it may be helpful if I shared it with you


HEADER {
4-byte MAGIC WORD (NEZK : 4E 45 5A 4B)
1-byte FONT VERSION
5-byte FF
4-byte ?? (03 00 00 00 OR 06 00 00 00)
14-byte FF
4-byte 24PX CHARS LENGTH (+ 32-byte (HEADER) = START OF 16PX CHARS)
}

24PX CHARS {
2-byte REGIONS COUNT
REGIONS ARRAY {
2-byte STARTING UNICODE
2-byte ENDING UNICODE
2-byte STARTING BITMAP INDEX
}
BITMAPS ARRAY {
## NEZK 1 ## {
72-byte BITMAP (WIDTH 24PX x HEIGHT 24PX)
1-byte WIDTH??
} OR
## NEZK 2 ## {
54-byte BITMAP (WIDTH 24PX x HEIGHT 18PX)
}
}
}

16PX CHARS {
2-byte REGIONS COUNT
REGIONS ARRAY {
2-byte STARTING UNICODE
2-byte ENDING UNICODE
2-byte STARTING BITMAP INDEX
}
BITMAPS ARRAY {
40-byte BITMAP (WIDTH 16PX x HEIGHT 20PX)
}
}

As you can see I'm not pretty sure about that width byte in 24px chars region in version 1 which is described in the posted tool as margin top (I suspect that though). Also I can't define that int in the header.
The only difference between v1 and v2 is in bitmaps of 24px region.
Using this information I think someone could improve the posted tool to support v2 and to make it possible to add new characters (I can't see the reason of this limitation as the file is simple), but sadly I have no time to do that now.

Any question or comment is welcome

Good luck
 

Trusted Store

Members online

No members online now.

Our Telegram Channel

Which color of official strap would you like to buy for your Mi Band 3?

  • Black

    Votes: 2,156 52.8%
  • Deep Blue

    Votes: 1,198 29.3%
  • Redish Orange

    Votes: 729 17.9%

Forum statistics

Threads
2,457
Messages
40,626
Members
212,013
Latest member
gf64
Top