import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input, text, Color, Text } from "doric"; import { title } from "./utils"; @Entry class TextDemo extends Panel { build(root: Group) { scroller( vlayout( [ title("Text Demo"), text({ text: "This is normal text", }), text({ text: "This is normal text with shadow ", textSize: 20, shadow: { color: Color.parse("#1DD6DE"), offsetX: 0, offsetY: 1, opacity: 0.8, radius: 3.0 } }), text({ text: "This is normal text", textSize: 30, }), text({ text: "This is bold text", fontStyle: "bold", }), text({ text: "This is bold text", textSize: 30, fontStyle: "bold" }), text({ text: "This is italic text", fontStyle: "italic" }), text({ text: "This is italic text", textSize: 30, fontStyle: "italic" }), text({ text: "This is bold_italic text", fontStyle: "bold_italic" }), text({ text: "This is bold_italic text", textSize: 30, fontStyle: "bold_italic" }), text({ text: "Icon Font text from \ue631 ", textSize: 10, font: 'iconfont' }), text({ text: "Icon Font text from \ue631 ", textSize: 30, font: 'iconfont' }), text({ text: "Icon Font text from res/font/ \ue631 ", textSize: 10, font: 'font_iconfont' }), text({ text: "Icon Font text from res/font/ \ue631 ", textSize: 30, font: 'font_iconfont.ttf' }), text({ text: "Icon Font text from assets/fonts/ \ue631 ", textSize: 10, font: 'fonts/assets_iconfont' }), text({ text: "Icon Font text from assets/fonts/ \ue631 ", textSize: 30, font: 'fonts/assets_iconfont.ttf' }), text({ text: "This is line Spaceing 0,\nSecond line", maxLines: 0, }), text({ text: "This is line Spaceing 40,\nSecond line", maxLines: 0, lineSpacing: 40, textColor: Color.RED, textAlignment: Gravity.Right, onClick: function () { (this as Text).textAlignment = Gravity.Left; (this as Text).textColor = Color.BLACK; } }), text({ text: "This is strikethrough text.", textSize: 20, textColor: Color.RED, strikethrough: true, }), text({ text: "This is underline text.", textSize: 20, textColor: Color.BLUE, underline: true, }), text({ maxLines: 0, maxWidth: root.width, htmlText: `
To break
lines
in a
paragraph,
use the br tag.
This is a paragraph.
This is a paragraph.
Paragraph elements are defined by p tags.
Support setting background color and foreground color and underline.
An unordered list:
This is a paragraph.
This is a paragraph.
some text.some other text.
This is plain text This is bold text。
This is some text!
This is some text!
This is some text!
This is a long quotation. This is a long quotation. This is a long quotation. This is a long quotation. This is a long quotation.Please note that the browser adds line breaks before and after the blockquote element and increases the margins.