Files
UnrealEngine/Engine/Source/Runtime/Slate/Private/Framework/Text/RunUtils.cpp
2025-05-18 13:04:45 +08:00

31 lines
970 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Framework/Text/RunUtils.h"
#include "Framework/Text/TextHitPoint.h"
ETextHitPoint RunUtils::CalculateTextHitPoint(const int32 InIndex, const FTextRange& InTextRange, const TextBiDi::ETextDirection InTextDirection)
{
//if (InTextDirection == TextBiDi::ETextDirection::LeftToRight)
{
return (InIndex == InTextRange.EndIndex) ? ETextHitPoint::RightGutter : ETextHitPoint::WithinText;
}
/*
else
{
return (InIndex == InTextRange.BeginIndex) ? ETextHitPoint::RightGutter : ETextHitPoint::WithinText;
}
*/
}
FTextRange RunUtils::CalculateOffsetMeasureRange(const int32 InOffset, const FTextRange& InTextRange, const TextBiDi::ETextDirection InTextDirection)
{
if (InTextDirection == TextBiDi::ETextDirection::LeftToRight)
{
return FTextRange(InTextRange.BeginIndex, InTextRange.BeginIndex + InOffset);
}
else
{
return FTextRange(InTextRange.BeginIndex + InOffset, InTextRange.EndIndex);
}
}