Skip to content

Main content

CSS Font Family List Formatter

Format literal font family names as double-quoted escaped CSS strings using JSON-compatible escapes; control characters are rejected, generic keywords become literal family names.

Loading tool…

Description

Format literal font family names as double-quoted escaped CSS strings using JSON-compatible escapes; control characters are rejected, generic keywords become literal family names.

CSS combines token syntax, property-specific value rules and layout/cascade processing. These are separate layers: splitting a declaration does not establish that its value is valid, and arithmetic on resolved lengths does not perform browser layout. Each tool here handles an explicit numeric representation or a stated lexical subset.

Format literal font family names as double-quoted escaped CSS strings using JSON-compatible escapes; control characters are rejected, generic keywords become literal family names.

When to use this tool

Use this tool to format literal font family names as double-quoted escaped CSS strings using JSON-compatible escapes; control characters are rejected, generic keywords become literal family names.

How to use the tool and how it works

  1. Enter families using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.text. Interpret signs, units, ordering and null values using the rules below.

Require a nonempty list of nonempty family strings without C0 or DEL controls. JSON-double-quote each name and join with comma-space.1, 2

Input fieldMeaning and unitsAccepted input
familiesNonempty literal font-family strings; generic keywords become quoted literal names when formatted.Dense list of at most 128 strings, each at most 8,192 UTF-16 code units.
Output fieldInterpretation
resultObject containing the fields below.
result.textSerialized literal quoted family-name list.
json
{
  "input": {
    "families": [
      "A B",
      "serif"
    ]
  },
  "output": {
    "result": {
      "text": "\"A B\", \"serif\""
    }
  }
}

Limitations and assumptions

  • Every item becomes a literal quoted family name: serif is emitted as a named family, not the unquoted generic-family keyword.
  • Lengths and times must already be resolved to consistent numeric units. Lexical helpers intentionally support smaller grammars than a full browser CSS parser; malformed supported-subset input causes an error.
  • Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Use a full CSS parser or browser style/layout APIs when escape handling, error recovery, computed styles or the full cascade matter. These tools expose focused transformations and audits of supplied data.

References

  1. CSS Fonts: Font Family Names — W3C

  2. Tool behavior and example: CSS Font Family List Formatter — tool.io

Similar or alternative tools

  • CSS Font Family List Parser

    Parse a restricted CSS font-family list of JSON-double-quoted strings or valid unescaped ASCII identifier sequences; CSS escape and single-quoted syntax is intentionally rejected.

  • CSS Animation List Slot Pairing

    Pair explicit animation names with cyclic duration/delay lists; no shorthand parsing, timing interpolation or special all/none expansion.