Table of Contents
This page has moved
⚠ The wiki has been replaced by the new website - this page has been moved: https://gadgetbridge.org/internals/specifics/mi-band-2/#font-format
The Mi Band 2 uses a special Font format, which is documented below:
Overview
The HMZK Format has three sections:
- Header
- Character section, an array of the characters available in the font in order
- Bitmap section, a list of 16x16 bitmaps in the same order as the Character Section
Header
The file starts with a 16 byte header:
484d 5a4b 01ff ffff ffff ffff ffff 7438
The first two bytes (484d 5a4b
) are the "magic number" and spell out "HMZK" in ascii (possibly means HuaMi ZiKu, HuaMi character library)
The next five bytes (01ff ffff ffff ffff ffff
in the chinese font, 01ff ffff ff00 ffff ffff
in the english font) are of an unknown purpose, likely just padding.
The last two bytes are a 16bit little-endian integer describing the offset of the bitmap section from the character section in bytes (to find the absolute location of the bitmap section, add 16 to this number). This value can also be interpreted as length of the character section in bytes.
Character Section
This Section contains an array of 16bit (widechar) values:
2000 2100 2200 2300 2400 2500 2600 2700
Each of these elements is a little endian utf-16 like encoded character (note: UTF-16 specifies prefix bytes e.g. 0xFF 0xFE
. These are omitted here)
Bitmap Section
0000 0000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 0000 0000 1000 1000
Each Bitmap consists of 16 16bit big endian (!!!) values. Each 16bit value represents one row of the bitmap. The above thus expands to:
................
................
...#............
...#............
...#............
...#............
...#............
...#............
...#............
...#............
...#............
...#............
................
................
...#............
...#............
Font Editor
CBiX/bitsnpicas-hmzk; modified version of kreativekorp/bitsnpicas to support importing and exporting HMZK fonts based on this specification. This can be used to either extend the original fonts with custom characters or convert existing bitmap fonts from the supported file formats for the Mi Band 2.
If you want to use other (more powerful) bitmap font editors (e.g. FontForge), you could use .bdf as an exchange format. However, be careful to export it with as close to 16x16 as possible and with little to no ascent/descent, as HMZK is fixed to 16x16 and fonts might look odd or cut off otherwise. Also the amount of possible characters is limited. Not sure about the hard limit, but try to stay within the size of the original chinese font, which contains 7226 characters. This is also used as a hard limit for export in bitsnpicas-hmzk for security reasons.
NEW WEBSITE
General
- Home
- FAQ
- ReadMe
- Configuration
- Notifications
- ChangeLog
- Widget
- Weather
- Data Backup
- Pairing
- Find phone
- Music info
- Permissions Explained
- Firmware Update
- Automation via Intents
Sports/Activities
- Sports Activities Workouts
- Activity Sessions List
- Activity and Sleep Charts
- Heartrate measurement
- Integrating Sports Tracking apps with Gadgetbridge Sports Activities/Workouts
Smart Device Related
- Bangle.js
- Casio devices
- FitPro
- Fossil Hybrid HR
- Garmin devices
- HPlus
- Huami devices
- Amazfit Active
- Amazfit Active Edge
- Amazfit Balance
- Amazfit Band 5
- Amazfit Band 7
- Amazfit Bip
- Amazfit Bip Lite
- Amazfit Bip S
- Amazfit Bip U
- Amazfit Bip 3 Pro
- Amazfit Bip 5
- Amazfit Cheetah
- Amazfit Cheetah Pro
- Amazfit Cor
- Amazfit Cor 2
- Amazfit Falcon
- Amazfit GTR
- Amazfit GTR 3
- Amazfit GTR 3 Pro
- Amazfit GTR 4
- Amazfit GTR Mini
- Amazfit GTS
- Amazfit GTS 3
- Amazfit GTS 4
- Amazfit GTS 4 Mini
- Amazfit Neo
- Amazfit T-Rex
- Amazfit T-Rex 2
- Amazfit T-Rex Ultra
- Mi Band 1
- Mi Band 2
- Mi Band 3
- Mi Band 4
- Mi Band 5
- Mi Band 6
- Mi Band 7
- MyKronoz ZeTime
- Pebble
- PineTime
- Sony Wena 3
- SMA
- WithingsSteel
Wireless Earbuds
Others
- iTag Keyring trackers
- Nut Keyring trackers
- UM25 USB Voltage meter
- VESC BLDC controller VESC
- Flipper Zero Multi-tool Device for Geeks
- Roidmi Roidmi/Mojietu FM Trans.
- Vibratissimo Private toy
- Shell Racing Toy RC cars
- Femometer Vinca II
Full list of supported devices
Development
- How to Release
- Developer Documentation
- BT Protocol Reverse Engineering
- Support for a new Device
- New Device Tutorial
- Translating Gadgetbridge
- OpenTracks-API
- Intent-API
Feature Discussion
FAQ