Show 50 known telemetry rows with your own font
Render a bounded owned list with ImGuiSdk 0.1.47, a supplied TTF and local font selection until Stop.
Show 50 known telemetry rows with your own font
Display a fixed list of 50 sample values in a native ImGui panel using your own font. These values are generated by the script; there is no process-memory or game-data source.
Use a Windows desktop EyeAuras host compatible with EyeAuras.ImGuiSdk 0.1.47, its EyeAuras.ClickableTransparentOverlay 11.5.28 dependency and the required native graphics components. The package targets .NET 8 Windows. A package reference supplies types; it does not make an incompatible host or missing native provider ready. Do not load a second ImGui.NET/CTO version into the process.
- Prepare an actual TTF you are allowed to use, containing Latin glyphs and any Cyrillic glyphs you need. Rename your supplied copy
RecipeSans.ttf; the name does not establish its glyph coverage. This Wiki does not provide or download the font. - Create your own aura
RecipeTelemetrywith Actions → On Enter → C# Script, using manual Run. In its script file tree choose Add → Existing File(s)..., import that font as a resource and Rename it tofonts/RecipeSans.ttf. Keep one matching resource. - Replace Script.csx with the complete program below. Keep one
#rfor 0.1.47, using the EyeAuras package source. The explicit container extension registers the service before it is resolved. - After dependency restore and compilation, click Run. Known telemetry should contain
Sample 01: 10throughSample 50: 500; scroll within the panel to reach the last row. The local 20 px font becomes available after the atlas rebuild, so the first frame may still use the previous font. - Click Stop. The next functioning render callback removes this Run's font specification and acknowledges it. Only then does the owning block remove rendering and release its API share. Run again creates a new registration. To see a deliberate data change, change
value * 10tovalue * 20, recompile and Run; the rows become20through1000.
Script.csx
#r "nuget:EyeAuras.ImGuiSdk, 0.1.47"
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using EyeAuras.ImGuiSdk;
using EyeAuras.Repl;
using ImGuiNET;
{
var files = GetService<IScriptFileProvider>();
var file = files.GetFileInfo("fonts/RecipeSans.ttf");
if (!file.Exists) throw new FileNotFoundException("Add your own fonts/RecipeSans.ttf.");
byte[] fontBytes;
using (var input = file.CreateReadStream())
using (var output = new MemoryStream())
{
await input.CopyToAsync(output, cancellationToken);
fontBytes = output.ToArray();
}
var rows = Enumerable.Range(1, 50)
.Select(value => $"Sample {value:00}: {value * 10}").ToArray();
AddNewExtension<ImGuiContainerExtensions>();
using var imgui = GetService<IImGuiExperimentalApi>();
var gate = new object();
var stopping = false;
ImGuiFontSpec font = default;
var removed = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
using var rendering = imgui.AddRenderer(_ =>
{
lock (gate)
{
if (stopping)
{
if (font.IsInitialized) imgui.RemoveFont(font);
font = default;
removed.TrySetResult(true);
return;
}
if (!font.IsInitialized)
font = imgui.AddFont(fontBytes, 20, "RecipeSans", ImGuiFontRangeType.Cyrillic);
ImGuiEx.PushFont(font);
try
{
var visible = ImGui.Begin("Known telemetry##recipe-telemetry");
try
{
if (visible)
foreach (var row in rows) ImGui.TextUnformatted(row);
}
finally { ImGui.End(); }
}
finally { ImGuiEx.PopFont(font); }
}
});
try { await Task.Delay(Timeout.Infinite, cancellationToken); }
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) { }
finally
{
lock (gate) stopping = true;
await removed.Task;
}
}
| Part | Responsibility |
|---|---|
rows | One fixed 50-entry array built before rendering; no unbounded history or background producer. |
AddFont(..., 20, "RecipeSans", Cyrillic) | Copies genuine TTF bytes and registers size/range on the render thread. It cannot add missing glyphs. |
ImGuiFontSpec | A Run-local specification, not a static native pointer reused after context disposal. |
ImGuiEx.PushFont / PopFont | Select the font only around this drawing, with balanced calls in the same frame. They do nothing while its native font is not ready. |
Begin / End | Balanced even when the panel's content is collapsed. |
removed.Task | Acknowledges removal from a live render callback before API release; it is not a native shutdown timeout. |
The borrowed file provider is not disposed. The input stream and temporary memory stream are owned and closed before rendering. AddFont makes its own native copy, so no caller GCHandle pin or unsafe pointer is required. The SDK intentionally retains that native byte allocation even after RemoveFont removes its specification; do not turn this example into repeated font loading every frame or an unlimited font-switching loop.
The atlas and Main overlay are shared. This program never changes their default font, closes the shared window directly or keeps an ImFontPtr across an atlas rebuild. Its wait runs outside the callback; Stop cleanup needs the frame loop to remain operational. A failed native renderer can prevent that acknowledgement.
ImGui setup covers the host and registration. Local font selection explains ownership; embedded resources explains logical paths and manifest names.