Skip to content

jn3008/dot-to-dot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Create a dot-to-dot / connect-the-dots layout puzzle from a string of text. Initially made to work with Kanji/Chinese glyphs but works with any character, provided a suitable font.

Features

  • Convert input text and font into dot-to-dot layout.
  • Reduce the number of dots in the path (to make the underlying shape less obvious) with adjustable distance and angle thresholds.
  • Optionally draw connecting lines between dots and show characters.

Usage

Install dependencies:

pip install -r requirements.txt

Generate dot-to-dot layout:

python3 create_dot_to_dot_layout.py --text <text> --font <path_to_font> [optional arguments]

Example

python3 create_dot_to_dot_layout.py --text "原令子" --font "fonts/hiragino-kaku-gothic-std-w8.otf" --dots 200 --distance_threshold 120 --angle_threshold 160 --chars --lines

Result

The leftmost image is the same as the right but with --show_chars --draw_lines

Arguments

Required Arguments

Argument Description
--text Text to convert to SVG.
--font Path to the font file.

Optional Arguments

Argument Description Default
--dots Number of dots to generate per character before dot reduction. 100
--output Path to save the output PDF. Automatic
--distance_threshold Distance threshold for reducing points. 20
--angle_threshold Angle threshold for reducing points. 160
--no_merge Do not merge overlapping shapes. -
--show_chars Show character hints (debugging mode). -
--draw_lines Draw lines between dots. -
--visual_label_offset Multiplier to adjust the visual distance of labels from dots. 0.4
--reduce_straights Reduce consecutive points further apart on straight lines. -
--draw_lines Direction in which consecutive characters are placed. (N, E, S, W) E
--separate_off Don't separate characters; do one word at a time (useful for arabic) -

To-do

  • add option for output file format
  • create simple gui

About

Create a dot-to-dot / connect-the-dots for a string of text. Made to work with Kanji/Chinese glyphs but I'm pretty sure it works with anything.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages