Slide 60
Slide 60 text
RunをGraphicsContextに描画する
typographicBoundsを参照して描画する
struct BoundsTextRenderer: TextRenderer {
func draw( layout: Text.Layout, in context: inout GraphicsContext ) {
for line in layout {
for run in line {
let rect = run.typographicBounds.rect
context.stroke( Path(rect), with: .color(.red), lineWidth: 1 )
context.draw(run)
}
}
}
}
#iosdc #d
60