TerminalStyle.fromTextStyle constructor

TerminalStyle.fromTextStyle(
  1. TextStyle textStyle
)

Implementation

factory TerminalStyle.fromTextStyle(TextStyle textStyle) {
  return TerminalStyle(
    fontSize: textStyle.fontSize ?? _kDefaultFontSize,
    height: textStyle.height ?? _kDefaultHeight,
    fontFamily: textStyle.fontFamily ??
        textStyle.fontFamilyFallback?.first ??
        _kDefaultFontFamily,
    fontFamilyFallback:
        textStyle.fontFamilyFallback ?? _kDefaultFontFamilyFallback,
    // TextStyle has no field for this terminal-specific behavior, so there
    // is nothing to read off `textStyle`. Falling through to the
    // constructor default (rather than hardcoding `true` here) keeps this
    // factory from silently overriding a caller's ability to change that
    // default in one place.
    enableLigatures: _requestsLigatures(textStyle.fontFeatures),
  );
}