Unverified Commit 86d0d0a2 authored by Pavel's avatar Pavel Committed by GitHub

Add comment to clarify that coordinates refer a baseline position, not a top...

Add comment to clarify that coordinates refer a baseline position, not a top left angle of text rectangle (#788)
parent 2dd06f0a
......@@ -541,6 +541,9 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
/**
* Draw a text [blob] with baseline starting at [x] [y] with [paint]
*/
fun drawTextBlob(blob: TextBlob, x: Float, y: Float, paint: Paint): Canvas {
Stats.onNativeCall()
try {
......@@ -553,6 +556,9 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
/**
* Draw a text [line] with baseline starting at [x] [y] with [paint]
*/
fun drawTextLine(line: TextLine, x: Float, y: Float, paint: Paint): Canvas {
line.textBlob?.use { blob -> blob.let { drawTextBlob(it, x, y, paint) } }
return this
......
......@@ -22,6 +22,9 @@ class TextLine internal constructor(ptr: NativePointer) : Managed(ptr, _Finalize
val PTR = TextLine_nGetFinalizer()
}
/**
* distance to reserve above baseline, typically negative
*/
val ascent: Float
get() {
Stats.onNativeCall()
......@@ -32,6 +35,9 @@ class TextLine internal constructor(ptr: NativePointer) : Managed(ptr, _Finalize
}
}
/**
* height of an upper-case letter, zero if unknown, typically negative
*/
val capHeight: Float
get() {
Stats.onNativeCall()
......@@ -42,6 +48,9 @@ class TextLine internal constructor(ptr: NativePointer) : Managed(ptr, _Finalize
}
}
/**
* height of lower-case 'x', zero if unknown, typically negative
*/
val xHeight: Float
get() {
Stats.onNativeCall()
......@@ -52,6 +61,9 @@ class TextLine internal constructor(ptr: NativePointer) : Managed(ptr, _Finalize
}
}
/**
* distance to reserve below baseline, typically positive
*/
val descent: Float
get() {
Stats.onNativeCall()
......@@ -62,6 +74,9 @@ class TextLine internal constructor(ptr: NativePointer) : Managed(ptr, _Finalize
}
}
/**
* distance to add between lines, typically positive or zero
*/
val leading: Float
get() {
Stats.onNativeCall()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment