Skip to content

Commit d08bae0

Browse files
committed
vg/{fonts,vgpdf}: remove vg/fonts package
Use embedded characted encoding table for embedded fonts. This relies on Go >= 1.16 for the "embed" package. Fixes #696. Fixes #637.
1 parent fc63b2a commit d08bae0

File tree

5 files changed

+3
-890
lines changed

5 files changed

+3
-890
lines changed

vg/fonts/fonts.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

vg/fonts/liberation_fonts_generated.go

Lines changed: 0 additions & 641 deletions
This file was deleted.

vg/fonts/mk-fonts.go

Lines changed: 0 additions & 234 deletions
This file was deleted.
File renamed without changes.

vg/vgpdf/vgpdf.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package vgpdf // import "gonum.org/v1/plot/vg/vgpdf"
99
import (
1010
"bufio"
1111
"bytes"
12+
_ "embed"
1213
"fmt"
1314
"image"
1415
"image/color"
@@ -27,7 +28,6 @@ import (
2728
"gonum.org/v1/plot/font"
2829
"gonum.org/v1/plot/vg"
2930
"gonum.org/v1/plot/vg/draw"
30-
"gonum.org/v1/plot/vg/fonts"
3131
)
3232

3333
// codePageEncoding holds informations about the characters encoding of TrueType
@@ -38,18 +38,14 @@ import (
3838
//
3939
// TODO: provide a Canvas-level func option to embed fonts with a user provided
4040
// code page schema?
41+
//
42+
//go:embed cp1252.map
4143
var codePageEncoding []byte
4244

4345
func init() {
4446
draw.RegisterFormat("pdf", func(w, h vg.Length) vg.CanvasWriterTo {
4547
return New(w, h)
4648
})
47-
48-
var err error
49-
codePageEncoding, err = fonts.Asset("cp1252.map")
50-
if err != nil {
51-
panic(fmt.Errorf("vgpdf: could not load PDF charset encoding map: %+v", err))
52-
}
5349
}
5450

5551
// DPI is the nominal resolution of drawing in PDF.

0 commit comments

Comments
 (0)