function parseFont(str, defaultHeight) {
  // Try for required properties first.
  const sizeFamily = sizeFamilyRe.exec(str);
  if (!sizeFamily) return; // invalid

  const lineHeight = parseFloat(sizeFamily[3]); // Default values and required properties

  const font = {
    weight: 'normal',
    style: 'normal',
    stretch: 'normal',
    variant: 'normal',
    size: parseFloat(sizeFamily[1]),
    unit: sizeFamily[2],
    lineHeight: Number.isFinite(lineHeight) ? lineHeight : undefined,
    lineHeightUnit: sizeFamily[4],
    family: sizeFamily[5].replace(/ *, */g, ',')
  }; // Stop search at `sizeFamily.index`

  const substr = str.substring(0, sizeFamily.index); // Optional, unordered properties.

  const weight = weightRe.exec(substr),
        style = styleRe.exec(substr),
        variant = variantRe.exec(substr),
        stretch = stretchRe.exec(substr);
  if (weight) font.weight = weight[1];
  if (style) font.style = style[1];
  if (variant) font.variant = variant[1];
  if (stretch) font.stretch = stretch[1];
  font.pxHeight = sizeToPixel({
    size: font.size,
    unit: font.unit
  }, defaultHeight);
  font.pxLineHeight = sizeToPixel({
    size: font.lineHeight || font.size,
    unit: font.lineHeightUnit || font.unit
  }, defaultHeight);
  return font;
}
Parse font `str`.

@param {String} str
@return {Object} Parsed font. `size` is in device units. `unit` is the unit
  appearing in the input string.
@api private