Loomguides

Fonts and text metrics

Which Roblox font families ship, how to register the others, and how loom sizes and wraps text.

The preview loads Roblox’s open typefaces for you. There is nothing to install or import, and React and Vide previews get the same faces.

This matters for layout, not just looks. AutomaticSize and TextWrapped work by measuring text. Without the right face, the browser falls back to a different system font on each OS, and the same scene lays out differently on each machine.

The families that ship a face

These are bundled as Fontsource woff2 files. No CDN, nothing installed on the machine.

Roblox familyTypeface
SourceSans*Source Sans 3
Roboto*Roboto
RobotoMono*Roboto Mono
RobotoCondensedRoboto Condensed
Inconsolata / CodeInconsolata
ArimoArimo
Jura Merriweather Nunito Oswald Ubuntu TitilliumWebtheir own
JosefinSans GrenzeGotisch Sarpanch Michromatheir own
AmaticSC Bangers Creepster DenkOne Fondamentotheir own
IndieFlower Kalam LuckiestGuy PatrickHand PermanentMarker SpecialElitetheir own
FredokaOneFredoka. Google folded “Fredoka One” into Fredoka’s heavier weights, so this one is an approximation.

That is 28 families, all OFL-1.1 except Ubuntu.

Arial and Legacy need nothing. Every machine has Arial, and the bundled Arimo has the same metrics.

A page only downloads the families and scripts its scenes actually paint with. See What comes out for the size of a static build.

Named, but not loaded

Loom can’t ship the proprietary Gotham and BuilderSans, or Bodoni, Garamond, Cartoon, SciFi, Arcade, Fantasy, Antique and Highway. Each resolves to a font stack led by the right typeface, so a machine that has the real font uses it. Otherwise loom falls back and warns.

Enum.Font has all 53 of the engine’s items, in the engine’s order, so a scene that names any of them runs.

Registering a face yourself

Use registerFont to install a typeface for a Roblox family. If you have the Gotham files:

import { registerFont } from "@loom-dev/renderer";
import gotham from "./fonts/Gotham-VF.woff2";
registerFont("Gotham", {
family: "Gotham",
faces: [{ src: gotham, weight: "100 900" }],
});

@loom-dev/renderer is a transitive dependency. Declare it to import it directly:

Terminal window
pnpm add -D @loom-dev/renderer

If the page already provides the font (a CDN <link>, your own @font-face, or a font installed on the machine), leave out faces and just name it:

registerFont("SourceSans", { family: "Source Sans 3 Variable" });

A registration replaces whatever loom shipped for that family, so this is also how you swap one out.

The registration shape

FieldTypeNotes
familystringRequired. The CSS family to paint and measure with. With faces, also the name they are declared under.
faces{ src, weight?, style?, display? }[]@font-face rules to declare. src is a URL the page can load, usually a bundler import. weight defaults to 400 and takes a range ("200 900") for a variable font. style defaults to normal, display to swap.
fallbackstringAppended after family. Defaults to that family’s default stack.

One key per family

Register the family once and every spelling of it is covered. Roblox writes a family several ways: GothamBold from a legacy Enum.Font item, or GothamSSm from a FontFace asset. Loom matches by prefix, longest first, so RobotoMono is never read as Roboto and weight suffixes come free.

The aliases worth knowing:

SpellingRegisters as
GothamSSmGotham
SourceSansProSourceSans
CodeInconsolata
FredokaFredokaOne
LegacyArialLegacy
HighwayGothicHighway

A name outside the family table uses the generic sans stack and can’t be registered.

A late face re-lays-out

You can register a font at any time. When a registration lands or a @font-face finishes downloading, every AutomaticSize bound measured with the old font is dropped and re-measured.

The first layout waits up to 1.5 seconds for each font it measured that hasn’t loaded yet. That keeps a component that sizes itself from AbsoluteSize from locking in widths measured with the fallback.

A registered face loads when text first paints in it, not when you register it. Loom re-measures on every loadingdone event from document.fonts. To hook in yourself:

import { onFontsChanged } from "@loom-dev/renderer";
const stop = onFontsChanged(() => {
// every text measurement taken before this is stale
});

clearRegisteredFonts() removes every registration and the @font-face rules loom added. It is mostly useful in tests.

TextSize is not a font size

Roblox fits the whole face, ascender to descender, into TextSize. A one-line label is exactly TextSize tall. CSS font-size sets the em square instead, which is smaller. Painting font-size: TextSize would draw every glyph too big, by 17% for Roboto and 47% for Oswald.

So loom divides TextSize by the face’s height. Text then sizes the way the engine sizes it:

  • LineHeight is set in pixels from TextSize, as in the engine.
  • A <font size="…"> run in RichText converts using the face that run is painted in.
  • Every shipped family uses the engine’s own ratio, calibrated against TextService:GetTextBoundsAsync.
  • Any other family, including one you registered and Gotham, uses the height the browser reports.

The calibrated ratio applies only once the browser really has the face. Until then, loom measures the fallback it is actually painting, and re-measures when the face arrives. familyIsAvailable is exported if you register your own faces and need the same check.

Painted text is also kept inside the engine’s box. If the browser shapes a line wider than the engine would, the paint is tightened to fit.

Where a line breaks

Loom measures strings the way the engine does, not the way a browser does:

  • Each grapheme advances on a half-pixel boundary. Browser canvas measurement is a few percent narrower and wraps long paragraphs at different words.
  • Runs are kerned: AV is 19.5 units wide, where A and V alone are 10.5 and 10.
  • One function decides every wrap, for both measuring and painting. RichText runs go through the same wrap, each measured in its own <font>.

React and Vide measure the same way, so a live preview and a compiled scene agree.

Newlines and runs of spaces in Text are kept, wrapped or not and RichText or not, as in Roblox.

The warning

When text asks for a family with no face loaded, loom warns once:

loom: no face is loaded for the Roblox font family "Gotham" — its text is painted
and measured in the system fallback instead, which is a different typeface per OS
and does not match the engine's layout. Register one with registerFont("Gotham",
{ family, faces }), or import "@loom-dev/renderer/fonts" for the families Roblox
licenses openly.

To fix it, register a face.

  • It waits for font loading to finish, so a face that is still downloading doesn’t trigger it.
  • It also fires for a registered face whose file never arrived.
  • Arial and Legacy never warn. Both land on a font every machine has.

Loom checks availability by measuring a probe string against two very different generic fonts. A real family changes at least one width. It doesn’t use document.fonts.check(), which returns true even for a family nobody has. familyIsAvailable runs the same probe.

What is still approximate

The face, size, advances and wraps match the engine. Shaping, hinting and sub-pixel rounding are still the browser’s. In practice measurement runs about 1% wide, so text wraps slightly early rather than overflowing its box.