getTextStyle static method

TextStyle getTextStyle(
  1. Map<String, dynamic> props,
  2. ChantContext ctxt,
  3. double? resize
)

Computes the effective TextStyle for given CSS-ish styling props.

Implementation

static TextStyle getTextStyle(
  Map<String, dynamic> props,
  ChantContext ctxt,
  double? resize,
) {
  final fontSize = props['font-size'] ?? props['base-font-size'];
  final fontFamily = parseFontFallback(
    props['font-family'] ?? props['base-font-family'],
  );
  return TextStyle(
    color: _colorFromCss(props['fill'], ctxt.theme.textColor),
    fontFamilyFallback: fontFamily,
    fontSize: fontSize * (resize ?? 1),
    height: props['line-height'],
    fontStyle: props['font-style'],
    fontWeight: props['font-weight'],
    fontFeatures: props['font-variant'],
  );
}