当前位置: 首页>>代码示例>>C++>>正文


C++ TSharedRef::GetCharacterList方法代码示例

本文整理汇总了C++中TSharedRef::GetCharacterList方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedRef::GetCharacterList方法的具体用法?C++ TSharedRef::GetCharacterList怎么用?C++ TSharedRef::GetCharacterList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSharedRef的用法示例。


在下文中一共展示了TSharedRef::GetCharacterList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetCharKerning

int8 UFont::GetCharKerning(TCHAR First, TCHAR Second) const
{
	switch(FontCacheType)
	{
	case EFontCacheType::Offline:
		{
			return static_cast<int8>(Kerning);
		}
		break;

	case EFontCacheType::Runtime:
		{
			TSharedRef<FSlateFontCache> FontCache = FSlateApplication::Get().GetRenderer()->GetFontCache();
	
			const float FontScale = 1.0f;
			const FSlateFontInfo LegacyFontInfo = GetLegacySlateFontInfo();
			FCharacterList& CharacterList = FontCache->GetCharacterList(LegacyFontInfo, FontScale);

			return CharacterList.GetKerning(First, Second);
		}
		break;

	default:
		break;
	}

	return 0;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:28,代码来源:Font.cpp

示例2: GetCharHorizontalOffset

int16 UFont::GetCharHorizontalOffset(TCHAR InCh) const
{
	if(FontCacheType == EFontCacheType::Runtime)
	{
		TSharedRef<FSlateFontCache> FontCache = FSlateApplication::Get().GetRenderer()->GetFontCache();
	
		const float FontScale = 1.0f;
		const FSlateFontInfo LegacyFontInfo = GetLegacySlateFontInfo();
		FCharacterList& CharacterList = FontCache->GetCharacterList(LegacyFontInfo, FontScale);

		const FCharacterEntry& Entry = CharacterList[InCh];
		return Entry.HorizontalOffset;
	}

	return 0;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:16,代码来源:Font.cpp

示例3: GetCharSize

void UFont::GetCharSize(TCHAR InCh, float& Width, float& Height) const
{
	Width = Height = 0.f;

	switch(FontCacheType)
	{
	case EFontCacheType::Offline:
		{
			const int32 Ch = (int32)RemapChar(InCh);
			if( Ch < Characters.Num() )
			{
				const FFontCharacter& Char = Characters[Ch];
				if( Char.TextureIndex < Textures.Num() && Textures[Char.TextureIndex] != NULL )
				{
					Width = Char.USize;

					// The height of the character will always be the maximum height of any character in this
					// font.  This ensures consistent vertical alignment of text.  For example, we don't want
					// vertically centered text to visually shift up and down as characters are added to a string.
					// NOTE: This also gives us consistent alignment with fonts generated by the legacy importer.
					const int32 MultiFontIndex = Ch / NumCharacters;
					Height = MaxCharHeight[ MultiFontIndex ];
				}
			}
		}
		break;

	case EFontCacheType::Runtime:
		{
			TSharedRef<FSlateFontCache> FontCache = FSlateApplication::Get().GetRenderer()->GetFontCache();
	
			const float FontScale = 1.0f;
			const FSlateFontInfo LegacyFontInfo = GetLegacySlateFontInfo();
			FCharacterList& CharacterList = FontCache->GetCharacterList(LegacyFontInfo, FontScale);

			const FCharacterEntry& Entry = CharacterList[InCh];
			Width = Entry.XAdvance;

			// The height of the character will always be the maximum height of any character in this font
			Height = CharacterList.GetMaxHeight();
		}
		break;

	default:
		break;
	}
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:47,代码来源:Font.cpp

示例4: GetMaxCharHeight

float UFont::GetMaxCharHeight() const
{
	float MaxHeight = 0.0f;

	switch(FontCacheType)
	{
	case EFontCacheType::Offline:
		{
			// @todo: Provide a version of this function that supports multi-fonts properly.  It should take a
			//    HeightTest parameter and report the appropriate multi-font MaxCharHeight value back.
			int32 MaxCharHeightForAllMultiFonts = 1;
			for( int32 CurMultiFontIndex = 0; CurMultiFontIndex < MaxCharHeight.Num(); ++CurMultiFontIndex )
			{
				MaxCharHeightForAllMultiFonts = FMath::Max( MaxCharHeightForAllMultiFonts, MaxCharHeight[ CurMultiFontIndex ] );
			}
			MaxHeight = MaxCharHeightForAllMultiFonts;
		}
		break;

	case EFontCacheType::Runtime:
		{
			TSharedRef<FSlateFontCache> FontCache = FSlateApplication::Get().GetRenderer()->GetFontCache();
	
			const float FontScale = 1.0f;
			const FSlateFontInfo LegacyFontInfo(this, LegacyFontSize);
			FCharacterList& CharacterList = FontCache->GetCharacterList(LegacyFontInfo, FontScale);

			MaxHeight = CharacterList.GetMaxHeight();
		}
		break;

	default:
		break;
	}

	return MaxHeight;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:37,代码来源:Font.cpp


注:本文中的TSharedRef::GetCharacterList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。