Exception: Typstify::FontMissingError

Inherits:
Error
  • Object
show all
Defined in:
lib/typstify/errors.rb

Overview

A font family a template asks for is not installed and is not in any configured font_paths. Raised only when strict_fonts is on.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(families, searched) ⇒ FontMissingError

Returns a new instance of FontMissingError.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/typstify/errors.rb', line 51

def initialize(families, searched)
  @families = families
  super(<<~MSG.strip)
    Missing font #{families.size == 1 ? "family" : "families"}: #{families.map(&:inspect).join(", ")}

    Typst would silently substitute a different face, which changes your
    layout without telling you. Vendor the font and add its directory:

        Typstify.configure { |c| c.font_paths = [Rails.root.join("app/assets/fonts")] }

    Searched:
    #{searched.map { |p| "  - #{p}" }.join("\n")}

    Set `c.strict_fonts = false` to downgrade this to a warning.
  MSG
end

Instance Attribute Details

#familiesObject (readonly)

Returns the value of attribute families.



49
50
51
# File 'lib/typstify/errors.rb', line 49

def families
  @families
end