|
Shodo | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--Shodo.Foundry
| Method Summary | |
Object
|
addFont(<String> font, <Number> size, <String> color, <Number> opacity, <String> charset, <Array> positions, <Array> widths, <Number> height, <String> imageurl, <Function> onload, <Object> appCtxt)
Add a font. |
Array
|
addFontsFromJSON(json, <Function> onload, appCtxt)
Adds new font objects defined in JSON form. |
Object
|
addNamedFont(<String> fontname, <Object> fontdesc, <String> charset, <Array> positions, <Array> widths, <Number> height, <String> imageurl, <Function> onload, <Object> appCtxt)
Add a font with the specified name. |
Object
|
canonical(<String> font, <Number> size, <String> color, <Number> opacity)
Converts the specified parameters to a canonical fontname. |
void
|
disableVML()
Disable VML rendering for any fonts created hereafter (for Internet Explorer only). |
void
|
disableVMLForAll()
Disable VML rendering for all existing fonts, and any fonts created hereafter (for Internet Explorer only). |
void
|
enableVML()
Enable VML rendering for any fonts created hereafter (for Internet Explorer only). |
void
|
enableVMLForAll()
Enable VML rendering for for all existing fonts, and any fonts created hereafter (for Internet Explorer only). |
Object
|
getFont(<String> font, <Number> size, <String> color,<Number> opacity)
Returns a Shodo.Font object matching the specified font/size/color/opacity. |
Object
|
getFontByName(<String> fontname)
Returns a Shodo.Font object matching the specified name. |
void
|
setFontPath(<String> fontpath)
Set the fontpath string. |
| Method Detail |
Object addFont(<String> font, <Number> size, <String> color, <Number> opacity, <String> charset, <Array> positions, <Array> widths, <Number> height, <String> imageurl, <Function> onload, <Object> appCtxt)
font - Font name, including weight/slant
size - size of the font in pixels
color - color of the font as either named color, or in "#RRGGBB" form
opacity - optional opacity level, default 100. If a fractional number between 0 and 1, it is converted to a percentage value
charset - mapped character set string. Specifies the characters in the font image, in the order of appearance
positions - starting X positions of character glyphs within the image.
widths - widths of character glyphs within the image.
height - pixel height of the rendered character set.
imageurl - URL to be used to load the character set image. May be either a standard URL, or a data URL (note that data URL's are not yet supported by IE).
onload - optional function called when the image has been loaded. The 'this' parameter for the function is the Shodo.Font object created for the font. The object will have a foundry property attached to it in case the onload function needs to reference the foundry object.
appCtxt - optional application specific context attached to the generated font object. Used to provide additional context the onload() function.
Array addFontsFromJSON(json, <Function> onload, appCtxt)
Note that this requires the Javascript JSON.parse()
function to be either builtin, or installed from the JSON library
available at this parameter of the onload function is the created Shodo.Font
object, thereby permitting immediate rendering of strings when the
font is loaded. The optional appCtxt parameter is an object which
is attached to the generated fonts, and can be retrieved in the onload()
function as this.appCtxt, to supply any additional application level context.
json - either a string of JSON, or a Javascript object previously derived from JSON
onload - optional function to be executed when each font specified in json has completed loading
appCtxt - an optional object of any type which is attached to each generated font's object, so that application specific context can be accessed from within the onload() function via this.appCtxt
Object addNamedFont(<String> fontname, <Object> fontdesc, <String> charset, <Array> positions, <Array> widths, <Number> height, <String> imageurl, <Function> onload, <Object> appCtxt)
addFont() method, with (font, size, color, opacity) replaced by the fontname
parameter, and the addition of a fontdesc parameter, which provides a
font description object containing Family, Style, Weight, Size, Color, and Opacity
values.fontname - font name
fontdesc - description object for the font containing Family, Style, Weight, Color, Opacity, and Size properties.
charset - mapped character set string. Specifies the characters in the font image, in the order of appearance
positions - starting X positions of character glyphs within the image.
widths - widths of character glyphs within the image.
height - pixel height of the rendered character set.
imageurl - URL to be used to load the character set image. May be either a standard URL, or a data URL (note that data URL's are not yet supported by IE).
onload - optional function called when the image has been loaded. The 'this' parameter for the function is the Shodo.Font object created for the font. The object will have a foundry property attached to it in case the onload function needs to reference the foundry object.
appCtxt - optional application specific context attached to the generated font object. Used to provide additional context the onload() function.
Object canonical(<String> font, <Number> size, <String> color, <Number> opacity)
font - name of the font (include weight/slant)
size - size of the font in pixels
color - color of the font as either named color, or in "#RRGGBB" form
opacity - optional opacity level, default 100. If a fractional number between 0 and 1, it is converted to a percentage value
void disableVML()
void disableVMLForAll()
void enableVML()
void enableVMLForAll()
Object getFont(<String> font, <Number> size, <String> color,<Number> opacity)
font - font name to be used. Will be normalized to an HTML::Canvas::Suzuri font string (replace non-alphanumerics with underscore, and lower cased). May also include a font index as a colon separated suffix.
size - pixel size of font to use.
color - color of the text in "#RRGGBB" or "#RRGGBBAA" form
opacity - Alpha channel value between 0 and 255, or an opacity level between 0.0 and 1.0 (in which case the value is multiplied by 255 to derive the alpha channel value). Appended to color as hex alpha channel value if the color does not already include an alpha channel value. If null or not specified, default to 255.
null if no matching font is found
Object getFontByName(<String> fontname)
fontname - name of the font
null
void setFontPath(<String> fontpath)
fontpath - new path to use for loading font images
|
Shodo | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||