From 75f06ce05fefc703e3c3b012bac1b06f74ce40a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sun, 28 Apr 2019 23:16:11 +0200 Subject: [PATCH] lsp-plugins: Add hack to display texts properly in UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Müller --- ...-Fix-fonts-for-locales-as-en_US.utf8.patch | 41 ------------ recipes-musicians/lsp-plugins/lsp-plugins.bb | 1 + recipes-musicians/lsp-plugins/lsp-plugins.inc | 1 - ...k-remove-runtime-charset-conversions.patch | 62 +++++++++++++++++++ 4 files changed, 63 insertions(+), 42 deletions(-) delete mode 100644 recipes-musicians/lsp-plugins/files/0002-Fix-fonts-for-locales-as-en_US.utf8.patch create mode 100644 recipes-musicians/lsp-plugins/lsp-plugins/0003-Hack-remove-runtime-charset-conversions.patch diff --git a/recipes-musicians/lsp-plugins/files/0002-Fix-fonts-for-locales-as-en_US.utf8.patch b/recipes-musicians/lsp-plugins/files/0002-Fix-fonts-for-locales-as-en_US.utf8.patch deleted file mode 100644 index a8b83b2..0000000 --- a/recipes-musicians/lsp-plugins/files/0002-Fix-fonts-for-locales-as-en_US.utf8.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 58d45693b42953c6d85d3d1dcf665796bb6db084 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andreas=20M=C3=BCller?= -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 ---- - 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 - diff --git a/recipes-musicians/lsp-plugins/lsp-plugins.bb b/recipes-musicians/lsp-plugins/lsp-plugins.bb index 98e5077..eba0bcd 100644 --- a/recipes-musicians/lsp-plugins/lsp-plugins.bb +++ b/recipes-musicians/lsp-plugins/lsp-plugins.bb @@ -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" diff --git a/recipes-musicians/lsp-plugins/lsp-plugins.inc b/recipes-musicians/lsp-plugins/lsp-plugins.inc index 41df24b..8a79416 100644 --- a/recipes-musicians/lsp-plugins/lsp-plugins.inc +++ b/recipes-musicians/lsp-plugins/lsp-plugins.inc @@ -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" diff --git a/recipes-musicians/lsp-plugins/lsp-plugins/0003-Hack-remove-runtime-charset-conversions.patch b/recipes-musicians/lsp-plugins/lsp-plugins/0003-Hack-remove-runtime-charset-conversions.patch new file mode 100644 index 0000000..fe0d7e4 --- /dev/null +++ b/recipes-musicians/lsp-plugins/lsp-plugins/0003-Hack-remove-runtime-charset-conversions.patch @@ -0,0 +1,62 @@ +From b8d6bc13a68a78dc026db863cbc7103bbb584afe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +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 +--- + 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 +