{"record":{"id":"7f2415d5197ea32a","repo":"stride3d/stride","slug":"tried-to-compile-a-non-offline-rasterized-sprite-font-with","errorCode":null,"errorMessage":"Tried to compile a non-offline rasterized sprite font with the compiler for offline resterized fonts!","messagePattern":"Tried to compile a non-offline rasterized sprite font with the compiler for offline resterized fonts!","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Assets/SpriteFont/SpriteFontAssetCompiler.cs","lineNumber":65,"sourceCode":"                    if (fontPathOnDisk == null)\n                    {\n                        result.Error($\"Runtime rasterized font compilation failed. Font {asset.FontSource.GetFontName()} was not found on this machine.\");\n                        result.BuildSteps = new AssetBuildStep(assetItem);\n                        result.BuildSteps.Add(new FailedFontCommand());\n                        return;\n                    }\n\n                    var fontImportLocation = FontHelper.GetFontPath(asset.FontSource.GetFontName(), asset.FontSource.Style);\n\n                    result.BuildSteps = new AssetBuildStep(assetItem);\n                    result.BuildSteps.Add(new ImportStreamCommand { SourcePath = fontPathOnDisk, Location = fontImportLocation });\n                    result.BuildSteps.Add(new RuntimeRasterizedFontCommand(targetUrlInStorage, asset, assetItem.Package));\n                }\n                else\n                {\n                    var fontTypeStatic = asset.FontType as OfflineRasterizedSpriteFontType;\n                    if (fontTypeStatic == null)\n                        throw new ArgumentException(\"Tried to compile a non-offline rasterized sprite font with the compiler for offline resterized fonts!\");\n\n                    // copy the asset and transform the source and character set file path to absolute paths\n                    var assetClone = AssetCloner.Clone(asset);\n                    var assetDirectory = assetAbsolutePath.GetParent();\n                    assetClone.FontSource = asset.FontSource;\n                    fontTypeStatic.CharacterSet = !string.IsNullOrEmpty(fontTypeStatic.CharacterSet) ? UPath.Combine(assetDirectory, fontTypeStatic.CharacterSet): null;\n\n                    result.BuildSteps = new AssetBuildStep(assetItem);\n                    result.BuildSteps.Add(new OfflineRasterizedFontCommand(targetUrlInStorage, assetClone, colorSpace, assetItem.Package));\n                }\n        }\n\n        internal class OfflineRasterizedFontCommand : AssetCommand<SpriteFontAsset>\n        {\n            private ColorSpace colorspace;\n\n            public OfflineRasterizedFontCommand(string url, SpriteFontAsset description, ColorSpace colorspace, IAssetFinder assetFinder)\n                : base(url, description, assetFinder)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Assets/SpriteFont/SpriteFontAssetCompiler.cs#L47-L83","documentation":"SpriteFontAssetCompiler.Prepare has two compile paths: runtime-rasterized fonts and offline-rasterized fonts. When the runtime path is not taken, it demands the FontType be an OfflineRasterizedSpriteFontType; anything else (e.g. RuntimeRasterizedSpriteFontType or SDF types) that reached this compiler is a programming/config error and throws ArgumentException.","triggerScenarios":"An asset whose FontType is not OfflineRasterizedSpriteFontType was routed to the offline rasterized compiler — typically the spritefont asset sets IsRuntimeRasterizedSpriteFont false (or the processor selects this compiler) while FontType is a different concrete type.","commonSituations":"Hand-edited .sfz/.sdtpl asset files where the compiler property and FontType disagree; custom build scripts invoking the wrong compiler; upgrading Stride and asset properties being remapped inconsistently.","solutions":["Open the spritefont asset in Game Studio and set the Font type to 'Offline Rasterized SpriteFont' to match this compiler.","Or set the asset to runtime rasterized so it is routed to RuntimeRasterizedFontCommand instead.","Compare the asset's serialized compiler/properties with a freshly created spritefont asset and fix the mismatch."],"exampleFix":"// before (asset properties)\nFontType: RuntimeRasterizedSpriteFontType { }\nCompiler: OfflineRasterizedFontCompiler\n// after\nFontType: OfflineRasterizedSpriteFontType { CharacterSet: ... }","handlingStrategy":"validation","validationCode":"if (asset.FontType is not OfflineRasterizedSpriteFontType)\n    throw new InvalidOperationException(\"Asset must use OfflineRasterizedSpriteFontType for this compiler\");","typeGuard":"bool IsOfflineRasterized(SpriteFontAsset a) => a.FontType is OfflineRasterizedSpriteFontType;","tryCatchPattern":"try\n{\n    PrepareOfflineFont(asset);\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"non-offline rasterized\"))\n{\n    logger.Error($\"{asset.Url}: FontType/compiler mismatch — set the font to offline rasterized or use the runtime compiler.\");\n}","preventionTips":["Create spritefont assets through Game Studio instead of hand-editing files","Keep the compiler selection and FontType in sync when scripting asset creation","Diff customized spritefont assets against freshly created ones after upgrades"],"tags":["asset-compiler","spritefont","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}