Embedded SDK
Embedded SDK
ux_loc_nbgl.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 #include "nbgl_types.h"
22 
23 #if defined(HAVE_LANGUAGE_PACK)
24 // Structure used for language packs:
25 typedef struct language_pack {
26  uint32_t target_id; // 0x33000004:NanoX, 0x31100004:NanoS 1.5.x etc
27  uint16_t language; // Language contained in this pack (<NB_LANG)
28  uint16_t nb_strings; // MUST be the same than NB_BOLOS_UX_LOC_STRINGS
29  uint16_t nb_fonts; // Number of fonts
30  uint16_t nb_characters; // Number of unicode characters in each font
31  uint16_t characters_offset; // Offset to the characters x nb_fonts
32  uint16_t fonts_offset; // Offset to the nbgl_font_unicode_t structures
33  uint16_t bitmaps_offset; // Offset to the bitmaps x nb_fonts
34  uint16_t bolos_version_offset; // Offset to the Bolos version number string
35  uint16_t pack_version_offset; // Offset to the Language Pack version number string
36  uint16_t offsets[]; // Offsets from the BEGINNING of the language pack
38 
39 // A language pack is a binary file containing:
40 /*
41 - the language pack header, including infos about used fonts & glyphs
42 - offsets for each string (2 x nb_strings), from the beginning of the pack!
43 - 2 bytes padding if nb_strings is odd
44 - nbgl_font_unicode_character_t x nb_characters x 4 fonts
45 - nbgl_font_unicode_t x 4 fonts
46 - bitmap data for font 1
47 - bitmap data for font 2
48 - bitmap data for font 3
49 - bitmap data for font 4
50 - a NULL terminated string containing Bolos version number
51 - a NULL terminated string containing Language Pack version number
52 - all strings, concatenated.
53 
54 NB:
55 - there are 197 countries in the world, so 1 byte might be enough to store language information,
56 unless we plan to integrate dialects (>7000) => use a u_int16_t;
57 - we may store some CRC, to check language pack's integrity.
58 */
59 
60 typedef unsigned short UX_LOC_STRINGS_INDEX;
61 
62 #endif // defined(HAVE_LANGUAGE_PACK)
#define LANGUAGE_PACK
Definition: nbgl_fonts.h:29
common types for Graphical Library
unsigned short uint16_t
Definition: usbd_conf.h:54
BOLOS_UX_LOC_STRINGS UX_LOC_STRINGS_INDEX