Release 0.2

Release v0.2.0 is out of the oven.

This release is the first release of star-tex with a complete, pure-Go, codebase, that has been the result of applying the web2go command on the official tex.web file from TeX-Live.

Many thanks to ~cznic are in order for writing and providing this tool!

This means star-tex is now available on all Go supported platforms, and easily cross-compilable!

New import path

Also, now star-tex is available from the new vanity import path:

import "star-tex.org/x/tex"

and the main star-tex command can be installed like so:

$> go install star-tex.org/x/tex/cmd/star-tex

Performances on our beloved testdata/hello.tex are still ok:

$ time /usr/bin/tex ./testdata/hello.tex 
This is TeX, Version 3.141592653 (TeX Live 2021/Arch Linux) (preloaded format=tex)
[...]

real  0m0.060s
user  0m0.047s
sys   0m0.010s

$ time ./star-tex ./testdata/hello.tex 
This is TeX, Version 3.141592653 (INITEX)
[...]

real  0m0.011s
user  0m0.009s
sys   0m0.003s

star-tex.org/x/tex now exposes a tex.Engine type that implements the tex.Processor interface:

// Processor is the interface that wraps the Process method.
type Processor interface {
	Process(w io.Writer, r io.Reader) error
}

It is a very high-level interface that should be complemented (over time) with more focused ones.

kpath

kpath is a new package that implements the semantics of the kpathsea library to locate files in a TeX Directory Structure (TDS).

tfm

tfm is a new pacjage that implements a decoder for TFM (TeX Font Metrics) files.

The main entry point of this package is:

// Parse parses a TFM file.
func Parse(r io.Reader) (Font, error)

that parses a TFM file and returns a Font metrics value:

// Font is a TeX Font metrics.
type Font struct { ... }

func (fnt *Font) CodingScheme() string { ... }
func (fnt *Font) DesignSize() Int12_20 { ... }
func (fnt *Font) GlyphIndex(x rune) GlyphIndex { ... }

cmd/kpath-find

kpath-find is a new command that finds files in a TeX directory structure:

$> kpath-find -h
Usage of kpath-find:
  -all
    	display all matches
  -texmf string
    	path to TEXMF distribution

$> kpath-find -texmf /usr/share/texmf-dist cmr10.pk
/usr/share/texmf-dist/fonts/pk/ljfour/public/cm/dpi600/cmr10.pk

$> kpath-find -all -texmf /usr/share/texmf-dist latex
/usr/share/texmf-dist/makeindex/latex
/usr/share/texmf-dist/tex/latex
/usr/share/texmf-dist/tex4ht/ht-fonts/alias/latex
/usr/share/texmf-dist/tex4ht/ht-fonts/unicode/latex

cmd/tfm2pl

tfm2pl is a new command that converts a TFM file to human-readable property list file or standard output.

$> tfm2pl -h
Usage: tfm2pl [options] file.tfm [file.pl]

tfm2pl converts a TFM file to human-readable property list file or standard output.

ex:
 $> tfm2pl testdata/simple.tfm
 $> tfm2pl testdata/simple.tfm out.pl

options:

$> tfm2pl /usr/share/texmf-dist/fonts/tfm/public/cm/cmr10.tfm
(FAMILY CMR)
(FACE O 352)
(CODINGSCHEME TEX TEXT)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 11374260171)
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.333334)
   (STRETCH R 0.166667)
   (SHRINK R 0.111112)
   (XHEIGHT R 0.430555)
   (QUAD R 1.000003)
   (EXTRASPACE R 0.111112)
   )
(LIGTABLE
   (LABEL O 40)
   (KRN C l R -0.277779)
   (KRN C L R -0.319446)
[...]

The output of tfm2pl should be exactly the same than the one from the official tftopl binary from TeX Live.