mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-27 12:15:19 +01:00
correct codepage for help screen
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
91ba53fd1c
commit
4be33ca401
@ -264,8 +264,10 @@ REFIT_CONFIG GlobalConfig = {
|
|||||||
FALSE, // BOOLEAN Proportional;
|
FALSE, // BOOLEAN Proportional;
|
||||||
FALSE, // BOOLEAN DarkEmbedded;
|
FALSE, // BOOLEAN DarkEmbedded;
|
||||||
FALSE, // BOOLEAN TypeSVG;
|
FALSE, // BOOLEAN TypeSVG;
|
||||||
|
#endif
|
||||||
0xC0, // INTN Codepage;
|
0xC0, // INTN Codepage;
|
||||||
0xC0, // INTN CodepageSize; //extended latin
|
0xC0, // INTN CodepageSize; //extended latin
|
||||||
|
#if !USE_XTHEME
|
||||||
1.0f, // float Scale;
|
1.0f, // float Scale;
|
||||||
0.0f, // float CentreShift;
|
0.0f, // float CentreShift;
|
||||||
#endif
|
#endif
|
||||||
@ -3289,57 +3291,6 @@ GetEarlyUserSettings (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prop = GetProperty (DictPointer, "Language");
|
Prop = GetProperty (DictPointer, "Language");
|
||||||
#if USE_XTHEME
|
|
||||||
if (Prop != NULL) {
|
|
||||||
AsciiStrCpyS (gSettings.Language, 16, Prop->string);
|
|
||||||
if (AsciiStrStr (Prop->string, "en")) {
|
|
||||||
gLanguage = english;
|
|
||||||
ThemeX.Codepage = 0xC0;
|
|
||||||
ThemeX.CodepageSize = 0;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "ru")) {
|
|
||||||
gLanguage = russian;
|
|
||||||
ThemeX.Codepage = 0x410;
|
|
||||||
ThemeX.CodepageSize = 0x40;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "ua")) {
|
|
||||||
gLanguage = ukrainian;
|
|
||||||
ThemeX.Codepage = 0x400;
|
|
||||||
ThemeX.CodepageSize = 0x60;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "fr")) {
|
|
||||||
gLanguage = french; //default is extended latin
|
|
||||||
} else if (AsciiStrStr (Prop->string, "it")) {
|
|
||||||
gLanguage = italian;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "es")) {
|
|
||||||
gLanguage = spanish;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "pt")) {
|
|
||||||
gLanguage = portuguese;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "br")) {
|
|
||||||
gLanguage = brasil;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "de")) {
|
|
||||||
gLanguage = german;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "nl")) {
|
|
||||||
gLanguage = dutch;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "pl")) {
|
|
||||||
gLanguage = polish;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "cz")) {
|
|
||||||
gLanguage = czech;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "hr")) {
|
|
||||||
gLanguage = croatian;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "id")) {
|
|
||||||
gLanguage = indonesian;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "zh_CN")) {
|
|
||||||
gLanguage = chinese;
|
|
||||||
ThemeX.Codepage = 0x3400;
|
|
||||||
ThemeX.CodepageSize = 0x19C0;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "ro")) {
|
|
||||||
gLanguage = romanian;
|
|
||||||
} else if (AsciiStrStr (Prop->string, "ko")) {
|
|
||||||
gLanguage = korean;
|
|
||||||
ThemeX.Codepage = 0x1100;
|
|
||||||
ThemeX.CodepageSize = 0x100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
if (Prop != NULL) {
|
if (Prop != NULL) {
|
||||||
AsciiStrCpyS (gSettings.Language, 16, Prop->string);
|
AsciiStrCpyS (gSettings.Language, 16, Prop->string);
|
||||||
if (AsciiStrStr (Prop->string, "en")) {
|
if (AsciiStrStr (Prop->string, "en")) {
|
||||||
@ -3389,8 +3340,6 @@ GetEarlyUserSettings (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if (gSettings.Language != NULL) { // gSettings.Language != NULL cannot be false because gSettings.Language is dclared as CHAR8 Language[16]; Must we replace by gSettings.Language[0] != NULL
|
// if (gSettings.Language != NULL) { // gSettings.Language != NULL cannot be false because gSettings.Language is dclared as CHAR8 Language[16]; Must we replace by gSettings.Language[0] != NULL
|
||||||
Prop = GetProperty (DictPointer, "KbdPrevLang");
|
Prop = GetProperty (DictPointer, "KbdPrevLang");
|
||||||
if (Prop != NULL) {
|
if (Prop != NULL) {
|
||||||
|
@ -279,8 +279,8 @@ void XTheme::Init()
|
|||||||
// ShowOptimus = FALSE;
|
// ShowOptimus = FALSE;
|
||||||
DarkEmbedded = FALSE; //looks like redundant, we always check Night or Daylight
|
DarkEmbedded = FALSE; //looks like redundant, we always check Night or Daylight
|
||||||
TypeSVG = FALSE;
|
TypeSVG = FALSE;
|
||||||
Codepage = 0xC0; //this is for PNG theme
|
// Codepage = 0xC0; //this is for PNG theme
|
||||||
CodepageSize = 0xC0; // INTN CodepageSize; //extended latin
|
// CodepageSize = 0xC0; // INTN CodepageSize; //extended latin
|
||||||
Scale = 1.0f;
|
Scale = 1.0f;
|
||||||
CentreShift = 0.0f;
|
CentreShift = 0.0f;
|
||||||
Daylight = true;
|
Daylight = true;
|
||||||
|
@ -77,8 +77,8 @@ public:
|
|||||||
BOOLEAN embedded;
|
BOOLEAN embedded;
|
||||||
BOOLEAN DarkEmbedded;
|
BOOLEAN DarkEmbedded;
|
||||||
BOOLEAN TypeSVG;
|
BOOLEAN TypeSVG;
|
||||||
INTN Codepage;
|
// INTN Codepage; //no! it is global settings
|
||||||
INTN CodepageSize;
|
// INTN CodepageSize;
|
||||||
float Scale;
|
float Scale;
|
||||||
float CentreShift;
|
float CentreShift;
|
||||||
INTN row0TileSize;
|
INTN row0TileSize;
|
||||||
@ -133,6 +133,9 @@ public:
|
|||||||
INTN GetEmpty(const XImage& Buffer, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& FirstPixel, INTN Start, INTN Step);
|
INTN GetEmpty(const XImage& Buffer, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL& FirstPixel, INTN Start, INTN Step);
|
||||||
INTN RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
INTN RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
||||||
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType);
|
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType);
|
||||||
|
//overload for UTF8 text
|
||||||
|
INTN RenderText(IN const XString& Text, OUT XImage* CompImage_ptr,
|
||||||
|
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType);
|
||||||
|
|
||||||
|
|
||||||
// void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
// void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
//Slice 2011 - 2016 numerous improvements
|
//Slice 2011 - 2016 numerous improvements, 2020 full rewritten
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <Protocol/GraphicsOutput.h>
|
#include <Protocol/GraphicsOutput.h>
|
||||||
@ -386,7 +386,6 @@ INTN XTheme::GetEmpty(const XImage& Buffer, const EFI_GRAPHICS_OUTPUT_BLT_PIXEL&
|
|||||||
{
|
{
|
||||||
INTN m, i;
|
INTN m, i;
|
||||||
// INTN Shift = (Step > 0)?0:1;
|
// INTN Shift = (Step > 0)?0:1;
|
||||||
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL ThePixel;
|
|
||||||
m = FontWidth;
|
m = FontWidth;
|
||||||
if (Step == 1) {
|
if (Step == 1) {
|
||||||
for (INTN j = 0; j < FontHeight; j++) {
|
for (INTN j = 0; j < FontHeight; j++) {
|
||||||
@ -447,6 +446,13 @@ INTN GetEmpty(EG_PIXEL *Ptr, EG_PIXEL *FirstPixel, INTN MaxWidth, INTN Step, INT
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_XTHEME
|
#if USE_XTHEME
|
||||||
|
INTN XTheme::RenderText(IN const XString& Text, OUT XImage* CompImage_ptr,
|
||||||
|
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType)
|
||||||
|
{
|
||||||
|
const XStringW& UTF16Text = XStringW().takeValueFrom(Text.c_str());
|
||||||
|
return RenderText(UTF16Text, CompImage_ptr, PosX, PosY, Cursor, textType);
|
||||||
|
}
|
||||||
|
|
||||||
INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
||||||
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType)
|
IN INTN PosX, IN INTN PosY, IN INTN Cursor, INTN textType)
|
||||||
{
|
{
|
||||||
@ -503,15 +509,19 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
|||||||
Bukva.YPos = 0;
|
Bukva.YPos = 0;
|
||||||
Bukva.Width = FontWidth;
|
Bukva.Width = FontWidth;
|
||||||
Bukva.Height = FontHeight;
|
Bukva.Height = FontHeight;
|
||||||
|
DBG("codepage=%llx, asciiPage=%x\n", GlobalConfig.Codepage, AsciiPageSize);
|
||||||
for (INTN i = 0; i < TextLength; i++) {
|
for (INTN i = 0; i < TextLength; i++) {
|
||||||
UINT16 c = Text.wc_str()[i];
|
UINT16 c = Text[i];
|
||||||
UINT16 c1;
|
DBG("initial char to render 0x%x\n", c); //good
|
||||||
DBG("initial char to render 0x%x\n", c);
|
if (gLanguage != korean) { //russian Codepage = 0x410
|
||||||
if (gLanguage != korean) {
|
if (c >= 0x410 && c < 0x450) {
|
||||||
c1 = (((c >= Codepage) ? (c - (Codepage - AsciiPageSize)) : c) & 0xff); //International letters
|
//we have russian raster fonts with chars at 0xC0
|
||||||
c = c1;
|
c -= 0x350;
|
||||||
|
} else {
|
||||||
|
INTN c2 = (c >= GlobalConfig.Codepage) ? (c - GlobalConfig.Codepage + AsciiPageSize) : c; //International letters
|
||||||
|
c = c2 & 0xFF; //this maximum raster font size
|
||||||
|
}
|
||||||
|
DBG("char to render 0x%x\n", c);
|
||||||
if (Proportional) {
|
if (Proportional) {
|
||||||
//find spaces {---comp--__left__|__right__--char---}
|
//find spaces {---comp--__left__|__right__--char---}
|
||||||
if (c0 <= 0x20) { // space before or at buffer edge
|
if (c0 <= 0x20) { // space before or at buffer edge
|
||||||
@ -534,12 +544,13 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
|||||||
LeftSpace = 2;
|
LeftSpace = 2;
|
||||||
RightSpace = 0;
|
RightSpace = 0;
|
||||||
}
|
}
|
||||||
|
DBG(" RealWidth = %lld LeftSpace = %lld RightSpace = %lld\n", RealWidth, LeftSpace, RightSpace);
|
||||||
c0 = c; //old value
|
c0 = c; //old value
|
||||||
if (PosX + RealWidth > CompImage.GetWidth()) {
|
if (PosX + RealWidth > CompImage.GetWidth()) {
|
||||||
//no more place for character
|
//no more place for character
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DBG("char to render 0x%x\n", c);
|
|
||||||
Area.XPos = PosX + 2 - LeftSpace;
|
Area.XPos = PosX + 2 - LeftSpace;
|
||||||
Area.Width = RealWidth;
|
Area.Width = RealWidth;
|
||||||
Bukva.XPos = c * FontWidth + RightSpace;
|
Bukva.XPos = c * FontWidth + RightSpace;
|
||||||
@ -560,6 +571,7 @@ INTN XTheme::RenderText(IN const XStringW& Text, OUT XImage* CompImage_ptr,
|
|||||||
//Slice - I am not sure in any of this digits
|
//Slice - I am not sure in any of this digits
|
||||||
//someone knowning korean should revise this
|
//someone knowning korean should revise this
|
||||||
//
|
//
|
||||||
|
UINT16 c1 = c;
|
||||||
if ((c >= 0x20) && (c <= 0x7F)) {
|
if ((c >= 0x20) && (c <= 0x7F)) {
|
||||||
c1 = ((c - 0x20) >> 4) * 28 + (c & 0x0F);
|
c1 = ((c - 0x20) >> 4) * 28 + (c & 0x0F);
|
||||||
Cho = c1;
|
Cho = c1;
|
||||||
|
@ -371,8 +371,10 @@ typedef struct {
|
|||||||
BOOLEAN Proportional;
|
BOOLEAN Proportional;
|
||||||
BOOLEAN DarkEmbedded;
|
BOOLEAN DarkEmbedded;
|
||||||
BOOLEAN TypeSVG;
|
BOOLEAN TypeSVG;
|
||||||
|
#endif
|
||||||
INTN Codepage;
|
INTN Codepage;
|
||||||
INTN CodepageSize;
|
INTN CodepageSize;
|
||||||
|
#if !USE_XTHEME
|
||||||
float Scale;
|
float Scale;
|
||||||
float CentreShift;
|
float CentreShift;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user