06-15-2011, 02:33 PM,
(This post was last modified: 06-16-2011, 10:36 AM by kino.)
|
|||||
|
|||||
Getting Started2:Formatting and Styling Text
Most of the content that exists on the Web is static data. Tons and tons of information can be accessed using your browser. The way this information is presented plays a very important role.
Similar to HTML, Curl has a number of options that are used to enhance the presentability of the information. This includes the use of color, font size, font style, enumerated lists, and so on. The Curl language supports these text elements by providing text formats which can be classified as character formats and paragraph formats. Formatting Text Let's modify the applet text by adding simple text formatting. The simplest way to format text is to use Curl's predefined text formats. Two very common text formats are bold and italic. •bold presents the textual content in a bold font face. •italic formats the textual content using an italic or oblique font. Curly braces are used to specify a specific operator that is then followed by the content that it is applied to. We call this a Curly Expression, in which each open curly brace { has a matching closing curly brace } that bounds the {operator operands} expression. An example is: {bold my text}, where bold is the operator and my text is the operand. In our example code below, we have nested the italic text format inside the bold text format. The result is that the word "first" will be both bold and italic. Code: {curl 6.0, 7.0 applet} Tip: Notice that when we add an operator to the content, the editor automatically color codes it so that it stands out. The color coding of API elements is also available in the Curl IDE. The above example is similar in functionality of HTML properties. The HTML code tags would resemble the following: Code: <b><i> This is text that is bold and italic </i></b> Pre-defined Text Formats As we stated above, both bold and italic are predefined text formats. These formats are derived form the core Curl text formats and are shortcuts to frequently used text formats. Other Curl predefined text formats include: •monospace •tiny •small •big •huge •quote •underline •line-through •superscript •subscript Using Options Similar to HTML, formatting text can be specified using properties or options. Code: {text Each text format can have zero or more options that are specified in a comma delimited format. In the next example, we will specify the font size and the color of the text using option/value pairs. Code: {curl 6.0, 7.0 applet} Notice how you can mix Curl formatting techniques using option/value pairs and predefined text formats. For more information regarding text formats, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Getting Started with Text Formats Formatting a Paragraph By setting paragraph properties, or options, you control the appearance of the entire paragraph. This includes all contents of the paragraph (text, images, backgrounds, etc.) Each paragraph uses the paragraph text procedure that has the following syntax. Code: {paragraph List each option and value in any order. Similar to text formatting, a comma is necessary between each option/value pair. The paragraph text is specified last. Notice that each paragraph option specifies a particular characteristic. You can include any number of paragraph options to define a format. Code: {curl 6.0, 7.0 applet} Tip: Option values can be specified using any valid Curl quantity, or unit, such as pt, px, cm, and in. For more information regarding Curl quantities, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Core Language - Types > Quantities and Units Indenting, Offsetting, and Spacing In the following example, we are using paragraph spacing, indenting and offset properties. Obviously you might not use all of the options listed below, however for example purposes, we have listed the most commonly used options. Code: {curl 6.0, 7.0 applet} Block Quotes A block quote is a section of text that is separated from the rest of the text. Block quotes usually appear indented from both sides of a Web page and are often used for displaying long quotations. Block quotes can be defined by specifying the right and left edges, or by using the predefined paragraph format blockquote. Code: {curl 6.0, 7.0 applet} Note that blockquote is a Curl pre-defined format in which {blockquote ...} is equivalent to: Code: {paragraph For more information regarding paragraph formats, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Text Formatting > Paragraph Formats and Options Formatting Specific Text in a Paragraph You can control the appearance of text in your document by specifying formatting on specific words or sentences, rather than the entire paragraph. In these cases, the text formatting will override any paragraph settings that are placed. Each time we specify text formatting, we can use the {text ...} format. Each property/value combination must be delimited with a comma. Alternatively, we can specify predefined text formats such as bold or italic. Notice that predefined character formats can also be nested. Code: {curl 6.0, 7.0 applet} For more information regarding character formats, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Text Formatting > Character Formats and Options Creating Custom Text Formats When you create multiple documents belonging to the same product, application, book, or company, you are likely to want a common template of formats to ensure a consistent appearance. To define your own character or paragraph format, you can either build on one of the predefined formats, or you can define your own format. Both ways use define-text-format. Code: {curl 6.0, 7.0 applet} For more information regarding paragraph formats, please refer to the following section in the Curl Documentation:Curl Developer's Guide > Getting Started with Text Formats > Organizing Text Formats |
|||||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Getting Started2:Formatting and Styling Text - by kino - 06-15-2011, 02:33 PM
|
Users browsing this thread:
1 Guest(s)
1 Guest(s)