/* This function computes and returns the width of the Unicode character specified by UnicodeChar. */
UINTN EFIAPI GetGlyphWidth(IN CHAR16 UnicodeChar)
/* This function computes and returns the width of the Unicode character specified by UnicodeChar. */
UINTN EFIAPI GetGlyphWidth(IN CHAR16 UnicodeChar)
{
  UINTN                      Index;
  UINTN                      Low;
  UINTN                      High;
  CONST UNICODE_WIDTH_ENTRY  *Item;
  Item = NULL;
  Low  = 0;
  High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
  while (Low <= High) {
    Index = (Low + High) >> 1;
    Item  = &(mUnicodeWidthTable[Index]);
    if (Index == 0) {
      if (UnicodeChar <= Item->WChar) {
        break;
      }
      return 0;
    }
    if (UnicodeChar > Item->WChar) {
      Low = Index + 1;
    } else if (UnicodeChar <= mUnicodeWidthTable[Index - 1].WChar) {
      High = Index - 1;
    } else {
      break;
    }
  }
  if (Low <= High) {
    return Item->Width;
  }
  return 0;
}