]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Application/UiApp/String.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Application / UiApp / String.c
CommitLineData
143f0b1d
ED
1/** @file\r
2 String support\r
3\r
afc244a5 4Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
143f0b1d
ED
6\r
7**/\r
8\r
9#include "Ui.h"\r
143f0b1d
ED
10#include "FrontPage.h"\r
11\r
12EFI_HII_HANDLE gStringPackHandle;\r
13\r
14EFI_GUID mUiStringPackGuid = {\r
15 0x136a3048, 0x752a, 0x4bf6, { 0xa7, 0x57, 0x9, 0x36, 0x11, 0x95, 0x38, 0xed }\r
16};\r
17\r
c9802c45
ED
18EFI_GUID mFontPackageGuid = {\r
19 0x78941450, 0x90ab, 0x4fb1, {0xb7, 0x5f, 0x58, 0x92, 0x14, 0xe2, 0x4a, 0xc}\r
20};\r
21\r
22#define NARROW_GLYPH_NUMBER 8\r
23#define WIDE_GLYPH_NUMBER 75\r
24\r
25typedef struct {\r
26 ///\r
27 /// This 4-bytes total array length is required by HiiAddPackages()\r
28 ///\r
29 UINT32 Length;\r
30\r
31 //\r
32 // This is the Font package definition\r
33 //\r
34 EFI_HII_PACKAGE_HEADER Header;\r
35 UINT16 NumberOfNarrowGlyphs;\r
36 UINT16 NumberOfWideGlyphs;\r
37 EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];\r
38 EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];\r
39} FONT_PACK_BIN;\r
40\r
41FONT_PACK_BIN mFontBin = {\r
42 sizeof (FONT_PACK_BIN),\r
43 {\r
44 sizeof (FONT_PACK_BIN) - sizeof (UINT32),\r
45 EFI_HII_PACKAGE_SIMPLE_FONTS,\r
46 },\r
47 NARROW_GLYPH_NUMBER,\r
48 0,\r
49 { // Narrow Glyphs\r
50 {\r
51 0x05d0,\r
52 0x00,\r
53 {\r
54 0x00,\r
55 0x00,\r
56 0x00,\r
57 0x4E,\r
58 0x6E,\r
59 0x62,\r
60 0x32,\r
61 0x32,\r
62 0x3C,\r
63 0x68,\r
64 0x4C,\r
65 0x4C,\r
66 0x46,\r
67 0x76,\r
68 0x72,\r
69 0x00,\r
70 0x00,\r
71 0x00,\r
72 0x00\r
73 }\r
74 },\r
75 {\r
76 0x05d1,\r
77 0x00,\r
78 {\r
79 0x00,\r
80 0x00,\r
81 0x00,\r
82 0x78,\r
83 0x7C,\r
84 0x0C,\r
85 0x0C,\r
86 0x0C,\r
87 0x0C,\r
88 0x0C,\r
89 0x0C,\r
90 0x0C,\r
91 0x0C,\r
92 0x7E,\r
93 0x7E,\r
94 0x00,\r
95 0x00,\r
96 0x00,\r
97 0x00\r
98 }\r
99 },\r
100 {\r
101 0x05d2,\r
102 0x00,\r
103 {\r
104 0x00,\r
105 0x00,\r
106 0x00,\r
107 0x78,\r
108 0x7C,\r
109 0x0C,\r
110 0x0C,\r
111 0x0C,\r
112 0x0C,\r
113 0x0C,\r
114 0x0C,\r
115 0x1C,\r
116 0x3E,\r
117 0x66,\r
118 0x66,\r
119 0x00,\r
120 0x00,\r
121 0x00,\r
122 0x00\r
123 }\r
124 },\r
125 {\r
126 0x05d3,\r
127 0x00,\r
128 {\r
129 0x00,\r
130 0x00,\r
131 0x00,\r
132 0x7E,\r
133 0x7E,\r
134 0x0C,\r
135 0x0C,\r
136 0x0C,\r
137 0x0C,\r
138 0x0C,\r
139 0x0C,\r
140 0x0C,\r
141 0x0C,\r
142 0x0C,\r
143 0x0C,\r
144 0x00,\r
145 0x00,\r
146 0x00,\r
147 0x00\r
148 }\r
149 },\r
150 {\r
151 0x05d4,\r
152 0x00,\r
153 {\r
154 0x00,\r
155 0x00,\r
156 0x00,\r
157 0x7C,\r
158 0x7E,\r
159 0x06,\r
160 0x06,\r
161 0x06,\r
162 0x06,\r
163 0x66,\r
164 0x66,\r
165 0x66,\r
166 0x66,\r
167 0x66,\r
168 0x66,\r
169 0x00,\r
170 0x00,\r
171 0x00,\r
172 0x00\r
173 }\r
174 },\r
175 {\r
176 0x05d5,\r
177 0x00,\r
178 {\r
179 0x00,\r
180 0x00,\r
181 0x00,\r
182 0x3C,\r
183 0x3C,\r
184 0x0C,\r
185 0x0C,\r
186 0x0C,\r
187 0x0C,\r
188 0x0C,\r
189 0x0C,\r
190 0x0C,\r
191 0x0C,\r
192 0x0C,\r
193 0x0C,\r
194 0x00,\r
195 0x00,\r
196 0x00,\r
197 0x00\r
198 }\r
199 },\r
200 {\r
201 0x05d6,\r
202 0x00,\r
203 {\r
204 0x00,\r
205 0x00,\r
206 0x00,\r
207 0x38,\r
208 0x38,\r
209 0x1E,\r
210 0x1E,\r
211 0x18,\r
212 0x18,\r
213 0x18,\r
214 0x18,\r
215 0x18,\r
216 0x18,\r
217 0x18,\r
218 0x18,\r
219 0x00,\r
220 0x00,\r
221 0x00,\r
222 0x00\r
223 }\r
224 },\r
225 {\r
226 0x0000,\r
227 0x00,\r
228 {\r
229 0x00,\r
230 0x00,\r
231 0x00,\r
232 0x00,\r
233 0x00,\r
234 0x00,\r
235 0x00,\r
236 0x00,\r
237 0x00,\r
238 0x00,\r
239 0x00,\r
240 0x00,\r
241 0x00,\r
242 0x00,\r
243 0x00,\r
244 0x00,\r
245 0x00,\r
246 0x00,\r
247 0x00\r
248 }\r
249 }\r
250 }\r
251};\r
252\r
143f0b1d
ED
253/**\r
254 Initialize HII global accessor for string support.\r
255\r
256**/\r
257VOID\r
258InitializeStringSupport (\r
259 VOID\r
260 )\r
261{\r
262 gStringPackHandle = HiiAddPackages (\r
263 &mUiStringPackGuid,\r
264 gImageHandle,\r
265 UiAppStrings,\r
266 NULL\r
267 );\r
268 ASSERT (gStringPackHandle != NULL);\r
269}\r
270\r
3194d76f
DB
271/**\r
272 Remove the string package.\r
273\r
274**/\r
143f0b1d
ED
275VOID\r
276UninitializeStringSupport (\r
277 VOID\r
278 )\r
279{\r
280 HiiRemovePackages (gStringPackHandle);\r
281}\r
282\r
283/**\r
284 Get string by string id from HII Interface\r
285\r
286\r
287 @param Id String ID.\r
288\r
289 @retval CHAR16 * String from ID.\r
290 @retval NULL If error occurs.\r
291\r
292**/\r
293CHAR16 *\r
294GetStringById (\r
295 IN EFI_STRING_ID Id\r
296 )\r
297{\r
298 return HiiGetString (gStringPackHandle, Id, NULL);\r
299}\r
c9802c45
ED
300\r
301/**\r
302 Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.\r
303\r
304**/\r
305EFI_HII_HANDLE\r
306ExportFonts (\r
307 VOID\r
308 )\r
309{\r
310 return HiiAddPackages (\r
311 &mFontPackageGuid,\r
312 gImageHandle,\r
313 &mFontBin,\r
314 NULL\r
315 );\r
316}\r