~sbinet/star-tex

7e43f7419a72e71d7f1ff21e55a1608d6dacd2de — Sebastien Binet 4 months ago 39c237c
dvi: be more specific about color definition files

Some TeX distribution system may have duplicates (e.g. latex/graphics/dvipsnam.def and latex-dev/graphics/dvipsnam.def).

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

M dvi/color.go
M dvi/color.go => dvi/color.go +8 -1
@@ 250,9 250,16 @@ func (cr *colorReader) hsbi() color.Color {
	return colorFrom("HSB", data)
}

var colorFiles = []string{
	"latex/xcolor/xcolor.sty",
	"latex/graphics/dvipsnam.def",
	"latex/xcolor/svgnam.def",
	"latex/xcolor/x11nam.def",
}

func newColorNames(ktx kpath.Context, cr *colorReader) map[string]color.Color {
	names := make(map[string]color.Color)
	for _, name := range []string{"xcolor.sty", "dvipsnam.def", "svgnam.def", "x11nam.def"} {
	for _, name := range colorFiles {
		fname, err := ktx.Find(name)
		if err != nil {
			panic(err) // FIXME(sbinet): warn only ?