Skip to content

Tab stop leader() is not drawn in <Paragraph>, only in <HTML> #38

Description

@pgundlach

Summary

The leader() of a -bag-tab-stops stop is not drawn when the paragraph comes from <Paragraph> inside <TextBlock>. The stop itself works: the text after the tab lands at the right position, only the leader between the two parts is missing. The same rule on a <p> inside <HTML> draws the leader as expected.

Reproduction

layout.xml:

<Layout xmlns="urn:speedata.de/2021/xts/en" xmlns:sd="urn:speedata.de/2021/xtsfunctions/en">
  <StyleSheet>
    p.a { -bag-tab-stops: 100% end leader(dotted) }
    p.b { -bag-tab-stops: 100% end leader(".") }
  </StyleSheet>
  <Record match="data">
    <PlaceObject>
      <TextBlock>
        <Paragraph class="a"><Value>class dotted&#9;1</Value></Paragraph>
        <Paragraph class="b"><Value>class string&#9;2</Value></Paragraph>
        <Paragraph style="-bag-tab-stops: 100% end leader(dotted)"><Value>style dotted&#9;3</Value></Paragraph>
      </TextBlock>
    </PlaceObject>
    <PlaceObject>
      <HTML><p style="-bag-tab-stops: 100% end leader(dotted)">html dotted&#9;4</p></HTML>
    </PlaceObject>
  </Record>
</Layout>

data.xml:

<data/>

Run xts (version 0a20d2b0, htmlbag v0.0.67, boxesandglue v0.2.64). No errors or warnings are reported.

Expected

All four lines have a dotted leader between the text and the number at the right margin.

Actual

Lines 1 to 3 (<Paragraph> with class or style) show the text and the right-aligned number with blank space in between. Only line 4 (<HTML>) has the dots.

--dumpoutput shows the difference: in both cases the line has a <glue attr-origin="tab"> with the correct width, but only in the <HTML> case is it followed by the leader pattern (an hlist with the . glyph). The <Paragraph> lines are also nested one level deeper, as cmdTextBlock formats the vlist from htmlbag again with FormatParagraph.

Possible leads (not verified)

  • node.Glue.Copy() in boxesandglue (backend/node/glue.go) copies width, stretch, shrink and attributes, but not Leader, LeaderType and Subtype. If the TextBlock path copies the lines somewhere, the leader gets lost there. This would be the same pattern as the old Rule.Copy() bug with Pre/Post/Hide.
  • Document.nodeTabStops builds the leader pattern from the paragraph's Settings. If the paragraph built from <Paragraph> carries no font family at that level, leaderPattern may return no pattern without logging an error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions