(Canvas canvas, String text, TextStyle ts)
| 14 | } |
| 15 | |
| 16 | public void drawLine(Canvas canvas, String text, TextStyle ts) { |
| 17 | try (ParagraphStyle ps = new ParagraphStyle(); |
| 18 | ParagraphBuilder pb = new ParagraphBuilder(ps, fc);) |
| 19 | { |
| 20 | pb.pushStyle(ts); |
| 21 | pb.addText(text); |
| 22 | try (Paragraph p = pb.build();) { |
| 23 | p.layout(Float.POSITIVE_INFINITY); |
| 24 | p.paint(canvas, 0, 0); |
| 25 | canvas.translate(0, p.getHeight() + 5); |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | @Override |
| 31 | public void draw(Canvas canvas, int width, int height, float dpi, int xpos, int ypos) { |