From b1643c1dc8fc6e06cfe3bfaab054c8019aae6647 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Thu, 16 Nov 2023 02:08:37 +0900 Subject: [PATCH] Allow bitmap 6byte utf8 glyph + Ignore build warning The new warning option -Wstringop-overflow occured when we convert from std::string to utf8 buffer. Also, current dali support maximum 6 bytes utf8 glyph. Let we also support them for BitmapFont case. Change-Id: I3cc1f20145fa7be9071de3048d7d242cb6273bd8 Signed-off-by: Eunki Hong --- dali-toolkit/devel-api/text/bitmap-font.cpp | 7 +++++-- dali-toolkit/devel-api/text/bitmap-font.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dali-toolkit/devel-api/text/bitmap-font.cpp b/dali-toolkit/devel-api/text/bitmap-font.cpp index c42eed8..5b1adaf 100644 --- a/dali-toolkit/devel-api/text/bitmap-font.cpp +++ b/dali-toolkit/devel-api/text/bitmap-font.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,9 +45,12 @@ Glyph::Glyph(const std::string& url, const std::string utf8Character, float asce ascender{ascender}, descender{descender} { - DALI_ASSERT_DEBUG(utf8Character.size() <= 4u); + DALI_ASSERT_DEBUG(utf8Character.size() <= 6u); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" std::copy(utf8Character.begin(), utf8Character.end(), utf8); +#pragma GCC diagnostic pop } Glyph::~Glyph() diff --git a/dali-toolkit/devel-api/text/bitmap-font.h b/dali-toolkit/devel-api/text/bitmap-font.h index dbd0c02..ca22694 100644 --- a/dali-toolkit/devel-api/text/bitmap-font.h +++ b/dali-toolkit/devel-api/text/bitmap-font.h @@ -67,7 +67,7 @@ struct DALI_TOOLKIT_API Glyph ~Glyph(); std::string url; ///< The url of the glyph. - uint8_t utf8[4]; ///< the glyph encoded in utf8 + uint8_t utf8[6]; ///< the glyph encoded in utf8 float ascender; ///< The ascender. The distance from the base line to the top of the glyph. float descender; ///< The descender. The distance from the base line to the bottom of the glyph. }; -- 2.7.4