Quick Clicks

The Basics

Creating Card Layouts

Specifying Content

Content in CSV Files

Effects

Previewing and Finding Errors

Printing

Exporting for Documentation, Print-on-Demand, and Online Gaming

Text Layout

Item Tags and Hiding Card Items

Styles, Series, and Rotors

Appendices

Style Markup: Using Styles in Rich Text and Images

If you haven't yet read about the Styles feature, you should do so before continuing with this section. You should also be familiar with Rich Text Markup, and how to use the Content Editor to add Style markup to your content.

Tell me more about Styles
Tell me more about using Styles in the Content Editor. Tell me more about Rich Text Markup Syntax

Applying Styles by Using Rich Text Markup

Styles can be used in rich text markup to apply specific attributes of a particular style such as font, font size, bold, and italic. This can be done to apply part or all of that style to an item that does not have that style applied in Item Info.

Style content attributes can also be used in a limited fashion in Image With Markup items to specify image filenames.

On This Page

Basic Style Markup Syntax
Specifying the Style
Specifying the Attribute
Specifying Content Attributes
Image With Markup: Using Style Markup to Specify Images
 

Basic Style Markup Syntax

A style, as you should know by now, is a named collection of formatting attributes. These attributes can include a font, font size, font style (bold, italic, etc.), text color, and others. Each such attribute has a name in style markup syntax.

To apply an attribute from a given style in rich text, use this form:

{*stylename.attrname}your text{/*}

As with all rich text markup, the directive must be wrapped in {curly braces}. The { must be followed by an asterisk character * which makes this a style directive. Then the style is specified by its name, followed by a dot . and the attribute name. The following {/*} command cancels the style markup.

For example, if you have a style named "Hearts" that specifies a dark red text color, you could use that in rich text like this:

Draw one card from the {*Hearts.textcolor}red deck{/*}.
    ==> Draw one card from the red deck.  

Specifying the Style

The style can be specified in any of three ways. The simplest is by name, as in the above example where the style was named "Hearts".

The second way is to specify the current style, which is the style applied to the item in Item Info. To specify the current style, use a second asterisk instead of a stylename:

{**.myImageName}

An error will be reported if this syntax is used by an item that does not have a style assigned in Item Info. This method is most useful in Image With Markup items; see below.

The third way is by referencing the value of a different column (which must contain the name of a defined style). Specify the column in the usual way, by using two dots before the column name. Here's an example that applies the textcolor attribute from a style named in the "SuitStyle" column of your content:

{*..SuitStyle.textcolor}  

Specifying the Attribute

In style markup, you can either specify exactly one attribute of the style, or you can specify the entire style (all attributes) by omitting the dot and attrname and giving only the stylename.

Here are the defined attribute names that you can use in style markup. (Note that specifying, for example, {*MyStyle.bold} does not necessarily make your text bold, because MyStyle might specify not bold.)

fontname (Applies the font named in the style.)
fontsize
bold
italic
underline
strikethrough
textcolor
textshadow
alignment
ctv (Center Text Vertically)
sttf (Shrink Text to Fit)
bgcolor (Background Color)
corner (Corner Radius)
hidewhenempty
 

Specifying Content Attributes

The attributes listed above all affect the display characteristics of the item or its text. Content attributes specify actual content (that is, some literal text or an image filename) and you can use markup to include that content in your rich text items. To do that, just specify the content attribute name (which you assigned when you defined the style and its content attributes).

For example, if you have a style "Bowman" with a content attribute named "longrange" whose value is "Longbow", you can use it like this:

Purchase a {*Bowman.longrange} for $5
    ==> Purchase a Longbow for $5

The stylename "attribute"

While there is no actual attribute called stylename, you may use it as if it were a content attribute whose value is the name of the style itself. It can be used to construct filenames in Image With Markup items; see below.  

Image With Markup: Using Style Markup to Specify Images

By combining content attributes, style markup, and the Image With Markup item type, you can specify image filenames with great flexibility. In an ordinary Image item, the value specifies the image filename as a literal string. Within the value of an Image With Markup item, style markup will be processed in order to construct the image filename at runtime. (Style markup is not processed for ordinary Image items.)

For example, suppose you have a deck of cards in which each card has a suit. Your suits are Hearts, Spades, Diamonds, and Clubs, and you have defined a style for each of those suits. Each suit has a content attribute named "icon" which specifies the filename of the suit's icon—a heart, spade, diamond, or club.

Your content has a column named "SuitStyle" that specifies a suit by its style's name. To get the right suit icon for a card, make an Image With Markup item whose value is:

{*..SuitStyle.icon}

Multideck will find the image by looking in the SuitStyle column to get the suit's style, then looking in that style to get the value of its "icon" content attribute, and using that value as the image filename.

Acceptable markup for Image With Markup items

The only markup that is useful in the value of an Image With Markup item is:

The construct {*stylenameSpec.stylename} will be replaced by the literal name of the style. The stylenameSpec can be a literal stylename, a column reference (such as {*..SuitStyle.stylename}), or (if the ImageWithMarkup item has an assigned style) {**.stylename}

Examples:

A-{*..SuitStyle.stylename}.png  ==> if the column SuitStyle contains Hearts, this resolves to A-Hearts.png
image{.#}.png  ==> If the card number is 17, this resolves to image17.png

Important: Deprecated markup for Image With Markup items

In versions of Multideck prior to 1.9.2, the syntax for Image With Markup items was simpler but less useful. Some of those constructs are now deprecated, which means that they should continue to work as before until some future release when they will become unacceptable errors. During the period in which they remain deprecated, you will see warnings in your validation results when you use these constructs. If you see these warnings, please update your content to use the syntax described above. Otherwise your content may stop working and produce errors in some future version of Multideck.

Deprecated constructs include:

 

The One-Line Poker Deck: An Example Project

We have created a sample Multideck project that uses the Styles and Series features to print a complete standard 52-card poker deck from a single row of content.

Visit Multideck Demo Projects to download this and other example projects.

Next

Copyright © 2023 by Semicolon LLC. All international rights reserved.