Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import { ToolModes, AnnotationStyleStates } from '../../../enums';
import { getStyleProperty } from './helpers';
import { StyleSpecifier } from '../../../types/AnnotationStyle';
/**
* getFont - Returns a font string of the form "{fontSize}px fontName" used by `canvas`.
* @param styleSpecifier - An object containing the specifications such as viewportId,
* toolGroupId, toolName and annotationUID which are used to get the style if the level of specificity is
* met (hierarchy is checked from most specific to least specific which is
* annotationLevel -> viewportLevel -> toolGroupLevel -> default.
* @param state - An optional state to determine the final property name
* @param mode - An optional mode to determine the final property name
* @returns The font string.
*/
function getFont(
styleSpecifier: StyleSpecifier,
state?: AnnotationStyleStates,
mode?: ToolModes
): string {
const fontSize = getStyleProperty(
'textBoxFontSize',
styleSpecifier,
state,
mode
);
const fontFamily = getStyleProperty(
'textBoxFontFamily',
styleSpecifier,
state,
mode
);
return `${fontSize}px ${fontFamily}`;
}
export default getFont;
|