Skip to content
PACKAGES

tryMeasureHyphenWidth()

Measure hyphen width when the adapter supports it.

import { tryMeasureHyphenWidth } from "@graphrefly/ts/solutions/reactive-layout";
function tryMeasureHyphenWidth(
adapter: MeasurementAdapter,
font: string,
): number | undefined
ParameterTypeDescription
adapterMeasurementAdapterMeasurement adapter to query.
fontstringFont string passed to the adapter.

The hyphen width, or undefined when measurement fails.

tryMeasureHyphenWidth(adapter, "16px sans-serif");

packages/ts/src/solutions/reactive-layout/measurements.ts