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