Problem/Motivation

Font size and line height values are set inconsistently throughout the theme. In an attempt to address this and provide more consistency across a site and more easily follow how our designers approach typography, we want to implement a type system based on a typographic scale.

Proposed resolution

Add a new type scale sass map along with the needed mixins to convert it into a series of css custom properties. Update existing font-size and line-height declarations.

$typographic-scale: (
  category1: (
    size1: (
      breakpoint1: (fontSizePixelValue, lineHeightPixelValue),
      breakpoint2: (fontSizePixelValue, lineHeightPixelValue),
      ...
    ),
    size2: ( ... ),
    ...
  ),
  category2: ( ... ),
  ...
);

Example...

$typographic-scale: (
  heading: (
    96: (
      mobile: (44, 52),
      tablet: (52, 60),
      sm-desktop: (72, 72),
      desktop: (96, 92),
    ),
    52: (
      mobile: (32, 36),
      tablet: (42, 48),
      sm-desktop: (44, 52),
      desktop: (52, 60),
    ),
   ...
  body: (
    ...
  )
);

Usage

h1 {
  @include type-scale(heading, 96);
}

Remaining tasks

Review the general approach. Determine the minimum default type-scale needed out of the box.

API changes

The @mixin font() has been replaced with a slightly different @mixin type-scale().

Issue fork prototype-3417984

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pixelwhip created an issue. See original summary.

pixelwhip’s picture

Version: 5.1.x-dev » 5.x-dev

pixelwhip’s picture

Assigned: Unassigned » jldust
Status: Active » Needs review

jldust made their first commit to this issue’s fork.

jldust’s picture

Assigned: jldust » pixelwhip

  • jldust committed 4fe63831 on 5.x authored by pixelwhip
    Issue #3417984 by pixelwhip, jldust: Set font-sizes and line-heights...
jldust’s picture

Assigned: pixelwhip » Unassigned
Status: Needs review » Fixed

This looks great and has been merged into the 5.x branch, we will include it in the next tagged release.

jldust’s picture

Status: Fixed » Closed (fixed)