% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fonts.R
\name{load_math_font}
\alias{load_math_font}
\title{Load a math font from an OTF file}
\usage{
load_math_font(otf_path)
}
\arguments{
\item{otf_path}{Path to the OTF/TTF font file.}
}
\value{
Invisibly returns \code{NULL}.
}
\description{
Loads an OTF/TTF \strong{math} font --- one carrying an OpenType MATH
table --- into MicroTeX's internal font registry. The MATH table is
parsed directly in C++ and the required metrics are synthesised on the
fly. You can download a free math font such as Latin Modern Math
(the LaTeX default) and load it for math rendering.
}
\details{
The font is also registered with the \pkg{systemfonts} package so it
can be selected for surrounding plot text via
\code{gp = gpar(fontfamily = "...")} without being installed
system-wide.

Plain \strong{text} fonts --- those used inside \code{\\text\{\}} blocks
--- need no loading at all. They are resolved automatically by
\pkg{systemfonts} from \code{gp$fontfamily}, or per run with
\code{\\gmfontfamily\{\}\{\}}.
}
\examples{
\donttest{
  # Load a math font from a local OTF file. Here we point at the
  # bundled STIX font so the example is self-contained and loaded.
  # You don't need to load the bundled fonts to use them — they're registered
  # with systemfonts on first render — but this shows how to load a custom font.
  # in practice you would pass the path to any OTF with an OpenType MATH table.
  otf <- system.file("fonts", "STIXTwoMath-Regular.otf",
                     package = "gridmicrotex")
  load_math_font(otf)
  available_math_fonts()
}
}
\seealso{
\code{\link{available_math_fonts}}, \code{\link{check_math_fonts}},
\code{\link{latex_options}}, \code{\link{latex_grob}}
}
