Text

Text is probably used in most things we build. Larger text masses might be better added through normal HTML, because of accessibility and such. Other texts could be just part of your app and doesn't necessarily need to be accessible in the same way. For those purposes, oCanvas includes a text display object. It is very easy to use, and works with fonts the way CSS does. If you want a special font, you can include the @font-face declarations in your CSS code, and the font will be available for use in the text objects, just as it would in a normal HTML context.

Properties

align : String

The horizontal alignment of the text. Can be one of the values start, end, left, right and center. Default: start. Since version 2.0.0, this only affects the text content in multi-line text objects. Before that version, the text object actually moved and disturbed the origin of the object.

baseline : String

The vertical alignment of the text. Can be one of the values top, hanging, middle, alphabetic, ideographic or bottom. Since version 2.0.0, all values can be used because they are calculated within oCanvas. Before that version, the normal canvas API values were used internally, and made only some of the values work since the browsers didn't support all of them.