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