lsp-plugins: Add hack to display texts properly in UI

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2019-04-28 23:16:11 +02:00
parent e4637d5c4f
commit 75f06ce05f
4 changed files with 63 additions and 42 deletions

View File

@@ -1,41 +0,0 @@
From 58d45693b42953c6d85d3d1dcf665796bb6db084 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Sat, 27 Apr 2019 23:02:21 +0200
Subject: [PATCH] Fix fonts for locales as 'en_US.utf8'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This should fix [1]
[1] https://github.com/sadko4u/lsp-plugins/issues/17#issuecomment-487228134
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/core/io/charset.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/core/io/charset.cpp b/src/core/io/charset.cpp
index 4ff9c7f9..c044b18d 100644
--- a/src/core/io/charset.cpp
+++ b/src/core/io/charset.cpp
@@ -517,7 +517,16 @@ namespace lsp
// Get system locale
current = setlocale(LC_CTYPE, "");
if (current != NULL)
+ {
current = strchr(current, '.');
+ if (current != NULL)
+ {
+ // For locale e.g 'en_US.utf8' iconv won't understand '.utf8'
+ if((!strcmp(current, ".utf8")) || (!strcmp(current, ".UTF8")))
+ // UTF-8 is default anyway - see below
+ current = NULL;
+ }
+ }
// Scan for character set
if (current != NULL)
--
2.20.1

View File

@@ -20,6 +20,7 @@ DEPENDS += " \
SRC_URI += " \
file://0001-Makefile-align-for-oe-cross-build.patch \
file://0002-Pass-LDFLAGS-to-so-lib-builds.patch \
file://0003-Hack-remove-runtime-charset-conversions.patch \
"
ARM_INSTRUCTION_SET = "arm"

View File

@@ -6,7 +6,6 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3000208d539ec061b899bce1d9ce9404"
SRC_URI = " \
gitsm://github.com/sadko4u/lsp-plugins.git \
file://0001-Remove-RPATHs.patch \
file://0002-Fix-fonts-for-locales-as-en_US.utf8.patch \
"
SRCREV = "04cc45a4aee3bd3a46ecbd0a9160d0d87f8f8a32"
S = "${WORKDIR}/git"

View File

@@ -0,0 +1,62 @@
From b8d6bc13a68a78dc026db863cbc7103bbb584afe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Sun, 28 Apr 2019 22:17:48 +0200
Subject: [PATCH] Hack: remove runtime charset conversions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are no charsets installed yet and I have no idea which are required. So
treat all texts as UTF-8.
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/core/LSPString.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/core/LSPString.cpp b/src/core/LSPString.cpp
index 8e0d72af..e8cf00ff 100644
--- a/src/core/LSPString.cpp
+++ b/src/core/LSPString.cpp
@@ -1418,7 +1418,8 @@ namespace lsp
return true;
}
- char buf[BUF_SIZE];
+ set_utf8(s, n);
+/* char buf[BUF_SIZE];
LSPString temp;
// Open conversion
@@ -1479,7 +1480,7 @@ namespace lsp
// Close descriptor
iconv_close(cd);
- take(&temp);
+ take(&temp);*/
return true;
}
#endif /* PLATFORM_WINDOWS */
@@ -1641,7 +1642,9 @@ namespace lsp
if (first >= last)
return (last == first) ? "" : NULL;
- // Open conversion
+ return get_utf8(first, last);
+
+/* // Open conversion
iconv_t cd = init_iconv_from_wchar_t(charset);
if (cd == iconv_t(-1))
return NULL;
@@ -1703,7 +1706,7 @@ namespace lsp
if (!append_temp("\x00\x00\x00\x00", 4))
return NULL;
- return pTemp->pData;
+ return pTemp->pData;*/
}
#endif /* PLATFORM_WINDOWS */
--
2.20.1