Skip to content

Commit

Permalink
vg/{fonts,vgpdf}: remove vg/fonts package
Browse files Browse the repository at this point in the history
Use embedded characted encoding table for embedded fonts.
This relies on Go >= 1.16 for the "embed" package.

Fixes #696.
Fixes #637.
  • Loading branch information
sbinet committed Aug 19, 2021
1 parent fc63b2a commit d08bae0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 890 deletions.
8 changes: 0 additions & 8 deletions vg/fonts/fonts.go

This file was deleted.

641 changes: 0 additions & 641 deletions vg/fonts/liberation_fonts_generated.go

This file was deleted.

234 changes: 0 additions & 234 deletions vg/fonts/mk-fonts.go

This file was deleted.

File renamed without changes.
10 changes: 3 additions & 7 deletions vg/vgpdf/vgpdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package vgpdf // import "gonum.org/v1/plot/vg/vgpdf"
import (
"bufio"
"bytes"
_ "embed"
"fmt"
"image"
"image/color"
Expand All @@ -27,7 +28,6 @@ import (
"gonum.org/v1/plot/font"
"gonum.org/v1/plot/vg"
"gonum.org/v1/plot/vg/draw"
"gonum.org/v1/plot/vg/fonts"
)

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

func init() {
draw.RegisterFormat("pdf", func(w, h vg.Length) vg.CanvasWriterTo {
return New(w, h)
})

var err error
codePageEncoding, err = fonts.Asset("cp1252.map")
if err != nil {
panic(fmt.Errorf("vgpdf: could not load PDF charset encoding map: %+v", err))
}
}

// DPI is the nominal resolution of drawing in PDF.
Expand Down

0 comments on commit d08bae0

Please sign in to comment.