(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func TestFontExtends(t *testing.T) { |
| 19 | cache := font.NewCache(liberation.Collection()) |
| 20 | for _, tc := range []struct { |
| 21 | font font.Font |
| 22 | want map[font.Length]font.Extents |
| 23 | }{ |
| 24 | // values obtained when gonum/plot used the package |
| 25 | // github.com/freetype/truetype for handling fonts. |
| 26 | { |
| 27 | font: font.Font{Typeface: "Liberation", Variant: "Serif"}, |
| 28 | want: map[font.Length]font.Extents{ |
| 29 | 10: { |
| 30 | Ascent: 8.9111328125, |
| 31 | Descent: 2.1630859375, |
| 32 | Height: 11.4990234375, |
| 33 | }, |
| 34 | 12: { |
| 35 | Ascent: 10.693359375, |
| 36 | Descent: 2.595703125, |
| 37 | Height: 13.798828125, |
| 38 | }, |
| 39 | 24: { |
| 40 | Ascent: 21.38671875, |
| 41 | Descent: 5.19140625, |
| 42 | Height: 27.59765625, |
| 43 | }, |
| 44 | }, |
| 45 | }, |
| 46 | { |
| 47 | font: font.Font{Typeface: "Liberation", Variant: "Serif", Weight: stdfnt.WeightBold}, |
| 48 | want: map[font.Length]font.Extents{ |
| 49 | 10: { |
| 50 | Ascent: 8.9111328125, |
| 51 | Descent: 2.1630859375, |
| 52 | Height: 11.4990234375, |
| 53 | }, |
| 54 | 12: { |
| 55 | Ascent: 10.693359375, |
| 56 | Descent: 2.595703125, |
| 57 | Height: 13.798828125, |
| 58 | }, |
| 59 | 24: { |
| 60 | Ascent: 21.38671875, |
| 61 | Descent: 5.19140625, |
| 62 | Height: 27.59765625, |
| 63 | }, |
| 64 | }, |
| 65 | }, |
| 66 | { |
| 67 | font: font.Font{Typeface: "Liberation", Variant: "Serif", Style: stdfnt.StyleItalic}, |
| 68 | want: map[font.Length]font.Extents{ |
| 69 | 10: { |
| 70 | Ascent: 8.9111328125, |
| 71 | Descent: 2.1630859375, |
| 72 | Height: 11.4990234375, |
| 73 | }, |
| 74 | 12: { |
| 75 | Ascent: 10.693359375, |
nothing calls this directly
no test coverage detected