mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Add detail::UnicodeHelpers::getLineBreaks
This commit is contained in:
parent
a07098d479
commit
6c3043f082
29 changed files with 117 additions and 0 deletions
|
|
@ -204,4 +204,23 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
std::vector<int> UnicodeHelpers::getLineBreaks (const String& data)
|
||||
{
|
||||
std::vector<int> lineBreaks;
|
||||
const auto analysis = Unicode::performAnalysis (data);
|
||||
|
||||
for (const auto [index, codepoint] : enumerate (analysis, int{}))
|
||||
{
|
||||
if (codepoint.breaking == TextBreakType::hard)
|
||||
lineBreaks.push_back (index);
|
||||
}
|
||||
|
||||
return lineBreaks;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue