1
0
Fork 0
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:
attila 2025-03-13 09:55:57 +01:00 committed by Attila Szarvas
parent a07098d479
commit 6c3043f082
29 changed files with 117 additions and 0 deletions

View file

@ -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