Text, fonts, and images
Make text readable and images predictable before adding decoration. A page that looks correct with one short English label may still fail with a longer title, another script, or a missing asset.
Start with a Label
Label draws one line of text. It measures using its Font and exposes FontFamily, FontSize, FontWeight, FontStyle, LineHeight, and TextColor for simpler changes. Assigning Text requests the layout work required for the new content.
This constructor-body fragment creates an explicit title style:
var title = new Xui.Core.UI.Label
{
Text = "A walk by the river",
FontFamily = "Inter",
FontSize = 24,
FontWeight = Xui.Core.Canvas.FontWeight.SemiBold,
Margin = 16
};
A label does not automatically wrap, truncate with an ellipsis, or lay out a paragraph. For a long description, choose a text layout strategy deliberately instead of assuming that constraining MaximumWidth adds wrapping.
Make the font available
The starter registers Xui.Core.Fonts.Inter.Source as IFontSource. That source gives runtimes and software measurement a consistent bundled font. A family name alone does not package a font.
For custom fonts, supply the font data through the runtime's supported font source path and verify both drawing and measurement. Browser loading and native font lookup can differ. Test the glyphs your users need; a measured width in one fallback font is not reliable for rendering with another.
Size images deliberately
ImageView.Source asks the platform's image service to load a URI. The URI must resolve on the chosen host: a native packaged asset, a served browser resource, and a remote URL have different deployment requirements. Do not hardcode a development-machine path into shared app code.
ImageView measures from intrinsic image size and limits its desired size to fit the available dimensions without upscaling during measurement. Its renderer draws into the final Frame. If a parent stretches both axes into an unrelated aspect ratio, that final rectangle can still distort the image. Use non-stretch alignment or a container that computes an aspect-fit rectangle when preserving the ratio matters.
Loading is not always immediate. An unavailable image service or an image with an empty intrinsic size gives the view no useful measured image size. Reserve a placeholder and handle loading failures if the image is essential content.
For custom text alignment, baselines, or vector output, continue in the Canvas section of Reference.