Skip to content

Instantly share code, notes, and snippets.

@chriskoch
chriskoch / drawString.js
Created April 14, 2010 16:59
draw a multiline string in a html5 canvas element including rotation font fontsize and color
/*
* draw a multiline string rotated in a canvas
*
* @param ctx (M) context of the canvas
* @param text (M) string may contain \n
* @param posX (M) horizontal start position
* @param posY (M) vertical start position
* @param textColor color
* @param rotation in degrees (by 360)
* @param font must be installed on client use websafe