Embedded SDK
Embedded SDK
ux_loc_bagl.h
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Ledger Nano S - Secure firmware
4  * (c) 2022 Ledger
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  ********************************************************************************/
18 
19 #pragma once
20 
21 #if defined(HAVE_LANGUAGE_PACK)
22 // Structure used for language packs:
23 typedef struct language_pack {
24  uint32_t target_id; // 0x33000004:NanoX, 0x31100004:NanoS 1.5.x etc
25  uint16_t language; // Language contained in this pack (<NB_LANG)
26  uint16_t nb_strings; // MUST be the same than NB_BOLOS_UX_LOC_STRINGS
27  uint16_t nb_fonts; // Number of fonts
28  uint16_t nb_characters; // Number of unicode characters in each font
29  uint16_t characters_offset; // Offset to the characters x nb_fonts
30  uint16_t fonts_offset; // Offset to the bagl_font_unicode_t structures
31  uint16_t bitmaps_offset; // Offset to the bitmaps x nb_fonts
32  uint16_t bolos_version_offset; // Offset to the Bolos version number string
33  uint16_t pack_version_offset; // Offset to the Language Pack version number string
34  uint16_t offsets[]; // Offsets from the BEGINNING of the language pack
36 
37 // A language pack is a binary file containing:
38 /*
39 - the language pack header, including infos about used fonts & glyphs
40 - offsets for each string (2 x nb_strings), from the beginning of the pack!
41 - 2 bytes padding if nb_strings is odd
42 - bagl_font_unicode_character_t x nb_characters x 3 fonts
43 - bagl_font_unicode_t x 3 fonts
44 - bitmap data for font 1
45 - bitmap data for font 2
46 - bitmap data for font 3
47 - a NULL terminated string containing Bolos version number
48 - a NULL terminated string containing Language Pack version number
49 - all strings, concatenated.
50 
51 NB:
52 - there are 197 countries in the world, so 1 byte might be enough to store language information,
53 unless we plan to integrate dialects (>7000) => use a u_int16_t;
54 - we may store some CRC, to check language pack's integrity.
55 */
56 #endif // defined(HAVE_LANGUAGE_PACK)
#define LANGUAGE_PACK
Definition: nbgl_fonts.h:29
unsigned short uint16_t
Definition: usbd_conf.h:54