Text formatting – speedata Publisher
Description: <Textblock> and <Text> contain one or more paragraphs (command <Paragraph>). The actual texts are encapsulated there within <Value>. …

Version 5.9.2

# Text formatting

`<Textblock>` and `<Text>` contain one or more paragraphs (command `<Paragraph>`). The actual texts are encapsulated there within `<Value>`. There are numerous possibilities to influence the formatting of the texts. The switches for the font styles were introduced in Include Fonts. With a similar functionality there are the following commands:

`<Sub>` and `<Sup>`
  Subscript and superscript text.
`<Fontface>`
  Temporarily switches to a different font.
`<Color>`
  Outputs the enclosed text in a different color.
`<A>`
  Creates a hyperlink.
`<HSpace>`
  Inserts an expandable blank space (with or without dots).
`<U>`
  Underline.

        <PlaceObject>
          <Textblock width="11">
            <Paragraph>
              <Value>Text</Value>
              <Sub><Value>sub</Value></Sub>
              <Value> </Value>
              <Sup><Value>sup</Value></Sup>
              <Value> </Value>
              <U><Value>underline</Value></U>
              <Value> </Value>
              <Color name="green"><Value>green</Value></Color>
              <Value> </Value>
              <A href="https://www.speedata.de">
                <Value>link to the homepage</Value>
              </A>
              <HSpace leader=" . "/>
              <Value>right margin.</Value>
            </Paragraph>
          </Textblock>
        </PlaceObject>

## Microtypography

This section contains settings that can change small, sometimes inconspicuous details.

### Line breaking and font expansion

In the default setting of the speedata Publisher, characters may be stretched or compressed a little so that a paragraph can wrap better. This usually only occurs in very narrow columns if there are too many spaces between the words. This behaviour can be controlled using the command `<options>`.

    <Options fontexpansion="yes" />

The following settings are allowed:

`no`
  All characters retain the width specified by the font designer.
`some`
  The line break is carried out with the original widths, after the break the characters can be changed slightly in width so that the spaces between the words are slightly reduced.
`yes`
  (default setting) The paragraph break is tried out with different character widths and then the best result is used.

There are also the following attributes at `<options>` to set the degree of character expansion:

`fontstretch`
  Specifies the percentage by which the characters may be stretched. Specification is in 0.1 per cent: a value of 20 means 2%. The default setting is 40 (= 4%).
`fontshrink`
  Like `fontstretch`, only as an indication of the compression. The default setting is 30 (= 3%).
`fontstep`
  The steps in which the wrapping algorithm “tries out” the stretching or compression. The default setting is 10.

Here are some examples in German. German texts are famous for their long words which is especially painful in narrow columns.

### Optical margin alignment

With the parameter marginprotrusion (percentage) at the command `<LoadFontfile>` you can determine how far certain characters (comma, dot and hyphen) protrude into the right margin. This can be used to achieve an optically smoother margin in justified text:

    <Layout
      xmlns="urn:speedata.de:2009/publisher/en"
      xmlns:sd="urn:speedata:2009/publisher/functions/en">

      <Options mainlanguage="German" />
      <LoadFontfile name="main"
                    filename="MinionPro-Regular.otf"
                    marginprotrusion="100" />

      <DefineFontfamily name="text" fontsize="10" leading="12">
        <Regular fontface="main"/>
      </DefineFontfamily>

      <Record element="data">
        <PlaceObject>
          <Textblock width="4">
            <Paragraph>
              <Value select="."/>
            </Paragraph>
          </Textblock>
        </PlaceObject>
      </Record>
    </Layout>

The associated data file (`data.xml`) is as follows:

    <data>A wonderful serenity has taken possession of my entire
      soul, like these sweet mornings of spring which I enjoy
      with my whole heart. I am alone, and feel the charm of
      existence in this spot, which was created for the bliss of
      souls like mine. I am so happy, my dear friend, so
      absorbed in the exquisite sense of mere tranquil
      existence, that I neglect my talents.</data>

### Space characters

The following Unicode space characters are interpreted by the speedata Publisher:

Code | Name | Example | Width
--- | --- | --- | ---
`&amp;#x00A0;` | NO-BREAK SPACE | 1000 × 500 | Variable
`&amp;#x2002;` | EN SPACE | 1000 × 500 | 1/2 em
`&amp;#x2003;` | EM SPACE | 1000 × 500 | 1 em
`&amp;#x2004;` | THREE-PER-EM SPACE | 1000 × 500 | 1/3 em
`&amp;#x2005;` | FOUR-PER-EM SPACE | 1000 × 500 | 1/4em
`&amp;#x2006;` | SIX-PER-EM SPACE | 1000 × 500 | 1/6 em
`&amp;#x2009;` | THIN SPACE | 1000 × 500 | 1/8 em
`&amp;#x200A;` | HAIR SPACE | 1000 × 500 | 1/24 em
`&amp;#x200B;` | ZERO WIDTH SPACE | 1000​×​500 | without width
(space) | SPACE | 1000 × 500 | Variable

## Enumeration lists

Instead of a paragraph, an enumeration list can also appear: `<Ol>` creates an ordered list, `<Ul>` an unordered list; the individual items are marked with `<Li>`. All methods for creating enumeration lists, including examples for `<Ol>` and `<Ul>`, are described in the chapter Enumeration lists.

## Prevent text wrapping

Some headings and proper names should not be broken. There is a command `<NoBreak>` for this purpose, which suppresses wrapping in various ways. A somewhat exaggerated example is:

        <PlaceObject>
          <Textblock width="10cm">
            <Paragraph>
              <Value>A wonderful serenity has taken possession </Value>
              <NoBreak><Value>of my entire soul, like these sweet mornings...</Value></NoBreak>
            </Paragraph>
          </Textblock>
        </PlaceObject>

Alternatively, you can reduce the font size by specifying the maximum width or shorten the text with omission points.

          <Textblock width="10cm">
            <Paragraph>
              <NoBreak maxwidth="10" reduce="cut" text="...">
                <Value>A wonderful serenity has taken possession of my entire soul, like these sweet mornings...</Value>
              </NoBreak>
            </Paragraph>
          </Textblock>

## Break URLs

The command `<URL>` is used to make it easier to break URLs. You may wrap mainly at slashes (/), in addition no hyphens are inserted. No hyperlink is created, the command `<A>` is responsible for this.

    <Layout
      xmlns="urn:speedata.de:2009/publisher/en"
      xmlns:sd="urn:speedata:2009/publisher/functions/en">

      <SetGrid nx="40" ny="10"/>
      <Trace grid="yes"/>
      <Pageformat width="90mm" height="5cm"/>
      <Record element="data">
        <PlaceObject>
          <Textblock width="35">
            <Paragraph>
              <URL><Value>https://github.com/speedata/publisher/issues</Value></URL>
            </Paragraph>
          </Textblock>
        </PlaceObject>
      </Record>
    </Layout>

results in

#### On this page