1.2.4 • Published 7 years ago

crossword v1.2.4

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Crossword

Make crossword puzzles in multiple languages and scripts.

Burmese/Myanmar Version supporting Unicode and Zawgyi fonts.

Also in Nepali and Tamil

Nepali Version including Preeti font

Tamil Version

Usage

Client-side javascript

var game = new Crossword(HTML5canvas, columns, rows);
game.clearCanvas(true);

var clue = 'What does a duck say?';
var answer = 'quack';

game.addWord(answer, function(error, clueAnchor, direction) {
  // error is null or an error (answer is too small, too big, cannot be placed etc)
  // clueAnchor is the number used by the system (for example "2" for "2 across")
  // direction is "across" or "down"
});

// advanced language options
game.setNumberTransform(function (n) {
  // convert integer marker to local language
  return tamilNumbers(n);
});

Node module

Using the crossword module requires node-canvas.

Installation pre-requisites:

  • Amazon Linux EC2
  • Fedora
  • OSX
  • Solaris / Illumos / SmartOS
  • Ubuntu / Debian
  • Windows
  • Heroku
  • Centos
npm install canvas crossword --save
var Canvas = require('canvas');
var Crossword = require('crossword');

var width = 20;
var height = 15;
var canv = new Canvas(40 * width, 40 * height);

var game = new Crossword(canv, width, height);
game.clearCanvas(true);

game.addWord(answer, function(err, clueAnchor, direction) {
  // err = null
  // clueAnchor = 2
  // direction = 'down' or 'across'
});

// right-to-left scripts (Arabic, Hebrew, Divehi)
// in these cases down = top->down, across = right->left
game.setDirection('rtl');

Command Line

Make crosswords from a word list using command line.

Prerequisites: NodeJS and fonts which support your language (preferably Noto Sans Myanmar, Noto Sans Devanagari, and Noto Sans Tamil, included in the styles directory of this project)

npm install crossword -g
crosswordjs wordlist.txt output.png

# command-line setup
# 20 columns wide, 15 rows high
# Myanmar numerals (other numerals supported: ne Nepali / Devanagari, ta Tamil, ar Arabic (also changes direction))
xwordjs wordlist.txt output.png -w 20 -h 15 -l my

Built with open source software

  • Rabbit-Node Unicode-Zawgyi converter
  • Myanmar Numbers
  • Preeti for Nepali typing
  • jQuery

License

Open source, MIT license

1.2.4

7 years ago

1.2.3

7 years ago

1.1.3

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago