Skip to content

Commit 3463072

Browse files
Changed warning from scaffolding to indicate experimental feature. Simplified some expression for readability with pattern matching.
1 parent a457fd6 commit 3463072

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

sources/engine/Stride.Assets/SpriteFont/SpriteFontAssetCompiler.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ protected override void Prepare(AssetCompilerContext context, AssetItem assetIte
2828
UFile assetAbsolutePath = assetItem.FullPath;
2929
var colorSpace = context.GetColorSpace();
3030

31-
var fontTypeSdf = asset.FontType as SignedDistanceFieldSpriteFontType;
32-
if (fontTypeSdf != null)
31+
if (asset.FontType is SignedDistanceFieldSpriteFontType fontTypeSdf)
3332
{
3433
// copy the asset and transform the source and character set file path to absolute paths
3534
var assetClone = AssetCloner.Clone(asset);
@@ -76,8 +75,7 @@ protected override void Prepare(AssetCompilerContext context, AssetItem assetIte
7675
}
7776
else
7877
{
79-
var fontTypeStatic = asset.FontType as OfflineRasterizedSpriteFontType;
80-
if (fontTypeStatic == null)
78+
if (asset.FontType is not OfflineRasterizedSpriteFontType fontTypeStatic)
8179
throw new ArgumentException("Tried to compile a non-offline rasterized sprite font with the compiler for offline resterized fonts!");
8280

8381
// copy the asset and transform the source and character set file path to absolute paths
@@ -104,15 +102,13 @@ public OfflineRasterizedFontCommand(string url, SpriteFontAsset description, Col
104102
public override IEnumerable<ObjectUrl> GetInputFiles()
105103
{
106104
var asset = Parameters;
107-
var fontTypeStatic = asset.FontType as OfflineRasterizedSpriteFontType;
108-
if (fontTypeStatic != null)
105+
if (asset.FontType is OfflineRasterizedSpriteFontType fontTypeStatic)
109106
{
110107
if (File.Exists(fontTypeStatic.CharacterSet))
111108
yield return new ObjectUrl(UrlType.File, fontTypeStatic.CharacterSet);
112109
}
113110

114-
var fontTypeSdf = asset.FontType as SignedDistanceFieldSpriteFontType;
115-
if (fontTypeSdf != null)
111+
if (asset.FontType is SignedDistanceFieldSpriteFontType fontTypeSdf)
116112
{
117113
if (File.Exists(fontTypeSdf.CharacterSet))
118114
yield return new ObjectUrl(UrlType.File, fontTypeSdf.CharacterSet);
@@ -226,10 +222,7 @@ public RuntimeSignedDistanceFieldFontCommand(string url, SpriteFontAsset descrip
226222

227223
protected override Task<ResultStatus> DoCommandOverride(ICommandContext commandContext)
228224
{
229-
// M1 NOTE:
230-
// This is a scaffolding step. We serialize a functional font so the pipeline works end-to-end.
231-
// In M3/M4, this will be replaced by a real Runtime MSDF font object.
232-
commandContext.Logger.Warning("Runtime SDF font is currently scaffolded in M1 (temporary). It will behave like a runtime raster font until the MSDF runtime generator is implemented.");
225+
commandContext.Logger.Warning("Runtime SDF font is currently an experimental feature.");
233226

234227
var runtimeSdfType = (RuntimeSignedDistanceFieldSpriteFontType)Parameters.FontType;
235228

0 commit comments

Comments
 (0)