Friday 15 July 2011

javascript - How to do rich typesetting for text in canvas element? -


I search for a way to attract multi-line text directly to the canvas element without using HTML / DOM I am here. The best case scenario will be to find the Javascript library, but my Googling attempts have nothing to happen.

Ideally this would be the following functionality:

  • Set the ability paragraph styles: first line indent, line spacing, etc.
  • Fast and robust implementation of text-wrapping algorithm with alignment / justification options
  • Rich text formatting via some simplified subsets HTML or markdown etc.

    I'm hoping to find a solution that is a bit more advanced and that's just related to the original word / line wrapping.

    Anyone know of any possible solution? It seems like this is a crazy thing, but I think I have a fair justification! I'm probably evaluating this as an iOS environment in order to create a cross-platform game that relies on text with beautiful typography, so HTML and DOM are not available. (Mainly create a text-based game)

    Canvas has minimal text support as you've found.

    To get rich-text capabilities, see the source code for TINMMEE.

    TinyMCE is an open source, widely javascript based text editor which is under active development. It has excellent features and its widespread use and active development has been largely debugged and offers rich code facility.

    You can start with this setting and pull the necessary pieces for use in the canvas.

    This project is available here:

No comments:

Post a Comment