Draw text on Android screens via ADB by converting font glyphs to simulated finger strokes. Perfect for automated UI testing, accessibility demonstrations, or creative device interactions.
Draw monospace text on Android device screens via ADB by converting TrueType fonts into simulated finger strokes. This tool extracts vector paths from fonts and "draws" them by injecting touch events through ADB—essentially creating a robot finger that can write in any font.
Automates the process of drawing text on Android devices using:
Ideal for UI automation, accessibility testing, creative demonstrations, or any scenario requiring programmatic on-screen drawing.
First, verify the project structure and dependencies:
```bash
ls -la AndroidDraw.csproj
ls -la Fonts/
```
Expected fonts:
Before running any commands, confirm device connectivity:
```bash
adb devices
```
Draw text with minimal configuration:
```bash
dotnet run -c Release -- "Hello World" --x 100 --y 500 --width 800 --height 200
dotnet run -c Release -- "Console.Beep();" --font "IBM" --x 250 --y 1200 --width 620 --height 300
```
**Parameter explanation:**
#### Prevent Double-Thick Strokes
By default, AndroidDraw draws each stroke twice with a 1-pixel diagonal offset to ensure visibility. For thinner lines:
```bash
dotnet run -c Release -- "Thin Text" --x 100 --y 500 --width 800 --height 200 --thin
```
#### Handle Problematic Characters
Some glyphs (like semicolons) may render as dots if too small. Use `--wiggle` to add priming strokes:
```bash
dotnet run -c Release -- "var x = 10;" --font "IBM" --wiggle ";" --x 100 --y 500 --width 800 --height 200
```
#### Use Built-In Geometric Font
For a simple angular/LCD style without TrueType fonts:
```bash
dotnet run -c Release -- "SIMPLE" --simple --x 100 --y 500 --width 800 --height 200
```
#### Control Stroke Timing
Adjust delay between strokes (default: 50ms):
```bash
dotnet run -c Release -- "Slow Draw" --x 100 --y 500 --width 800 --height 200 --delay 100
```
#### Preview Without Execution
Generate ADB commands without sending them to device:
```bash
dotnet run -c Release -- "Preview" --x 100 --y 500 --width 800 --height 200 --dry-run
```
This outputs the full motionevent command sequence for inspection or manual execution.
#### Target Specific Device
When multiple devices are connected:
```bash
dotnet run -c Release -- "Multi-Device" --x 100 --y 500 --width 800 --height 200 --device <serial>
```
If you need to customize the drawing behavior, understand the pipeline:
1. **FontPathExtractor.cs**: Converts TrueType glyphs to SkiaSharp SKPath objects
2. **PathToStrokes.cs**: Decomposes paths into stroke segments, tagging each with source character
3. **BezierInterpolator.cs**: Samples cubic Bezier curves into 30 line segments per curve
4. **StrokeSimplifier.cs**: Applies Ramer-Douglas-Peucker algorithm (epsilon=1.5) to reduce point count
5. **CoordinateTransformer.cs**: Scales and translates points to target screen area
6. **AdbController.cs**: Generates `motionevent` commands with interpolation (2 pixels per event)
**Key tuning constants in AdbController.cs:**
To find target coordinates for your device:
1. Enable "Pointer location" in Developer Options on Android device
2. Tap screen corners of desired drawing area
3. Note x/y values from status bar
4. Use those values for `--x`, `--y`, `--width`, `--height`
**UI Testing:**
```bash
dotnet run -c Release -- "[email protected]" --font "IBM" --thin --x 200 --y 800 --width 880 --height 80
```
**Code Syntax Demonstrations:**
```bash
dotnet run -c Release -- "if (x > 0) {" --font "IBM" --thin --wiggle ";" --x 50 --y 300 --width 1000 --height 150
```
**Accessibility Demos:**
```bash
dotnet run -c Release -- "ACCESSIBLE" --font "Hershey" --x 100 --y 600 --width 800 --height 400
```
**Issue: Strokes not appearing**
**Issue: Text too thick/thin**
**Issue: Dots instead of characters**
**Issue: Slow drawing**
This project requires:
Install SkiaSharp via:
```bash
dotnet add package SkiaSharp --version 3.119.1
```
**Minimal example:**
```bash
dotnet run -c Release -- "Hi" --x 500 --y 1000 --width 400 --height 150
```
**Production-ready code drawing:**
```bash
dotnet run -c Release -- "async Task<bool>" --font "IBM" --thin --wiggle "<>" --x 200 --y 600 --width 900 --height 120 --delay 40
```
**Preview mode for testing coordinates:**
```bash
dotnet run -c Release -- "TEST" --x 100 --y 100 --width 200 --height 100 --dry-run | head -20
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/androiddraw-adb-font-drawing/raw