1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +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

@ -1488,6 +1488,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@ -4092,6 +4093,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"

View file

@ -4047,6 +4047,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -6543,6 +6543,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -4047,6 +4047,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -6543,6 +6543,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -1250,6 +1250,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@ -3514,6 +3515,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"

View file

@ -3502,6 +3502,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -5553,6 +5553,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -1380,6 +1380,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@ -3797,6 +3798,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"

View file

@ -3735,6 +3735,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -5988,6 +5988,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -3735,6 +3735,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -5988,6 +5988,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -1269,6 +1269,7 @@ add_library( ${BINARY_NAME}
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"
@ -3613,6 +3614,7 @@ set_source_files_properties(
"../../../../../modules/juce_graphics/detail/juce_ShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.cpp"
"../../../../../modules/juce_graphics/detail/juce_SimpleShapedText.h"
"../../../../../modules/juce_graphics/detail/juce_Unicode.h"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.cpp"
"../../../../../modules/juce_graphics/effects/juce_DropShadowEffect.h"
"../../../../../modules/juce_graphics/effects/juce_GlowEffect.cpp"

View file

@ -3600,6 +3600,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -5715,6 +5715,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -2300,6 +2300,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -3357,6 +3357,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -2300,6 +2300,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -3357,6 +3357,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -3847,6 +3847,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -6147,6 +6147,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -3847,6 +3847,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -6147,6 +6147,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -3576,6 +3576,7 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Ranges.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_ShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_GlowEffect.h"/>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_ImageEffectFilter.h"/>

View file

@ -5682,6 +5682,9 @@
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_SimpleShapedText.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\detail\juce_Unicode.h">
<Filter>JUCE Modules\juce_graphics\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\modules\juce_graphics\effects\juce_DropShadowEffect.h">
<Filter>JUCE Modules\juce_graphics\effects</Filter>
</ClInclude>

View file

@ -0,0 +1,45 @@
/*
==============================================================================
This file is part of the JUCE framework.
Copyright (c) Raw Material Software Limited
JUCE is an open source framework subject to commercial or open source
licensing.
By downloading, installing, or using the JUCE framework, or combining the
JUCE framework with any other source code, object code, content or any other
copyrightable work, you agree to the terms of the JUCE End User Licence
Agreement, and all incorporated terms including the JUCE Privacy Policy and
the JUCE Website Terms of Service, as applicable, which will bind you. If you
do not agree to the terms of these agreements, we will not license the JUCE
framework to you, and you must discontinue the installation or download
process and cease use of the JUCE framework.
JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
Or:
You may also use this code under the terms of the AGPLv3:
https://www.gnu.org/licenses/agpl-3.0.en.html
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
==============================================================================
*/
namespace juce::detail
{
struct UnicodeHelpers
{
UnicodeHelpers() = delete;
static std::vector<int> getLineBreaks (const String& data);
};
} // namespace juce::detail

View file

@ -152,6 +152,7 @@ namespace juce
#include "effects/juce_ImageEffectFilter.h"
#include "effects/juce_DropShadowEffect.h"
#include "effects/juce_GlowEffect.h"
#include "detail/juce_Unicode.h"
#if JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS && (JUCE_MAC || JUCE_IOS)
#include "native/juce_CoreGraphicsHelpers_mac.h"

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