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>
textauszeichnungen
Various text markups

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.

fontexpansionsome
If fontexpansion="some" is switched on, the wrapped paragraph differs only slightly. On the right, both paragraphs are superimposed, the paragraph for which fontexpansion is set to some is green.
fontexpansionyes
With fontexpansion="yes" you have to experiment a little to determine a good degree of stretching and compression so that the paragraphs also look "good". On the left, fontexpansion is set to no, for the other two to yes. The paragraph on the right is set with the values 5% stretch and 3% compress (50 and 30 for fontstretch and fontshrink).

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>
marginprotrusion
Left: Comma, period and hyphen protrude into the right margin. Right: without optical margin alignment.

Space characters

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

Code Name Example Width
&#x00A0; NO-BREAK SPACE 1000 × 500 Variable
&#x2002; EN SPACE 1000 × 500 1 em
&#x2003; EM SPACE 1000 × 500 1/2 em
&#x2004; THREE-PER-EM SPACE 1000 × 500 1/3 em
&#x2005; FOUR-PER-EM SPACE 1000 × 500 1/4em
&#x2006; SIX-PER-EM SPACE 1000 × 500 1/6 em
&#x2009; THIN SPACE 1000 × 500 1/8 em
&#x200A; HAIR SPACE 1000 × 500 1/24 em
&#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. This is specified with <Ol> or <Ul> for an ordered list and an unordered list. The individual points must be marked with <Li>.

<PlaceObject>
  <Textblock>
    <Ol>
      <Li><Value>One</Value></Li>
      <Li><Value>Two</Value></Li>
    </Ol>
    <Ul>
      <Li><Value>One</Value></Li>
      <Li><Value>Two</Value></Li>
    </Ul>
  </Textblock>
</PlaceObject>
olul

There is a chapter on the various possibilities for 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>
nobreak1
The default setting for NoBreak is that the part must be connected.

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>
nobreak2
Here the text is cut off and filled with the specified text.

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

url