getFont method

Font getFont(
  1. String fontFamily,
  2. String fontStyle,
  3. String fontWeight
)

Implementation

Font getFont(String fontFamily, String fontStyle, String fontWeight) {
  switch (fontFamily) {
    case 'serif':
      switch (fontStyle) {
        case 'normal':
          switch (fontWeight) {
            case 'normal':
            case 'lighter':
              return Font.times();
          }
          return Font.timesBold();
      }
      switch (fontWeight) {
        case 'normal':
        case 'lighter':
          return Font.timesItalic();
      }
      return Font.timesBoldItalic();

    case 'monospace':
      switch (fontStyle) {
        case 'normal':
          switch (fontWeight) {
            case 'normal':
            case 'lighter':
              return Font.courier();
          }
          return Font.courierBold();
      }
      switch (fontWeight) {
        case 'normal':
        case 'lighter':
          return Font.courierOblique();
      }
      return Font.courierBoldOblique();
  }

  switch (fontStyle) {
    case 'normal':
      switch (fontWeight) {
        case 'normal':
        case 'lighter':
          return Font.helvetica();
      }
      return Font.helveticaBold();
  }
  switch (fontWeight) {
    case 'normal':
    case 'lighter':
      return Font.helveticaOblique();
  }
  return Font.helveticaBoldOblique();
}