mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-09 15:12:21 +00:00
Draft article about fonts (#95)
Former-commit-id: 002f55748d12811f0c8bf0d9b3df9a6674274cdd
This commit is contained in:
parent
c45ba63e6c
commit
c8d9fa6204
4 changed files with 46 additions and 0 deletions
4
docs/fonts.md
Normal file
4
docs/fonts.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Fonts and svg text nodes
|
||||
|
||||
# Fonts and $\LaTeX$
|
||||
|
||||
29
examples/fonts_latex.hs
Executable file
29
examples/fonts_latex.hs
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env stack
|
||||
-- stack runghc --package reanimate
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main
|
||||
( main
|
||||
)
|
||||
where
|
||||
|
||||
import Reanimate
|
||||
import Reanimate.LaTeX
|
||||
import Reanimate.Builtin.Documentation
|
||||
|
||||
main :: IO ()
|
||||
main =
|
||||
reanimate
|
||||
$ docEnv
|
||||
$ staticFrame 1
|
||||
$ withFillColor "black"
|
||||
$ withFillOpacity 1
|
||||
$ mkGroup
|
||||
[ latex "Computer Modern"
|
||||
, translate 0 (-2)
|
||||
$ latexWithHeaders ["\\usepackage{calligra}"] "\\calligra\nGalligra"
|
||||
, translate (-6) (-2)
|
||||
$ latexWithHeaders ["\\usepackage{noto}"] "\\normalfont\nNoto"
|
||||
, translate (-6) 0
|
||||
$ latexWithHeaders ["\\usepackage{helvet}"] "Helvetica"
|
||||
]
|
||||
|
||||
|
|
@ -21,5 +21,7 @@ nav:
|
|||
- Gluing together animations: glue_tut.md
|
||||
- Morphology (incomplete): morphology.md
|
||||
- Voice control: voice.md
|
||||
- How to:
|
||||
- Use fonts (incomplete): fonts.md
|
||||
- Showcase:
|
||||
- Color Theory: showcase_colortheory.md
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
{-# LANGUAGE ScopedTypeVariables #-}
|
||||
module Reanimate.LaTeX
|
||||
( latex
|
||||
, latexWithHeaders
|
||||
, latexChunks
|
||||
, xelatex
|
||||
, latexAlign
|
||||
|
|
@ -43,6 +44,16 @@ latex tex =
|
|||
args = []
|
||||
script = mkTexScript exec args [] tex
|
||||
|
||||
latexWithHeaders :: [T.Text] -> T.Text -> Tree
|
||||
latexWithHeaders _headers tex | pNoExternals = mkText tex
|
||||
latexWithHeaders headers tex =
|
||||
(unsafePerformIO . (cacheMem . cacheDiskSvg) (latexToSVG "dvi" exec args))
|
||||
script
|
||||
where
|
||||
exec = "latex"
|
||||
args = []
|
||||
script = mkTexScript exec args headers tex
|
||||
|
||||
latexChunks :: [T.Text] -> [Tree]
|
||||
latexChunks chunks | pNoExternals = map mkText chunks
|
||||
latexChunks chunks = worker (svgGlyphs $ latex $ T.concat chunks) chunks
|
||||
|
|
|
|||
Loading…
Reference in a new issue