You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Supports left and right justification and left and right text flows. The ellipsis uses the U+2026 character or 3 dots if the font does not have U+2026. Localizers can override the text used. Unsupported: - Simple, non-shaped text - Non-axis aligned clip rects. - Center justified text #rb jamie.dale #preflight 0f59f9a92cf890001166d15 [CL 16898534 by Matt Kuhlenschmidt in ue5-main branch]
83 lines
3.3 KiB
C++
83 lines
3.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Widgets/SWidget.h"
|
|
#include "Styling/SlateTypes.h"
|
|
#include "Framework/Text/IRun.h"
|
|
#include "Framework/Text/TextLayout.h"
|
|
#include "Framework/Text/ILayoutBlock.h"
|
|
#include "Framework/Text/ISlateRun.h"
|
|
|
|
class FArrangedChildren;
|
|
class FPaintArgs;
|
|
class FSlateWindowElementList;
|
|
enum class ETextHitPoint : uint8;
|
|
|
|
class SLATE_API FSlateTextRun : public ISlateRun, public TSharedFromThis< FSlateTextRun >
|
|
{
|
|
public:
|
|
|
|
static TSharedRef< FSlateTextRun > Create( const FRunInfo& InRunInfo, const TSharedRef< const FString >& InText, const FTextBlockStyle& Style );
|
|
|
|
static TSharedRef< FSlateTextRun > Create( const FRunInfo& InRunInfo, const TSharedRef< const FString >& InText, const FTextBlockStyle& Style, const FTextRange& InRange );
|
|
|
|
public:
|
|
|
|
virtual ~FSlateTextRun() {}
|
|
|
|
virtual FTextRange GetTextRange() const override;
|
|
virtual void SetTextRange( const FTextRange& Value ) override;
|
|
|
|
virtual int16 GetBaseLine( float Scale ) const override;
|
|
virtual int16 GetMaxHeight( float Scale ) const override;
|
|
virtual FVector2D Measure( int32 StartIndex, int32 EndIndex, float Scale, const FRunTextContext& TextContext ) const override;
|
|
virtual int8 GetKerning(int32 CurrentIndex, float Scale, const FRunTextContext& TextContext) const override;
|
|
|
|
virtual TSharedRef< ILayoutBlock > CreateBlock( int32 StartIndex, int32 EndIndex, FVector2D Size, const FLayoutBlockTextContext& TextContext, const TSharedPtr< IRunRenderer >& Renderer ) override;
|
|
|
|
virtual int32 OnPaint(const FPaintArgs& PaintArgs, const FTextArgs& TextArgs, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
|
|
|
|
virtual const TArray< TSharedRef<SWidget> >& GetChildren() override;
|
|
|
|
virtual void ArrangeChildren( const TSharedRef< ILayoutBlock >& Block, const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren ) const override;
|
|
|
|
virtual void BeginLayout() override {}
|
|
virtual void EndLayout() override {}
|
|
|
|
virtual int32 GetTextIndexAt( const TSharedRef< ILayoutBlock >& Block, const FVector2D& Location, float Scale, ETextHitPoint* const OutHitPoint = nullptr ) const override;
|
|
|
|
virtual FVector2D GetLocationAt(const TSharedRef< ILayoutBlock >& Block, int32 Offset, float Scale) const override;
|
|
|
|
virtual void Move(const TSharedRef<FString>& NewText, const FTextRange& NewRange) override;
|
|
virtual TSharedRef<IRun> Clone() const override;
|
|
|
|
virtual void AppendTextTo(FString& Text) const override;
|
|
virtual void AppendTextTo(FString& AppendToText, const FTextRange& PartialRange) const override;
|
|
|
|
virtual const FRunInfo& GetRunInfo() const override;
|
|
|
|
virtual ERunAttributes GetRunAttributes() const override;
|
|
|
|
void ApplyFontSizeMultiplierOnTextStyle(float FontSizeMultiplier);
|
|
|
|
protected:
|
|
|
|
FSlateTextRun( const FRunInfo& InRunInfo, const TSharedRef< const FString >& InText, const FTextBlockStyle& InStyle );
|
|
|
|
FSlateTextRun( const FRunInfo& InRunInfo, const TSharedRef< const FString >& InText, const FTextBlockStyle& InStyle, const FTextRange& InRange );
|
|
|
|
FSlateTextRun( const FSlateTextRun& Run );
|
|
|
|
protected:
|
|
|
|
FRunInfo RunInfo;
|
|
TSharedRef< const FString > Text;
|
|
FTextBlockStyle Style;
|
|
FTextRange Range;
|
|
|
|
#if TEXT_LAYOUT_DEBUG
|
|
FString DebugSlice;
|
|
#endif
|
|
};
|