Module: Flightdeck::UiFonts

Defined in:
lib/flightdeck/ui_fonts.rb

Overview

The typefaces the dashboard can be rendered in.

Each slug is stamped on , and assets-src/input.css has one block per slug that remaps --font-ui. Nothing here knows the font stacks: CSS owns those, so a family can be respelled in one place. test/ui_fonts_test.rb keeps this list, the CSS blocks and the vendored woff2 files in step.

The mono face (IBM Plex Mono) is not configurable: tables and payload previews depend on its tabular figures.

Constant Summary collapse

LABELS =
{
  "public-sans" => "Public Sans",
  "barlow" => "Barlow",
  "general-sans" => "General Sans",
  "inter" => "Inter",
  "manrope" => "Manrope",
  "system" => "System"
}.freeze
DEFAULT =
"public-sans"
BUNDLED =

"system" ships no woff2 — it is whatever the OS uses for its own UI.

(LABELS.keys - [ "system" ]).freeze

Class Method Summary collapse

Class Method Details

.label(slug) ⇒ Object



34
35
36
# File 'lib/flightdeck/ui_fonts.rb', line 34

def label(slug)
  LABELS[slug.to_s]
end

.optionsObject

[slug, label] pairs in menu order: the default, then alphabetical.



43
44
45
# File 'lib/flightdeck/ui_fonts.rb', line 43

def options
  LABELS.map { |slug, label| [ slug, label ] }
end

.slugsObject



30
31
32
# File 'lib/flightdeck/ui_fonts.rb', line 30

def slugs
  LABELS.keys
end

.valid?(slug) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/flightdeck/ui_fonts.rb', line 38

def valid?(slug)
  LABELS.key?(slug.to_s)
end