Skip to content

@jsvision/core / degradeCapsForWidth

Function: degradeCapsForWidth()

degradeCapsForWidth(caps, result): CapabilityProfile

Defined in: host/width-probe.ts:333

Apply a probe outcome to a capability profile — downgrade only, never upgrade. A wide arrow group turns ambiguousWide on; a wide box group turns boxDrawing and halfBlocks off. Returns the same object reference when nothing changed. Pure.

Parameters

caps

CapabilityProfile

The capability profile to degrade.

result

WidthProbeResult

A completed WidthProbeResult.

Returns

CapabilityProfile

A new profile with the affected glyph flags degraded, or caps unchanged.

Example

ts
import { probeAmbiguousWidth, degradeCapsForWidth, serialize } from '@jsvision/core';

// Adapt your render caps so every subsequent frame emits aligned chrome.
const result = await probeAmbiguousWidth(query);
const renderCaps = degradeCapsForWidth(caps, result);
// ... serialize(frame, prev, { caps: renderCaps }) ...