Fork me on GitHub

fontMetrics

This module contains metrics regarding fonts and individual symbols. The sigma and xi variables, as well as the metricMap map contain data extracted from TeX, TeX font metrics, and the TTF files. These data are then exposed via the metrics variable and the getCharacterMetrics function.

Members

SIGMASstaticconstant

In TeX, there are actually three sets of dimensions, one for each of textstyle, scriptstyle, and scriptscriptstyle. These are provided in the the arrays below, in that order.

The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respectively. This was determined by running the following script:

      latex -interaction=nonstopmode \
      '\documentclass{article}\usepackage{amsmath}\begin{document}' \
      '$a$ \expandafter\show\the\textfont2' \
      '\expandafter\show\the\scriptfont2' \
      '\expandafter\show\the\scriptscriptfont2' \
      '\stop'

The metrics themselves were retrieved using the following commands:

      tftopl cmsy10
      tftopl cmsy7
      tftopl cmsy5

The output of each of these commands is quite lengthy. The only part we care about is the FONTDIMEN section. Each value is measured in EMs.

Source

Methods

getCharacterMetrics()privatestatic

This function is a convenience function for looking up information in the metricMap table. It takes a character as a string, and a font name.

Note: the width property may be undefined if fontMetricsData.js wasn't built using Make extended_metrics.

Source