Class: Antex::SetBox

Inherits:
Measurable show all
Defined in:
lib/antex/set_box.rb

Overview

Encapsulates calculations and results for perfectly typesetting the SVG vectorial conversion of a TeX box.

Three files are required by #load for initialization:

YAML file containing TeX measures

We obtain this by using TeX directly to measure the box and write to file. Required metrics are ht, dp and wd (naturally expressed in pts).

SVG picture fitting tfm metrics

We obtain this by converting the DVI rendition of the box to SVG using / dvisvgm.

SVG picture fitting the ink

We obtain this by converting the DVI rendition of the box to SVG using / dvisvgm with the --exact flag.

After the initialization the calculations are performed immediatly. Six metrics become available:

  • mt, mr, ml and ml (the margins, positive or negative)

  • wd and ht (width and height)

  • ex (the default unit)

Defined Under Namespace

Classes: InvalidMeasure

Instance Attribute Summary

Attributes inherited from Measurable

#default_unit, #measures

Instance Method Summary collapse

Methods inherited from Measurable

#initialize

Constructor Details

This class inherits a constructor from Antex::Measurable

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Antex::Measurable

Instance Method Details

#load(yml:, tfm:, fit:) ⇒ TexBox

Returns self after loading

Parameters:

  • yml (String)

    path of the YAML file containing TeX measures

  • tfm (String)

    path of the SVG picture fitting tfm metrics

  • fit (String)

    path of the SVG picture fitting the ink

Returns:

  • (TexBox)

    returns self after loading



32
33
34
35
36
37
38
39
40
41
# File 'lib/antex/set_box.rb', line 32

def load(yml:, tfm:, fit:)
  @tex = TexBox.new.load yml
  @tfm = SVGBox.new.load tfm
  @fit = SVGBox.new.load fit
  @tex.default_unit = :ex
  check_measures!
  self.measures = compute_measures
  self.default_unit = :ex
  self
end