Skip to content

pencil.js / text / TextOptions

Interface: TextOptions ​

Defined in: text.ts:12

Text options

Extends ​

Properties ​

PropertyTypeDescriptionInherited fromDefined in
alignCanvasTextAlignText horizontal alignment-text.ts:18
boldbooleanUse bold font-weight-text.ts:20
cap?CanvasLineCapHow lines endRectangleOptions.capcomponent.ts:85
clip| Component<ComponentOptions> | nullOther component used to clip the renderingRectangleOptions.clipcontainer.ts:26
cursorstring | nullCursor to use when hoverRectangleOptions.cursorcomponent.ts:81
dashedboolean | number[]Should the line be dashed, you can also specify the dash pattern (ex: [4, 4] or Component.dashes.dots)RectangleOptions.dashedcomponent.ts:79
fillStyleColor used to fill, set to null for transparentRectangleOptions.fillcomponent.ts:73
fontstringFont to use (can be a URL)-text.ts:14
fontSizenumberSize of the text in pixels-text.ts:16
italicbooleanUse italic font-style-text.ts:22
joinCanvasLineJoinHow lines join between themRectangleOptions.joincomponent.ts:83
lineHeightnumberRatio of line height (1 is normal, 2 is twice the space)-text.ts:26
opacitynumber | nullOpacity level from 0 to 1 (multiplied with its parents opacity, null means 1)RectangleOptions.opacitycontainer.ts:16
origin| string | PositionDefinitionRelative offset (Rectangle based shapes also accept named origins like "center")RectangleOptions.origincomponent.ts:87
rotationnumberRotation ratio from 0 to 1 (clockwise)RectangleOptions.rotationcontainer.ts:18
rotationCenterPositionDefinitionCenter of rotation relative to this positionRectangleOptions.rotationCentercontainer.ts:20
roundednumber | DOMPointInit | (number | DOMPointInit)[]Radius of the corners (or a list of radii, see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect)RectangleOptions.roundedrectangle.ts:10
scale| number | PositionDefinitionScaling ratio or a pair of value for horizontal and vertical scalingRectangleOptions.scalecontainer.ts:22
shadowPartial<ShadowOptions>Set of options to set a shadowRectangleOptions.shadowcomponent.ts:89
shownbooleanIs shownRectangleOptions.showncontainer.ts:14
strokeStyleColor used to stroke, set to null for transparentRectangleOptions.strokecomponent.ts:75
strokeWidthnumberStroke line thickness in pixelsRectangleOptions.strokeWidthcomponent.ts:77
underscorebooleanDraw a line under the text-text.ts:24
zIndexnumberDepth orderingRectangleOptions.zIndexcontainer.ts:24

Released under the MIT License.