libunibreak in AT-SPI only used some special case.
I think we don't make it as Accessible's own API.
Change-Id: Id7661320ba6d8a23ae61775642b275ef1e3a2666
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
#define DALI_ADAPTOR_ATSPI_ACCESSIBLE_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
#include <vector>
// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/adaptor-framework/accessibility.h>
namespace Dali::Accessibility
{
public:
virtual ~Accessible() noexcept;
- using utf8_t = unsigned char;
-
- /**
- * @brief Calculates and finds word boundaries in given utf8 text.
- *
- * @param[in] string The source text to find
- * @param[in] length The length of text to find
- * @param[in] language The language to use
- * @param[out] breaks The word boundaries in given text
- *
- * @note Word boundaries are returned as non-zero values in table breaks, which must be of size at least length.
- */
- static void FindWordSeparationsUtf8(const utf8_t* string, std::size_t length, const char* language, char* breaks);
-
- /**
- * @brief Calculates and finds line boundaries in given utf8 text.
- *
- * @param[in] string The source text to find
- * @param[in] length The length of text to find
- * @param[in] language The language to use
- * @param[out] breaks The line boundaries in given text
- *
- * @note Line boundaries are returned as non-zero values in table breaks, which must be of size at least length.
- */
- static void FindLineSeparationsUtf8(const utf8_t* string, std::size_t length, const char* language, char* breaks);
-
/**
* @brief Helper function for emiting active-descendant-changed event.
*
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
breakInfo);
}
+void Segmentation::GetLineBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ LineBreakInfo* breakInfo)
+{
+ GetImplementation(*this).GetLineBreakPositionsUtf8(text,
+ numberOfCharacters,
+ breakInfo);
+}
+
+void Segmentation::GetWordBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ WordBreakInfo* breakInfo)
+{
+ GetImplementation(*this).GetWordBreakPositionsUtf8(text,
+ numberOfCharacters,
+ breakInfo);
+}
+
} // namespace TextAbstraction
} // namespace Dali
#define DALI_PLATFORM_TEXT_ABSTRACTION_SEGMENTATION_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
void GetWordBreakPositions(const Character* const text,
Length numberOfCharacters,
WordBreakInfo* breakInfo);
+
+ /**
+ * @brief Retrieves the line break info from utf8.
+ *
+ * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
+ *
+ * Possible values for LineBreakInfo are:
+ *
+ * - 0 is a LINE_MUST_BREAK. Text must be broken into a new line.
+ * - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
+ * - 2 is a LINE_NO_BREAK. Text can't be broken into a new line.
+ *
+ @verbatim
+ i.e. Hello big\nworld produces:
+ 2222212220 22220
+ @endverbatim
+ *
+ * @param[in] text Pointer to the first character of the text coded in UTF8.
+ * @param[in] numberOfCharacters The number of characters.
+ * @param[out] breakInfo The line break info.
+ */
+ void GetLineBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ LineBreakInfo* breakInfo);
+
+ /**
+ * @brief Retrieves the word break info from utf8.
+ *
+ * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
+ *
+ * Possible values for WordBreakInfo are:
+ *
+ * - 0 is a WORD_BREAK. Text can be broken into a new word.
+ * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
+ *
+ @verbatim
+ i.e. Hello big\nworld produces:
+ 1111001100 11110
+ @endverbatim
+ *
+ * @param[in] text Pointer to the first character of the text coded in UTF8.
+ * @param[in] numberOfCharacters The number of characters.
+ * @param[out] breakInfo The word break info.
+ */
+ void GetWordBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ WordBreakInfo* breakInfo);
};
} // namespace TextAbstraction
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
// CLASS HEADER
//INTERNAL INCLUDES
-#include <dali/devel-api/atspi-interfaces/accessible.h>
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
#include <dali/devel-api/atspi-interfaces/socket.h>
#include <dali/internal/accessibility/bridge/accessibility-common.h>
#include <third-party/libunibreak/linebreak.h>
}
}
}
-
-void Accessible::FindWordSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks)
-{
- set_wordbreaks_utf8(string, length, language, breaks);
-}
-
-void Accessible::FindLineSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks)
-{
- set_linebreaks_utf8(string, length, language, breaks);
-}
*
*/
-#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/devel-api/atspi-interfaces/accessible.h>
#include <dali/devel-api/atspi-interfaces/component.h>
#include <dali/internal/accessibility/bridge/dummy/dummy-atspi.h>
{
}
-void Accessibility::Accessible::FindWordSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks)
-{
-}
-
-void Accessibility::Accessible::FindLineSeparationsUtf8(const utf8_t* string, size_t length, const char* language, char* breaks)
-{
-}
-
void Accessibility::Accessible::NotifyAccessibilityStateChange(Accessibility::States states, bool isRecursive)
{
}
{
struct Segmentation::Plugin
{
- void GetLineBreakPositions(const Character* const text,
- Length numberOfCharacters,
- LineBreakInfo* breakInfo)
+ void GetLineBreakPositionsUtf32(const Character* const text,
+ Length numberOfCharacters,
+ LineBreakInfo* breakInfo)
{
set_linebreaks_utf32(text, numberOfCharacters, NULL, breakInfo);
}
- void GetWordBreakPositions(const Character* const text,
- Length numberOfCharacters,
- WordBreakInfo* breakInfo)
+ void GetWordBreakPositionsUtf32(const Character* const text,
+ Length numberOfCharacters,
+ WordBreakInfo* breakInfo)
{
set_wordbreaks_utf32(text, numberOfCharacters, NULL, breakInfo);
}
+
+ void GetLineBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ LineBreakInfo* breakInfo)
+ {
+ set_linebreaks_utf8(text, numberOfCharacters, NULL, breakInfo);
+ }
+
+ void GetWordBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ WordBreakInfo* breakInfo)
+ {
+ set_wordbreaks_utf8(text, numberOfCharacters, NULL, breakInfo);
+ }
};
Segmentation::Segmentation()
{
CreatePlugin();
- mPlugin->GetLineBreakPositions(text, numberOfCharacters, breakInfo);
+ mPlugin->GetLineBreakPositionsUtf32(text, numberOfCharacters, breakInfo);
}
void Segmentation::GetWordBreakPositions(const Character* const text,
{
CreatePlugin();
- mPlugin->GetWordBreakPositions(text, numberOfCharacters, breakInfo);
+ mPlugin->GetWordBreakPositionsUtf32(text, numberOfCharacters, breakInfo);
+}
+
+void Segmentation::GetLineBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ LineBreakInfo* breakInfo)
+{
+ CreatePlugin();
+
+ mPlugin->GetLineBreakPositionsUtf8(text, numberOfCharacters, breakInfo);
+}
+
+void Segmentation::GetWordBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ WordBreakInfo* breakInfo)
+{
+ CreatePlugin();
+
+ mPlugin->GetWordBreakPositionsUtf8(text, numberOfCharacters, breakInfo);
}
void Segmentation::CreatePlugin()
#define DALI_INTERNAL_TEXT_ABSTRACTION_SEGMENTATION_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
Length numberOfCharacters,
WordBreakInfo* breakInfo);
+ /**
+ * @copydoc Dali::Segmentation::GetLineBreakPositionsUtf8()
+ */
+ void GetLineBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ LineBreakInfo* breakInfo);
+
+ /**
+ * @copydoc Dali::Segmentation::GetWordBreakPositionsUtf8()
+ */
+ void GetWordBreakPositionsUtf8(const uint8_t* const text,
+ Length numberOfCharacters,
+ WordBreakInfo* breakInfo);
+
private:
/**
* Helper for lazy initialization.