inter.less


Overview

The inter.less file is a CSS (Less) stylesheet that defines the font-face rules to include the Inter font family and its variations into a web project. It primarily focuses on integrating the Inter family in both its variable font and static font forms, providing a comprehensive range of font weights and styles (normal and italic). The file also includes the InterDisplay sub-family, which is a display-optimized variant of the Inter typeface.

This file enables the use of the Inter font across the application by specifying the font sources (WOFF2 files), the font weights, styles, and related CSS properties, and supports modern browsers with variable font support via a CSS @supports rule.


Detailed Explanation

Purpose


Sections and Rules

1. Variable Fonts Usage

/* Variable fonts usage:
:root { font-family: "Inter", sans-serif; }
@supports (font-variation-settings: normal) {
  :root { font-family: "InterVariable", sans-serif; font-optical-sizing: auto; }
} */

2. Variable Font @font-face Rules

@font-face {
  font-family: InterVariable;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('@/assets/inter/InterVariable.woff2') format('woff2');
}
@font-face {
  font-family: InterVariable;
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('@/assets/inter/InterVariable-Italic.woff2') format('woff2');
}

3. Static Fonts @font-face Rules

@font-face {
  font-family: 'Inter';                /* or 'InterDisplay' */
  font-style: normal | italic;
  font-weight: specific weight (100–900);
  font-display: swap;
  src: url('@/assets/inter/SpecificFont.woff2') format('woff2');
}

Usage Examples

Using Variable Fonts (recommended for modern browsers):

:root {
  font-family: "Inter", sans-serif;
}

@supports (font-variation-settings: normal) {
  :root {
    font-family: "InterVariable", sans-serif;
    font-optical-sizing: auto;
  }
}

This CSS snippet ensures that if variable fonts are supported, the variable font version is used, otherwise the static font Inter is used.

Using Specific Static Weights

body {
  font-family: 'Inter', sans-serif;
  font-weight: 400; /* Regular */
}

em {
  font-style: italic;
  font-weight: 400;
}

This will load the specific static font files defined for weight 400 in normal or italic style.


Important Implementation Details


Interaction with the System / Application


Mermaid Diagram

The file is a utility font-face definitions file with no classes or functions. The best representation is a flowchart showing the relationships between the main font categories and weights.

flowchart TD
    A[Inter Fonts] --> B[Variable Fonts]
    B --> B1[InterVariable Normal (100-900)]
    B --> B2[InterVariable Italic (100-900)]
    A --> C[Static Fonts]
    C --> C1[Inter Normal 100-900]
    C --> C2[Inter Italic 100-900]
    A --> D[InterDisplay Fonts]
    D --> D1[InterDisplay Normal 100-900]
    D --> D2[InterDisplay Italic 100-900]

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style B fill:#bbf,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    style C fill:#bfb,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    style D fill:#fbf,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5

Summary

inter.less is a foundational styling file that ensures the Inter font family is properly loaded and usable within the web application. It supports both modern variable font technology and traditional static font files across a full range of weights and styles, including a display variant. Proper inclusion of this file allows seamless typography management and efficient font loading strategies across the system.