summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2016-01-16 18:27:18 -0500
committerPietro Gagliardi <[email protected]>2016-01-16 18:27:18 -0500
commit8dc672361ebc481cbe9418f7dd4d307095ee9f98 (patch)
treec92116570cd866302ef1073cf5a285a8a7a0955a
parentfdc9af39ac4007b484007017361c4767ff7a75a4 (diff)
More documentation.
-rw-r--r--draw.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/draw.go b/draw.go
index b136574..d860e2b 100644
--- a/draw.go
+++ b/draw.go
@@ -810,6 +810,16 @@ func (l *TextLayout) SetWidth(width float64) {
// even if no glyph reaches to the top of its ascent or bottom of its
// descent; it does not return a "best fit" rectnagle for the points that
// are actually drawn.
+//
+// For a single-line TextLayout (where the width is negative), if there
+// are no font changes throughout the TextLayout, then the height
+// returned by TextLayout is equivalent to the sum of the ascent and
+// descent of its default font's metrics. Or in other words, after
+// f := ui.LoadClosestFont(...)
+// l := ui.NewTextLayout("text", f, -1)
+// metrics := f.Metrics()
+// _, height := l.Extents()
+// metrics.Ascent+metrics.Descent and height are equivalent.
func (l *TextLayout) Extents() (width float64, height float64) {
cwidth := C.newDouble()
cheight := C.newDouble()