4 Copyright (c) 2004 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "FrontPage.h"
18 #define NARROW_GLYPH_NUMBER 8
19 #define WIDE_GLYPH_NUMBER 75
21 EFI_GUID mFontPackageGuid
= {
22 0x78941450, 0x90ab, 0x4fb1, {0xb7, 0x5f, 0x58, 0x92, 0x14, 0xe2, 0x4a, 0xc}
27 /// This 4-bytes total array length is required by HiiAddPackages()
32 // This is the Font package definition
34 EFI_HII_PACKAGE_HEADER Header
;
35 UINT16 NumberOfNarrowGlyphs
;
36 UINT16 NumberOfWideGlyphs
;
37 EFI_NARROW_GLYPH NarrowArray
[NARROW_GLYPH_NUMBER
];
38 EFI_WIDE_GLYPH WideArray
[WIDE_GLYPH_NUMBER
];
41 FONT_PACK_BIN mFontBin
= {
42 sizeof (FONT_PACK_BIN
),
44 sizeof (FONT_PACK_BIN
) - sizeof (UINT32
),
45 EFI_HII_PACKAGE_SIMPLE_FONTS
,
254 Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.
262 EFI_HII_HANDLE HiiHandle
;
264 HiiHandle
= HiiAddPackages (
270 ASSERT (HiiHandle
!= NULL
);
274 Determine the current language that will be used
275 based on language related EFI Variables.
277 @param LangCodesSettingRequired - If required to set LangCode variable
282 BOOLEAN LangCodesSettingRequired
288 CHAR8 LangCode
[ISO_639_2_ENTRY_SIZE
];
291 CHAR8
*PlatformLangCodes
;
297 LangCodes
= (CHAR8
*)PcdGetPtr (PcdUefiVariableDefaultLangCodes
);
298 if (LangCodesSettingRequired
) {
299 if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate
)) {
301 // UEFI 2.1 depricated this variable so we support turning it off
303 Status
= gRT
->SetVariable (
305 &gEfiGlobalVariableGuid
,
306 EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
307 AsciiStrLen (LangCodes
),
313 PlatformLangCodes
= (CHAR8
*)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes
);
314 Status
= gRT
->SetVariable (
315 L
"PlatformLangCodes",
316 &gEfiGlobalVariableGuid
,
317 EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
318 AsciiStrSize (PlatformLangCodes
),
323 if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate
)) {
325 // UEFI 2.1 depricated this variable so we support turning it off
329 // Find current LangCode from Lang NV Variable
331 Size
= ISO_639_2_ENTRY_SIZE
;
332 Status
= gRT
->GetVariable (
334 &gEfiGlobalVariableGuid
,
339 if (!EFI_ERROR (Status
)) {
340 Status
= EFI_NOT_FOUND
;
341 for (Index
= 0; LangCodes
[Index
] != 0; Index
+= ISO_639_2_ENTRY_SIZE
) {
342 if (CompareMem (&LangCodes
[Index
], LangCode
, ISO_639_2_ENTRY_SIZE
) == 0) {
343 Status
= EFI_SUCCESS
;
350 // If we cannot get language code from Lang variable,
351 // or LangCode cannot be found from language table,
352 // set the mDefaultLangCode to Lang variable.
354 if (EFI_ERROR (Status
)) {
355 Lang
= (CHAR8
*)PcdGetPtr (PcdUefiVariableDefaultLang
);
356 Status
= gRT
->SetVariable (
358 &gEfiGlobalVariableGuid
,
359 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
360 ISO_639_2_ENTRY_SIZE
,
367 PlatformLang
= BdsLibGetVariableAndSize (L
"PlatformLang", &gEfiGlobalVariableGuid
, &Size
);
368 if (PlatformLang
!= NULL
) {
370 // Check Current PlatformLang value against PlatformLangCode. Need a library that is TBD
371 // Set Invalid based on state of PlatformLang.
374 FreePool (PlatformLang
);
376 // No valid variable is set
381 PlatformLang
= (CHAR8
*)PcdGetPtr (PcdUefiVariableDefaultPlatformLang
);
382 Status
= gRT
->SetVariable (
384 &gEfiGlobalVariableGuid
,
385 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
| EFI_VARIABLE_RUNTIME_ACCESS
,
386 AsciiStrSize (PlatformLang
),