MCPcopy Create free account
hub / github.com/HumbleUI/Skija / drawStringLeft

Method drawStringLeft

examples/scenes/src/Scene.java:45–54  ·  view source on GitHub ↗
(Canvas canvas, String text, Rect outer, Font font, Paint paint)

Source from the content-addressed store, hash-verified

43 }
44
45 public static void drawStringLeft(Canvas canvas, String text, Rect outer, Font font, Paint paint) {
46 Rect inner = font.measureText(text, paint);
47 FontMetrics metrics = font.getMetrics();
48 float innerHeight = metrics.getDescent() - metrics.getAscent();
49
50 canvas.drawString(text,
51 outer.getLeft(),
52 outer.getTop() + (outer.getHeight() - innerHeight) / 2f - metrics.getAscent(),
53 font, paint);
54 }
55
56 public static float phase() {
57 var angle = (System.currentTimeMillis() % 5000) / 5000.0 * Math.PI * 2.0;

Callers 1

drawMethod · 0.95

Calls 6

measureTextMethod · 0.80
getMetricsMethod · 0.80
getDescentMethod · 0.80
getAscentMethod · 0.80
getHeightMethod · 0.65
drawStringMethod · 0.45

Tested by

no test coverage detected