github.com/kintar/etxt@v0.0.9/esizer/impl_no_kern.go (about)

     1  package esizer
     2  
     3  import "golang.org/x/image/font"
     4  import "golang.org/x/image/font/sfnt"
     5  import "golang.org/x/image/math/fixed"
     6  
     7  // A default [Sizer] without kerning (the kern function always returns 0).
     8  type NoKernSizer struct{ buffer sfnt.Buffer }
     9  
    10  // Satisfies the [Sizer] interface.
    11  func (self *NoKernSizer) Metrics(font *Font, size fixed.Int26_6) font.Metrics {
    12  	return DefaultMetricsFunc(font, size, &self.buffer)
    13  }
    14  
    15  // Satisfies the [Sizer] interface.
    16  func (self *NoKernSizer) Advance(font *Font, glyphIndex GlyphIndex, size fixed.Int26_6) fixed.Int26_6 {
    17  	return DefaultAdvanceFunc(font, glyphIndex, size, &self.buffer)
    18  }
    19  
    20  // Satisfies the [Sizer] interface.
    21  func (self *NoKernSizer) Kern(*Font, GlyphIndex, GlyphIndex, fixed.Int26_6) fixed.Int26_6 {
    22  	return 0
    23  }