Skip to content

Commit

Permalink
removed dead code
Browse files Browse the repository at this point in the history
enabled font hinting
  • Loading branch information
tfriedel6 committed Mar 21, 2020
1 parent 59ddfe5 commit 9788524
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions freetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package canvas
import (
"errors"
"image"
"image/draw"

"github.com/golang/freetype/raster"
"github.com/golang/freetype/truetype"
Expand Down Expand Up @@ -42,8 +41,6 @@ type frContext struct {
r *raster.Rasterizer
f *truetype.Font
glyphBuf truetype.GlyphBuf
// dst and src are the destination and source images for drawing.
dst draw.Image

fontSize fixed.Int26_6
hinting font.Hinting
Expand Down Expand Up @@ -236,37 +233,6 @@ func (c *frContext) recalc() {
}
}

// setFont sets the font used to draw text.
func (c *frContext) setFont(f *truetype.Font) {
if c.f == f {
return
}
c.f = f
c.recalc()
}

// setFontSize sets the font size in points (as in "a 12 point font").
func (c *frContext) setFontSize(fontSize fixed.Int26_6) {
if c.fontSize == fontSize {
return
}
c.fontSize = fontSize
c.recalc()
}

// setHinting sets the hinting policy.
func (c *frContext) setHinting(hinting font.Hinting) {
c.hinting = hinting
for i := range c.cache {
c.cache[i] = cacheEntry{}
}
}

// setDst sets the destination image for draw operations.
func (c *frContext) setDst(dst draw.Image) {
c.dst = dst
}

func (c *frContext) cacheSize() int {
if c.f == nil {
return 0
Expand All @@ -282,12 +248,10 @@ func (c *frContext) cacheSize() int {
return w * h * len(c.cache)
}

// TODO(nigeltao): implement Context.SetGamma.

// NewContext creates a new Context.
func newFRContext() *frContext {
return &frContext{
r: raster.NewRasterizer(0, 0),
fontSize: fixed.I(12),
hinting: font.HintingFull,
}
}
Binary file modified testdata/Text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9788524

Please sign in to comment.