~sbinet/star-tex

e01c2b7a2ca713c479ae58752518c07afd123799 — Sebastien Binet 4 months ago 07784b7
cmd/dvi-cnv: add PK/TFM checksum check

Signed-off-by: Sebastien Binet <s@sbinet.org>
1 files changed, 10 insertions(+), 0 deletions(-)

M cmd/dvi-cnv/png.go
M cmd/dvi-cnv/png.go => cmd/dvi-cnv/png.go +10 -0
@@ 225,6 225,16 @@ func (pr *pngRenderer) face(fnt dvi.Font) (font.Face, bool) {

	tfm := fnt.Metrics()

	if tfm.Checksum() != pk.Checksum() {
		pr.setErr(fmt.Errorf(
			"TFM and PK checksum do not match for %q: tfm=0x%x, pk=0x%x",
			fnt.Name(),
			tfm.Checksum(),
			pk.Checksum(),
		))
		return nil, false
	}

	face := pkf.NewFace(pk, tfm, &pkf.FaceOptions{
		Size: tfm.DesignSize().Float64(),
		DPI:  float64(pr.dpi),