MCPcopy
hub / github.com/gonum/plot / Lookup

Method Lookup

font/font.go:246–266  ·  view source on GitHub ↗

Lookup returns the font Face corresponding to the provided Font descriptor, with the provided font size set. If no matching font Face could be found, the one corresponding to the default typeface is selected and returned.

(fnt Font, size Length)

Source from the content-addressed store, hash-verified

244// If no matching font Face could be found, the one corresponding to
245// the default typeface is selected and returned.
246func (c *Cache) Lookup(fnt Font, size Length) Face {
247 c.mu.RLock()
248 defer c.mu.RUnlock()
249
250 if len(c.faces) == 0 {
251 return Face{}
252 }
253
254 face := c.lookup(fnt)
255 if face == nil {
256 fnt.Typeface = c.def
257 face = c.lookup(fnt)
258 }
259
260 ff := Face{
261 Font: fnt,
262 Face: face,
263 }
264 ff.Font.Size = size
265 return ff
266}
267
268// Has returns whether the cache contains the exact font descriptor.
269func (c *Cache) Has(fnt Font) bool {

Callers 14

TestFontExtendsFunction · 0.95
TestFontWidthFunction · 0.95
TestFontKernFunction · 0.95
ExampleFunction · 0.80
TestConcurrentInitFunction · 0.80
ReplayOnMethod · 0.80
ExtentsMethod · 0.80
BoxMethod · 0.80
DrawMethod · 0.80
fontsForMethod · 0.80
ExtentsMethod · 0.80

Calls 1

lookupMethod · 0.95

Tested by 6

TestFontExtendsFunction · 0.76
TestFontWidthFunction · 0.76
TestFontKernFunction · 0.76
ExampleFunction · 0.64
TestConcurrentInitFunction · 0.64