UNPKG

matrix-react-sdk

Version:
71 lines (70 loc) 2.47 kB
import IWatcher from "./Watcher"; export declare class FontWatcher implements IWatcher { /** * This Compound value is using `100%` of the default browser font size. * It allows EW to use the browser's default font size instead of a fixed value. * All the Compound font size are using `rem`, they are relative to the root font size * and therefore of the browser font size. */ private static readonly DEFAULT_SIZE; /** * Default delta added to the ${@link DEFAULT_SIZE} */ static readonly DEFAULT_DELTA = 0; private dispatcherRef; constructor(); start(): Promise<void>; /** * Migrate the base font size from the V1 and V2 version to the V3 version * @private */ private migrateBaseFontSize; /** * Migrating from the V1 version of the base font size to the new delta system. * The delta system is using the default browser font size as a base * Everything will become slightly larger, and getting rid of the `SIZE_DIFF` * weirdness for locally persisted values * @private */ private migrateBaseFontV1toFontSizeDelta; /** * Migrating from the V2 version of the base font size to the new delta system * @private */ private migrateBaseFontV2toFontSizeDelta; /** * Compute the V2 font size from the V1 font size * @param legacyBaseFontSize * @private */ private computeBaseFontSizeV1toV2; /** * Compute the difference between the V2 font size and the default browser font size * @param legacyBaseFontV2Size * @private */ private computeFontSizeDeltaFromV2BaseFontSize; /** * Get the root font size of the document * Fallback to 16px if the value is not found * @returns {number} */ static getRootFontSize(): number; /** * Get the browser default font size * @returns {number} the default font size of the browser */ static getBrowserDefaultFontSize(): number; stop(): void; private updateFont; private onAction; /** * Set the root font size of the document * @param delta {number} the delta to add to the default font size */ private setRootFontSize; static readonly FONT_FAMILY_CUSTOM_PROPERTY = "--cpd-font-family-sans"; static readonly EMOJI_FONT_FAMILY_CUSTOM_PROPERTY = "--emoji-font-family"; static readonly BUNDLED_EMOJI_FONT = "Twemoji"; private setSystemFont; }