/** * Strokes {@code lines} into {@code canvas} at the specified coordinates, using the specified * alignment. */ public void stroke(Canvas canvas, Align align, float x, float y) { float sy = y + bounds.y(); for (TextLayout line : lines) { float sx = x + bounds.x() + align.getX(line.width(), textWidth()); canvas.strokeText(line, sx, sy); sy += line.ascent() + line.descent() + line.leading(); } }
/** * Strokes {@code lines} into {@code canvas} at the specified coordinates, using the specified * alignment. */ public void stroke(Canvas canvas, Align align, float x, float y) { float sy = y + bounds.y(); for (TextLayout line : lines) { float sx = x + bounds.x() + align.getX(line.size.width(), textWidth()); canvas.strokeText(line, sx, sy); sy += line.ascent() + line.descent() + line.leading(); } }
/** * Strokes {@code lines} into {@code canvas} at the specified coordinates, using the specified * alignment. */ public void stroke(Canvas canvas, Align align, float x, float y) { float sy = y + bounds.y(); for (TextLayout line : lines) { float sx = x + bounds.x() + align.getX(line.size.width(), textWidth()); canvas.strokeText(line, sx, sy); sy += line.ascent() + line.descent() + line.leading(); } }
@Override public void render (Canvas canvas, TextLayout text, int textColor, boolean underlined, float x, float y) { canvas.save(); canvas.setStrokeColor(outlineColor); canvas.setStrokeWidth(outlineWidth*2); canvas.setLineCap(outlineCap); canvas.setLineJoin(outlineJoin); canvas.strokeText(text, x+outlineWidth, y+outlineWidth); canvas.setFillColor(textColor); canvas.fillText(text, x+outlineWidth, y+outlineWidth); if (underlined) { IRectangle bounds = text.bounds; float sx = x + bounds.x() + outlineWidth; float sy = y + bounds.y() + bounds.height() + outlineWidth + 1; canvas.fillRect(sx, sy, bounds.width(), 1); } canvas.restore(); }
protected void render (Canvas canvas, String strokeFill, TextBlock block, TextBlock.Align align, int color, float x, float y, boolean showBounds) { float sy = y + block.bounds.y(); for (TextLayout layout : block.lines) { float sx = x + block.bounds.x() + align.getX( layout.size.width(), block.bounds.width()-block.bounds.x()); if (showBounds) { IRectangle lbounds = layout.bounds; canvas.setStrokeColor(0xFFFFCCCC).setStrokeWidth(1); canvas.strokeRect(sx+lbounds.x(), sy+lbounds.y(), lbounds.width(), lbounds.height()); } if (strokeFill.equals("Fill")) { canvas.setFillColor(color).fillText(layout, sx, sy); } else { canvas.setStrokeColor(color).strokeText(layout, sx, sy); } sy += layout.ascent() + layout.descent() + layout.leading(); } }
protected void render (Canvas canvas, String strokeFill, TextBlock block, TextBlock.Align align, int color, float x, float y, boolean showBounds) { float sy = y + block.bounds.y(); for (TextLayout layout : block.lines) { float sx = x + block.bounds.x() + align.getX( layout.width(), block.bounds.width()-block.bounds.x()); if (showBounds) { IRectangle lbounds = layout.bounds(); canvas.setStrokeColor(0xFFFFCCCC).setStrokeWidth(1); canvas.strokeRect(sx+lbounds.x(), sy+lbounds.y(), lbounds.width(), lbounds.height()); } if (strokeFill.equals("Fill")) { canvas.setFillColor(color).fillText(layout, sx, sy); } else { canvas.setStrokeColor(color).strokeText(layout, sx, sy); } sy += layout.ascent() + layout.descent() + layout.leading(); } }