convertFontSize method

double convertFontSize(
  1. num fontSize, {
  2. bool? allowFontScaling,
  3. bool? allowSubpixel,
})

字体大小适配方法 @param fontSize UI设计上字体的大小,单位px. Font size adaptation method @param fontSize The size of the font on the UI design, in px. @param allowFontScaling

Implementation

double convertFontSize(num fontSize,
    {bool? allowFontScaling, bool? allowSubpixel}) {
  allowSubpixel ??= this.allowSubpixel;
  allowFontScaling ??= this.allowFontScaling;
  var scaling = allowFontScaling
      ? (scaleText * fontSize)
      : ((scaleText * fontSize) / textScaleFactor);

  return allowSubpixel ? scaling : scaling.roundToDouble();
}