16#define NARROW_CHAR 0xFFF0
17#define WIDE_CHAR 0xFFF1
23 { (CHAR16)0x1FFF, 1 },
71 { (CHAR16)0x2FFF, 1 },
104 { (CHAR16)0x33FF, 2 },
128 { (CHAR16)0x9FFF, 2 },
146 { (CHAR16)0xABFF, 0 },
151 { (CHAR16)0xD7FF, 2 },
168 { (CHAR16)0xDFFF, 0 },
173 { (CHAR16)0xF8FF, 0 },
178 { (CHAR16)0xFAFF, 2 },
179 { (CHAR16)0xFB4F, 1 },
180 { (CHAR16)0xFDFF, 1 },
181 { (CHAR16)0xFE1F, 0 },
182 { (CHAR16)0xFE2F, 1 },
183 { (CHAR16)0xFE4F, 2 },
184 { (CHAR16)0xFE6F, 1 },
185 { (CHAR16)0xFEFF, 1 },
186 { (CHAR16)0xFFEF, 1 },
187 { (CHAR16)0xFFFF, 0 },
206 IN CHAR16 UnicodeChar
217 while (Low <= High) {
218 Index = (Low + High) >> 1;
219 Item = &(mUnicodeWidthTable[Index]);
221 if (UnicodeChar <= Item->WChar) {
228 if (UnicodeChar > Item->WChar) {
230 }
else if (UnicodeChar <= mUnicodeWidthTable[Index - 1].WChar) {
272 if (String ==
NULL) {
277 while (*String != 0) {
317 UINTN IncrementValue;
319 if (String ==
NULL) {
331 for ( ; (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {
332 Count = Count + IncrementValue;
334 if (LimitLen && (Count > MaxWidth)) {
342 if (String[Index] == 0) {
346 if (LimitLen && (Count > MaxWidth)) {
355 if (String[Index] == NARROW_CHAR) {
368 }
while (String[Index] != 0);
370 return Count *
sizeof (CHAR16);
422 while ((String =
VA_ARG (Args, CHAR16 *)) !=
NULL) {
432 ASSERT (NumberOfLines != 0);
437 ASSERT (MaxLength != 0);
447 CopyMem (&SavedConsoleMode, ConOut->Mode, sizeof (SavedConsoleMode));
452 ConOut->QueryMode (ConOut, SavedConsoleMode.
Mode, &Columns, &Rows);
457 ConOut->EnableCursor (ConOut,
FALSE);
458 ConOut->SetAttribute (ConOut, Attribute);
463 NumberOfLines =
MIN (NumberOfLines, Rows - 3);
468 MaxLength =
MIN (MaxLength, Columns - 2);
473 Row = (Rows - (NumberOfLines + 3)) / 2;
474 Column = (Columns - (MaxLength + 2)) / 2;
482 ASSERT (Line !=
NULL);
489 SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
490 Line[0] = BOXDRAW_DOWN_RIGHT;
491 Line[MaxLength + 1] = BOXDRAW_DOWN_LEFT;
492 Line[MaxLength + 2] = L
'\0';
493 ConOut->SetCursorPosition (ConOut, Column, Row++);
494 ConOut->OutputString (ConOut, Line);
500 while ((String =
VA_ARG (Args, CHAR16 *)) !=
NULL && NumberOfLines > 0) {
501 SetMem16 (Line, (MaxLength + 2) * 2, L
' ');
502 Line[0] = BOXDRAW_VERTICAL;
503 Line[MaxLength + 1] = BOXDRAW_VERTICAL;
504 Line[MaxLength + 2] = L
'\0';
505 ConOut->SetCursorPosition (ConOut, Column, Row);
506 ConOut->OutputString (ConOut, Line);
508 if (Length <= MaxLength) {
512 ConOut->SetCursorPosition (ConOut, Column + 1 + (MaxLength - Length) / 2, Row++);
513 ConOut->OutputString (ConOut, String);
521 if (TmpString ==
NULL) {
522 ASSERT (TmpString !=
NULL);
526 StrnCpyS (TmpString, Length + 1, String, Length - 3);
527 StrCatS (TmpString, Length + 1, L
"...");
529 ConOut->SetCursorPosition (ConOut, Column + 1, Row++);
530 ConOut->OutputString (ConOut, TmpString);
542 SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
543 Line[0] = BOXDRAW_UP_RIGHT;
544 Line[MaxLength + 1] = BOXDRAW_UP_LEFT;
545 Line[MaxLength + 2] = L
'\0';
546 ConOut->SetCursorPosition (ConOut, Column, Row++);
547 ConOut->OutputString (ConOut, Line);
557 ConOut->EnableCursor (ConOut, SavedConsoleMode.
CursorVisible);
559 ConOut->SetAttribute (ConOut, SavedConsoleMode.
Attribute);
567 if (!EFI_ERROR (Status)) {
574 if (Status != EFI_NOT_READY) {
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
RETURN_STATUS EFIAPI StrnCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
VOID *EFIAPI SetMem16(OUT VOID *Buffer, IN UINTN Length, IN UINT16 Value)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
UINTN UefiLibGetStringWidth(IN CHAR16 *String, IN BOOLEAN LimitLen, IN UINTN MaxWidth, OUT UINTN *Offset)
UINTN EFIAPI UnicodeStringDisplayLength(IN CONST CHAR16 *String)
UINTN EFIAPI GetGlyphWidth(IN CHAR16 UnicodeChar)
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define VA_ARG(Marker, TYPE)
#define VA_START(Marker, Parameter)
#define GLOBAL_REMOVE_IF_UNREFERENCED
EFI_SIMPLE_TEXT_INPUT_PROTOCOL * ConIn
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut