JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q30617F
  • License MIT

Generate multilingual crossword puzzles

Package Exports

  • crossword

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (crossword) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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:

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

License

Open source, MIT license