From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.2576.1627949067568059978 for ; Mon, 02 Aug 2021 17:04:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=huYRRINI; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: hao.a.wu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10064"; a="235488363" X-IronPort-AV: E=Sophos;i="5.84,290,1620716400"; d="scan'208";a="235488363" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2021 17:04:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,290,1620716400"; d="scan'208";a="520796686" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga002.fm.intel.com with ESMTP; 02 Aug 2021 17:04:26 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Mon, 2 Aug 2021 17:04:26 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Mon, 2 Aug 2021 17:04:25 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Mon, 2 Aug 2021 17:04:25 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Mon, 2 Aug 2021 17:04:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yghq2B2x/41PSaiJHCp/s1jDhNqmJRBVmDqtYyES5JiqNp1PPbuzRO23l8xE3IDcRHFQwaF+CBQiBSXk7z5Bt1mAg1fbH7lbJlZ5BEgnxR3e3MVf4cAjnfdbD3SYv3SNmhCtackQbq6s9IFgZ56fOT2+140SgLYtODBPOjizuimIKx6MBLnkuy0AgLZWaRGHwcMvkxRo0ZlIHTY10qyJx0ntCmeO0gTp9f+YI8b+/q0RMH8Sq4oMl42CzQ7HlKhvju/PucdlvhwLuV/VBV6nLKbNOrNHEVtqrwed5LGKNWvTaTlZhjem+mvn4Bvb4L7RjWhl73yNBhT5l27vp1gXVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nvl/pbkVLcaMGwSBlH5IrRi1vVD++qm4ByMxPa1Wbmk=; b=OI4L/q4kCqwtxI625p6eGtIfZAXUMje4I62gB189YhElc8feqpnVvGdaQe0jdB0DbBIOIiIIsZID9BCDboo5/gvX/TGr5T0MIJCjemXSVsWKwfrE6cXyaV3Ye1kj2L2I7UnLzf2RLZLa8/YF4LcdnQj4FJay97LinYM2BQ0lEYf+npj7UvFIx75OrRx+XLfKgbF8eRzH/qyYDBTVpa6LhSPf2b+4Shr0a1lOR4UZ2+B0XSf4bPEX3ZxnxaM8ppliTkHfTKrMYGHlUZSi8E49TPA0zhAFrLe4KPfzfdE+br4/NleMxlUqrUh7JIa1H43/kqj5ue3mpiSG46lj85Y/8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nvl/pbkVLcaMGwSBlH5IrRi1vVD++qm4ByMxPa1Wbmk=; b=huYRRINIzuT2g4yzF/yfs9cMvbl9tfpE94CJcQo5HU1PD0HNPejfA72hZzFRwuNw+SCdTf7CAcqLd/Qvwq6/eHwUbaHVwdZ5U0RJNMjnLnXqgvLm5WYKZremkBpk0bBWQS3Qwbhw1bydVDeq2BkOV74hcJph7gNh+dXMTwsY6Jc= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN8PR11MB3617.namprd11.prod.outlook.com (2603:10b6:408:82::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.19; Tue, 3 Aug 2021 00:04:16 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::cd58:25ce:5017:619d]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::cd58:25ce:5017:619d%5]) with mapi id 15.20.4373.026; Tue, 3 Aug 2021 00:04:16 +0000 From: "Wu, Hao A" To: Caden Kline , "devel@edk2.groups.io" , "Gao, Zhichao" , "Ni, Ray" CC: "Wang, Jian J" Subject: Re: [PATCH 1/1] MdeModulePkg/Console: Improve encoding of box drawing characters Thread-Topic: [PATCH 1/1] MdeModulePkg/Console: Improve encoding of box drawing characters Thread-Index: AQHXhOz0KYgtXhrITE60Y84qqWRwhatg7Cvg Date: Tue, 3 Aug 2021 00:04:15 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8b8d5f1a-cb24-4617-1238-08d956123bde x-ms-traffictypediagnostic: BN8PR11MB3617: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:549; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rIC7TJHv57stWS4kYF2Z6+SmOuPDaDRMtNTqqh8MOj5/faD103GFAP/AWIAVQZzYuL8DZUaPD4qiU2FVrQAQSBgQlP1fsp6+1UyiiTAIF0XKtcPOILeH4BOcDYKUqIMdl7+GlN21lnwqgkoZ+KaGesSGYXuallYQLPMFj7QQ3G9bP2KJj/d7J9lcs8Dw/a12uOATOj9iurIqCNyIit+axxfVtxsNDExf5cstcXOhTEKj3UWoVNOOm9xkR5FpM/4oqEIQHnPVnGgvnx2O/MlqmuEqRpv9qC06iRRQSMffxnrPOv1ifYDKdHVoGJ3Q3ME+LRfbdEeZyIkkw8NVQZW1NMTLY93/20weFY3vm8ULrgvP8QQGYKT4t1i6Ai5/DQfaT4VJS50DEUI7GZuwQRaKI6RvteUc+TIENqR2euXPvJ1uJ7wNoeiHENq+iqaivH5U3OnZnQwKfVC+pDvVKjrw9e68OwOUNWcsN/LNyXJM3Qf7kHzelLpeIxs5LTmOUcAxr7Y6z74Cs9A1Gug4Wk9X6DGoRv+bESKMAACtHbGw+ffEpPluGoxx0KBYfMizOz9ykGgocfEuvg7n5zQ36ruvoKCfmViBZBCtEZZDwdY4DQXnDy00ZWx8YqGGir5P16Ko/8jrbbHXg+eHSd2O5YHHkope2M2z1agxIGcMv8v3hIWxDGo3i6ZHh3pKZy63H5OvB9UvRWGtdFrz4Oxtv/57AA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(346002)(136003)(366004)(6636002)(33656002)(52536014)(66446008)(30864003)(5660300002)(478600001)(71200400001)(86362001)(83380400001)(55016002)(9686003)(66556008)(64756008)(66946007)(66476007)(76116006)(38070700005)(26005)(107886003)(7696005)(8676002)(2906002)(316002)(4326008)(8936002)(38100700002)(6506007)(186003)(122000001)(53546011)(110136005)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wr/mPLgQ5yPsFxps/v9hFB/QlZOquuVatJ5n2DVIFpAfVe9TecOLgWta01jC?= =?us-ascii?Q?HfRVfLZ4pqJV6/LFMDlTlA7zZsAtNmp1kCMWhWi8x/Vt9xkXyTN5NiepQ16H?= =?us-ascii?Q?wuG6qBYUG74UV3I2fRXjOfCPdiw7gS3dqQk54EVL5jLyUY2hXbtvYN0pwuK4?= =?us-ascii?Q?s7rjBBpcFlS98BD4/Cf89hj/14i+7+YmX2teGYpmkrFwS9dqZ2xXKaW6m4Xz?= =?us-ascii?Q?5KK4RIb8ovzHiYamwajYMLRpab1HPUsCBzrK2qGFjHQdE57IqXGBkAJgPEA7?= =?us-ascii?Q?HRqZNGd9LljrSilVMqNGbubfcWl0YiHsftYtIB6rVMJkCDrLZk84LI3nQVuU?= =?us-ascii?Q?CSbVhXuVHzU4+CAhBKFA2PgjKzxE/v+PXuSNRj/yIbBaDnzHwKMIEzW/Jycc?= =?us-ascii?Q?XzDpzq31KCKfAZY3um1FH88MMNuva+MrP0k30DXXBgLaCprxyqGxM+wRga5t?= =?us-ascii?Q?hLNOmEPiPz6izQdjE6dQJD+PbOeImbslTD/MPFt/7TyEy6z+TkG881uj7C2n?= =?us-ascii?Q?HCnrbwzT0B1+FWDVeVwQQb1NtPKTG9O0kE0+FsrxCb+Q3kJZW0yHnmwxOc/N?= =?us-ascii?Q?aP1Ow+nTKqzZrXZN7wuFMvlzEY2n3vD12oKLmzWLQQoREaCWzNs1b0TSF75U?= =?us-ascii?Q?nLblH6ts3ixLlI2NB61OCZRk/rr92rlyQhsCzg8r9O4bKQzZkmQn4rdk/ncj?= =?us-ascii?Q?M7TyIE08Ig3pLYWYLjioZyqKb7WdoYHfmeUVm269C55W3wpE2mVZbU9If7jQ?= =?us-ascii?Q?/CpWFSep+beztoKGMaBDg1dYCDmJx9zuHWqLYzQjgB96u1/Y2+Hge897jfhM?= =?us-ascii?Q?OTgy1CZO35mFspFSSZrWbkX3J3TPL74bR5sZpcLGiriJ03mUzgWtD9raDxFf?= =?us-ascii?Q?1UVT6MMjkn62HPepEDUl0gTludrtec+a88ni0HZi8/TnSV/s9U7mnhi2lS5w?= =?us-ascii?Q?8RUdpmGQe4QE51VAQssXfJw6+Ft7sNcnO2RZnrLPccV6sHc7ylBtk9Rn/OFz?= =?us-ascii?Q?4yPmxnb3YSaX0MtKnxD6DU9wzcwpspxXqmP2upZNGiN29AYP8Tg49m5aht50?= =?us-ascii?Q?4JiSRNF8MNuQqyf+VdJnfVj6C7JdK10XTivICx0r2d8f/QO8xJsQIPx+iEZR?= =?us-ascii?Q?2i8AARDd/+XIZX9YifscsTConK7qXFR+TYqBTAnfj0VVCICIuerbjS9BccSU?= =?us-ascii?Q?0GU8hOzgVT0KfY4WME6FtXiSuSY07uaoEOzKD55woV/MgNPqjN63NJ3gpuxy?= =?us-ascii?Q?hu488c0JxQG/LgJD4yjDd9eJwTDvMFyL9CIiK1ICgxhBJYERhqgg3skE1G0h?= =?us-ascii?Q?DEdTrm5Mh0zedP4R2sbI9LgS?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b8d5f1a-cb24-4617-1238-08d956123bde X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2021 00:04:15.7378 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SRj/0PaRQC9xtKPLyYxV72D9AwqYSz4JE35ith5WtnqMe6DSyjRqoHYf15XLvuoRqiJqf1mL1d37WYi94H6DUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR11MB3617 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sorry Zhichao and Ray, Could you help to review this patch? Thanks in advance. Best Regards, Hao Wu > -----Original Message----- > From: Caden Kline > Sent: Friday, July 30, 2021 10:45 AM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A ; > Gao, Zhichao ; Ni, Ray > Subject: [PATCH 1/1] MdeModulePkg/Console: Improve encoding of box > drawing characters >=20 > Improved encoding of box drawing characters for different terminal types. > This includes Dec special graphics mode and more utf8. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Zhichao Gao > Cc: Ray Ni > Signed-off-by: Caden Kline > --- > .../Universal/Console/TerminalDxe/Terminal.h | 24 +- > .../Universal/Console/TerminalDxe/Ansi.c | 2 +- > .../Console/TerminalDxe/TerminalConOut.c | 322 ++++++++++++++---- > 3 files changed, 269 insertions(+), 79 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > index 360e58e84743..83c3ea94a042 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > @@ -122,7 +122,10 @@ typedef struct { > EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx; >=20 > LIST_ENTRY NotifyList; >=20 > EFI_EVENT KeyNotifyProcessEvent; >=20 > + BOOLEAN DecSpecialGraphicsMode; >=20 > } TERMINAL_DEV; >=20 > +// This the lenth the escape squences for entering and exiting Dec Speci= al > Graphics Mode >=20 > +#define LENGTH_DEC_ESCAPE 0x03 >=20 >=20 >=20 > #define INPUT_STATE_DEFAULT 0x00 >=20 > #define INPUT_STATE_ESC 0x01 >=20 > @@ -169,6 +172,7 @@ typedef struct { > UINT16 Unicode; >=20 > CHAR8 PcAnsi; >=20 > CHAR8 Ascii; >=20 > + CHAR8 DecSpecialGraphics; >=20 > } UNICODE_TO_CHAR; >=20 >=20 >=20 > // >=20 > @@ -1367,20 +1371,22 @@ Utf8ToUnicode ( > /** >=20 > Detects if a Unicode char is for Box Drawing text graphics. >=20 >=20 >=20 > - @param Graphic Unicode char to test. >=20 > - @param PcAnsi Optional pointer to return PCANSI equivalent of >=20 > - Graphic. >=20 > - @param Ascii Optional pointer to return ASCII equivalent of >=20 > - Graphic. >=20 > - >=20 > - @retval TRUE If Graphic is a supported Unicode Box Drawing cha= racter. >=20 > + @param Graphic Unicode char to test. >=20 > + @param PcAnsi Optional pointer to return PCANSI equivale= nt of >=20 > + Graphic. >=20 > + @param Ascii Optional pointer to return ASCII equivalen= t of >=20 > + Graphic. >=20 > + @param DecSpecialGraphics Optional pointer to return Dec Special Gra= phics > equivalent of >=20 > + Graphic. >=20 > + @retval TRUE If Graphic is a supported Unicode Box Draw= ing > character. >=20 >=20 >=20 > **/ >=20 > BOOLEAN >=20 > TerminalIsValidTextGraphics ( >=20 > IN CHAR16 Graphic, >=20 > - OUT CHAR8 *PcAnsi, OPTIONAL >=20 > - OUT CHAR8 *Ascii OPTIONAL >=20 > + OUT CHAR8 *PcAnsi, OPTIONAL >=20 > + OUT CHAR8 *Ascii, OPTIONAL >=20 > + OUT CHAR8 *DecSpecialGraphics OPTIONAL >=20 > ); >=20 >=20 >=20 > /** >=20 > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > b/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > index f117d90b9de3..5ae5a4f0212e 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > @@ -63,7 +63,7 @@ AnsiTestString ( >=20 >=20 > if ( !(TerminalIsValidAscii (*WString) || >=20 > TerminalIsValidEfiCntlChar (*WString) || >=20 > - TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL) )) { >=20 > + TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL, NULL)= )) { >=20 >=20 >=20 > return EFI_UNSUPPORTED; >=20 > } >=20 > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > index aae470e9562c..1c22ed426715 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > @@ -16,61 +16,59 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > // >=20 > // >=20 > UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] =3D { >=20 > - { BOXDRAW_HORIZONTAL, 0xc4, L'-' }, >=20 > - { BOXDRAW_VERTICAL, 0xb3, L'|' }, >=20 > - { BOXDRAW_DOWN_RIGHT, 0xda, L'/' }, >=20 > - { BOXDRAW_DOWN_LEFT, 0xbf, L'\\' }, >=20 > - { BOXDRAW_UP_RIGHT, 0xc0, L'\\' }, >=20 > - { BOXDRAW_UP_LEFT, 0xd9, L'/' }, >=20 > - { BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|' }, >=20 > - { BOXDRAW_VERTICAL_LEFT, 0xb4, L'|' }, >=20 > - { BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+' }, >=20 > - { BOXDRAW_UP_HORIZONTAL, 0xc1, L'+' }, >=20 > - { BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+' }, >=20 > - { BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-' }, >=20 > - { BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|' }, >=20 > - { BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/' }, >=20 > - { BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/' }, >=20 > - { BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/' }, >=20 > - { BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\' }, >=20 > - { BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\' }, >=20 > - { BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\' }, >=20 > - { BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\' }, >=20 > - { BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\' }, >=20 > - { BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\' }, >=20 > - { BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/' }, >=20 > - { BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/' }, >=20 > - { BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/' }, >=20 > - { BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|' }, >=20 > - { BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|' }, >=20 > - { BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|' }, >=20 > - { BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|' }, >=20 > - { BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|' }, >=20 > - { BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|' }, >=20 > - { BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+' }, >=20 > - { BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+' }, >=20 > - { BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+' }, >=20 > - { BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+' }, >=20 > - { BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+' }, >=20 > - { BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+' }, >=20 > - { BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+' }, >=20 > - { BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+' }, >=20 > - { BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+' }, >=20 > + { BOXDRAW_HORIZONTAL, 0xc4, L'-', 0x71 }, >=20 > + { BOXDRAW_VERTICAL, 0xb3, L'|', 0x78 }, >=20 > + { BOXDRAW_DOWN_RIGHT, 0xda, L'/', 0x6c }, >=20 > + { BOXDRAW_DOWN_LEFT, 0xbf, L'\\', 0x6b }, >=20 > + { BOXDRAW_UP_RIGHT, 0xc0, L'\\', 0x6d }, >=20 > + { BOXDRAW_UP_LEFT, 0xd9, L'/', 0x6a }, >=20 > + { BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|', 0x74 }, >=20 > + { BOXDRAW_VERTICAL_LEFT, 0xb4, L'|', 0x75 }, >=20 > + { BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+', 0x77 }, >=20 > + { BOXDRAW_UP_HORIZONTAL, 0xc1, L'+', 0x76 }, >=20 > + { BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+', 0x6e }, >=20 > + { BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-', 0x71 }, >=20 > + { BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|', 0x78 }, >=20 > + { BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/', 0x6c }, >=20 > + { BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/', 0x6c }, >=20 > + { BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/', 0x6c }, >=20 > + { BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\', 0x6b }, >=20 > + { BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\', 0x6b }, >=20 > + { BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\', 0x6b }, >=20 > + { BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\', 0x6d }, >=20 > + { BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\', 0x6d }, >=20 > + { BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\', 0x6d }, >=20 > + { BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/', 0x6a }, >=20 > + { BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/', 0x6a }, >=20 > + { BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/', 0x6a }, >=20 > + { BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|', 0x74 }, >=20 > + { BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|', 0x74 }, >=20 > + { BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|', 0x74 }, >=20 > + { BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|', 0x75 }, >=20 > + { BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|', 0x75 }, >=20 > + { BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|', 0x75 }, >=20 > + { BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+', 0x77 }, >=20 > + { BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+', 0x77 }, >=20 > + { BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+', 0x77 }, >=20 > + { BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+', 0x76 }, >=20 > + { BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+', 0x76 }, >=20 > + { BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+', 0x76 }, >=20 > + { BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+', 0x6e }, >=20 > + { BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+', 0x6e }, >=20 > + { BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+', 0x6e }, >=20 >=20 >=20 > - { BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*' }, >=20 > - { BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+' }, >=20 > + { BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*', 0x61 }, >=20 > + { BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+', 0x61 }, >=20 >=20 >=20 > - { GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^' }, >=20 > - { GEOMETRICSHAPE_RIGHT_TRIANGLE, '>', L'>' }, >=20 > - { GEOMETRICSHAPE_DOWN_TRIANGLE, 'v', L'v' }, >=20 > - { GEOMETRICSHAPE_LEFT_TRIANGLE, '<', L'<' }, >=20 > + { GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^', L'^' }, >=20 > + { GEOMETRICSHAPE_RIGHT_TRIANGLE, '>', L'>', L'>' }, >=20 > + { GEOMETRICSHAPE_DOWN_TRIANGLE, 'v', L'v', L'v' }, >=20 > + { GEOMETRICSHAPE_LEFT_TRIANGLE, '<', L'<', L'<' }, >=20 >=20 >=20 > - { ARROW_LEFT, '<', L'<' }, >=20 > - { ARROW_UP, '^', L'^' }, >=20 > - { ARROW_RIGHT, '>', L'>' }, >=20 > - { ARROW_DOWN, 'v', L'v' }, >=20 > - >=20 > - { 0x0000, 0x00, L'\0' } >=20 > + { ARROW_LEFT, '<', L'<', L'<' }, >=20 > + { ARROW_UP, '^', L'^', L'^' }, >=20 > + { ARROW_RIGHT, '>', L'>', L'>' }, >=20 > + { ARROW_DOWN, 'v', L'v', L'v' }, >=20 > }; >=20 >=20 >=20 > CHAR16 mSetModeString[] =3D { ESC, '[', '=3D', '3', 'h', 0 }; >=20 > @@ -80,6 +78,8 @@ CHAR16 mSetCursorPositionString[] =3D { ESC, '[', '0',= '0', ';', > '0', '0', 'H', 0 > CHAR16 mCursorForwardString[] =3D { ESC, '[', '0', '0', 'C', 0 }; >=20 > CHAR16 mCursorBackwardString[] =3D { ESC, '[', '0', '0', 'D', 0 }; >=20 >=20 >=20 > +CHAR8 SetDecModeString[] =3D {ESC, 0x28, 0x30}; >=20 > +CHAR8 ExitDecModeString[] =3D {ESC, 0x28, 0x42}; >=20 > // >=20 > // Body of the ConOut functions >=20 > // >=20 > @@ -183,16 +183,19 @@ TerminalConOutOutputString ( > EFI_STATUS Status; >=20 > UINT8 ValidBytes; >=20 > CHAR8 CrLfStr[2]; >=20 > + CHAR8 DecChar; >=20 > + UINTN ModeSwitchLength; >=20 > // >=20 > // flag used to indicate whether condition happens which will cause >=20 > // return EFI_WARN_UNKNOWN_GLYPH >=20 > // >=20 > BOOLEAN Warning; >=20 >=20 >=20 > - ValidBytes =3D 0; >=20 > - Warning =3D FALSE; >=20 > - AsciiChar =3D 0; >=20 > - >=20 > + ValidBytes =3D 0; >=20 > + Warning =3D FALSE; >=20 > + AsciiChar =3D 0; >=20 > + DecChar =3D 0; >=20 > + ModeSwitchLength =3D LENGTH_DEC_ESCAPE; >=20 > // >=20 > // get Terminal device data structure pointer. >=20 > // >=20 > @@ -217,17 +220,136 @@ TerminalConOutOutputString ( > for (; *WString !=3D CHAR_NULL; WString++) { >=20 >=20 >=20 > switch (TerminalDevice->TerminalType) { >=20 > - >=20 > case TerminalTypePcAnsi: >=20 > - case TerminalTypeVt100: >=20 > - case TerminalTypeVt100Plus: >=20 > - case TerminalTypeTtyTerm: >=20 > - case TerminalTypeLinux: >=20 > + if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiCh= ar, > NULL)) { >=20 > + // >=20 > + // If it's not a graphic character convert Unicode to ASCII. >=20 > + // >=20 > + GraphicChar =3D (CHAR8)*WString; >=20 > + >=20 > + if (!(TerminalIsValidAscii (GraphicChar) || TerminalIsValidEfiCn= tlChar > (GraphicChar))) { >=20 > + // >=20 > + // when this driver use the OutputString to output control str= ing, >=20 > + // TerminalDevice->OutputEscChar is set to let the Esc char >=20 > + // to be output to the terminal emulation software. >=20 > + // >=20 > + if ((GraphicChar =3D=3D 27) && TerminalDevice->OutputEscChar) = { >=20 > + GraphicChar =3D 27; >=20 > + } else { >=20 > + GraphicChar =3D '?'; >=20 > + Warning =3D TRUE; >=20 > + } >=20 > + } >=20 > + >=20 > + AsciiChar =3D GraphicChar; >=20 > + } >=20 > + Length =3D 1; >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialIo, >=20 > + &Length, >=20 > + &GraphicChar >=20 > + ); >=20 > + >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto OutputError; >=20 > + } >=20 > + >=20 > + break; >=20 > case TerminalTypeXtermR6: >=20 > - case TerminalTypeVt400: >=20 > case TerminalTypeSCO: >=20 > + if (TerminalIsValidTextGraphics (*WString, NULL, NULL, &DecChar) > && !TerminalIsValidAscii (*WString)) { >=20 > + //Box graphics are split into 2 types simple and advanced >=20 > + //simple are drawn with dec special graphics >=20 > + //advanced are drawn with utf8 >=20 > + //This checks for simple because they have a lower value than = the > advanced >=20 > + if(*WString < BOXDRAW_DOUBLE_HORIZONTAL) { >=20 > + if (!TerminalDevice->DecSpecialGraphicsMode) { >=20 > + ValidBytes =3D 0; >=20 > + ModeSwitchLength =3D LENGTH_DEC_ESCAPE; >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->Seria= lIo, >=20 > + &ModeSwitchLength, >=20 > + (UINT8 *)SetDecModeSt= ring >=20 > + ); >=20 > + TerminalDevice->DecSpecialGraphicsMode =3D TRUE; >=20 > + } >=20 >=20 >=20 > - if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiCh= ar)) { >=20 > + GraphicChar =3D DecChar; >=20 > + Length =3D 1; >=20 > + } else { >=20 > + if (TerminalDevice->DecSpecialGraphicsMode) { >=20 > + ModeSwitchLength =3D LENGTH_DEC_ESCAPE; >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->Seria= lIo, >=20 > + &ModeSwitchLength, >=20 > + (UINT8 *)ExitDecModeS= tring >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto OutputError; >=20 > + } >=20 > + >=20 > + TerminalDevice->DecSpecialGraphicsMode =3D FALSE; >=20 > + } >=20 > + >=20 > + UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes); >=20 > + Length =3D ValidBytes; >=20 > + } >=20 > + } else { >=20 > + if (TerminalDevice->DecSpecialGraphicsMode) { >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialIo, >=20 > + &ModeSwitchLength, >=20 > + (UINT8 *)ExitDecModeString >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto OutputError; >=20 > + } >=20 > + >=20 > + TerminalDevice->DecSpecialGraphicsMode =3D FALSE; >=20 > + } >=20 > + >=20 > + GraphicChar =3D (CHAR8)*WString; >=20 > + >=20 > + if (!(TerminalIsValidAscii (GraphicChar) || TerminalIsValidEfiCn= tlChar > (GraphicChar))) { >=20 > + // >=20 > + // when this driver use the OutputString to output control str= ing, >=20 > + // TerminalDevice->OutputEscChar is set to let the Esc char >=20 > + // to be output to the terminal emulation software. >=20 > + // >=20 > + if ((GraphicChar =3D=3D 27) && TerminalDevice->OutputEscChar= ) { >=20 > + GraphicChar =3D 27; >=20 > + Length =3D 1; >=20 > + } else { >=20 > + UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes); >=20 > + Length =3D ValidBytes; >=20 > + } >=20 > + } else { >=20 > + Length =3D 1; >=20 > + } >=20 > + } >=20 > + >=20 > + if (ValidBytes) { >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialIo, >=20 > + &Length, >=20 > + (UINT8 *)&Utf8Char >=20 > + ); >=20 > + ValidBytes =3D 0; >=20 > + } else { >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialIo, >=20 > + &Length, >=20 > + &GraphicChar >=20 > + ); >=20 > + } >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto OutputError; >=20 > + } >=20 > + >=20 > + break; >=20 > + case TerminalTypeVt100: >=20 > + case TerminalTypeTtyTerm: >=20 > + if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiCh= ar, > NULL)) { >=20 > // >=20 > // If it's not a graphic character convert Unicode to ASCII. >=20 > // >=20 > @@ -248,12 +370,9 @@ TerminalConOutOutputString ( > } >=20 >=20 >=20 > AsciiChar =3D GraphicChar; >=20 > - >=20 > } >=20 >=20 >=20 > - if (TerminalDevice->TerminalType !=3D TerminalTypePcAnsi) { >=20 > - GraphicChar =3D AsciiChar; >=20 > - } >=20 > + GraphicChar =3D AsciiChar; >=20 >=20 >=20 > Length =3D 1; >=20 >=20 >=20 > @@ -267,8 +386,67 @@ TerminalConOutOutputString ( > goto OutputError; >=20 > } >=20 >=20 >=20 > - break; >=20 > + break; >=20 > + case TerminalTypeVt100Plus: >=20 > + case TerminalTypeVt400: >=20 > + Length =3D 1; >=20 > + if (TerminalIsValidTextGraphics (*WString, NULL, NULL, &DecChar)= ) { >=20 > + if (!TerminalDevice->DecSpecialGraphicsMode) { >=20 > + ModeSwitchLength =3D LENGTH_DEC_ESCAPE; >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialI= o, >=20 > + &ModeSwitchLength, >=20 > + (UINT8 *)SetDecModeStri= ng >=20 > + ); >=20 > + TerminalDevice->DecSpecialGraphicsMode =3D TRUE; >=20 > + } >=20 >=20 >=20 > + GraphicChar =3D DecChar; >=20 > + } else { >=20 > + if (TerminalDevice->DecSpecialGraphicsMode) { >=20 > + ModeSwitchLength =3D LENGTH_DEC_ESCAPE; >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialI= o, >=20 > + &ModeSwitchLength, >=20 > + (UINT8 *)ExitDecModeStr= ing >=20 > + ); >=20 > + >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto OutputError; >=20 > + } >=20 > + >=20 > + TerminalDevice->DecSpecialGraphicsMode =3D FALSE; >=20 > + } >=20 > + >=20 > + GraphicChar =3D (CHAR8)*WString; >=20 > + >=20 > + if (!(TerminalIsValidAscii (GraphicChar) || TerminalIsValidEfiCn= tlChar > (GraphicChar))) { >=20 > + // >=20 > + // when this driver use the OutputString to output control str= ing, >=20 > + // TerminalDevice->OutputEscChar is set to let the Esc char >=20 > + // to be output to the terminal emulation software. >=20 > + // >=20 > + if ((GraphicChar =3D=3D 27) && TerminalDevice->OutputEscChar) = { >=20 > + GraphicChar =3D 27; >=20 > + } else { >=20 > + GraphicChar =3D '?'; >=20 > + Warning =3D TRUE; >=20 > + } >=20 > + } >=20 > + } >=20 > + >=20 > + Status =3D TerminalDevice->SerialIo->Write ( >=20 > + TerminalDevice->SerialIo, >=20 > + &Length, >=20 > + &GraphicChar >=20 > + ); >=20 > + >=20 > + if (EFI_ERROR (Status)) { >=20 > + goto OutputError; >=20 > + } >=20 > + >=20 > + break; >=20 > + case TerminalTypeLinux: >=20 > case TerminalTypeVtUtf8: >=20 > UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes); >=20 > Length =3D ValidBytes; >=20 > @@ -280,8 +458,10 @@ TerminalConOutOutputString ( > if (EFI_ERROR (Status)) { >=20 > goto OutputError; >=20 > } >=20 > + >=20 > break; >=20 > } >=20 > + >=20 > // >=20 > // Update cursor position. >=20 > // >=20 > @@ -875,7 +1055,8 @@ BOOLEAN > TerminalIsValidTextGraphics ( >=20 > IN CHAR16 Graphic, >=20 > OUT CHAR8 *PcAnsi, OPTIONAL >=20 > - OUT CHAR8 *Ascii OPTIONAL >=20 > + OUT CHAR8 *Ascii, OPTIONAL >=20 > + OUT CHAR8 *DecSpecialGraphics OPTIONAL >=20 > ) >=20 > { >=20 > UNICODE_TO_CHAR *Table; >=20 > @@ -897,6 +1078,9 @@ TerminalIsValidTextGraphics ( > if (Ascii !=3D NULL) { >=20 > *Ascii =3D Table->Ascii; >=20 > } >=20 > + if (DecSpecialGraphics !=3D NULL){ >=20 > + *DecSpecialGraphics =3D Table->DecSpecialGraphics; >=20 > + } >=20 >=20 >=20 > return TRUE; >=20 > } >=20 > -- > 2.32.0