Styled title text is misplaced when loading a 1.2 score or template into 2.0b

• Jan 31, 2013 - 22:39
Type
Functional
Severity
S4 - Minor
Status
closed
Project

When loading a 1.2 score or template that uses TextStyles, there are two problems:

  1. The Title, Subtitle and Composer are misplaced around the top left corner of the title frame.
  2. The Lyricist is shown unstyled

See the image 1.2-problem.png for an example.

The problem is in the section of read114.cpp that processes the TextStyle tag in the function Score::read114(XmlReader& e):

            else if (tag == "TextStyle") {
                  TextStyle s;
                  s.read(e);
                  // settings for _reloff::x and _reloff::y in old formats
                  // is now included in style; setting them to 0 fixes most
                  // cases of backward compatibility
                  s.setRxoff(0);
                  s.setRyoff(0);
                  _style.setTextStyle(s);
                  }

I found that (1) is caused by the calls to s.setRxoff(0) and s.setRyoff(0), which discard the placement of the text within the title frame.

(2) is caused by the fact that in 1.2, the TextStyle for the lyricist is called "Poet", but in 2.0 it is called "Lyricist". It can be fixed by updating the name when reading.

This gives the new code as:

            else if (tag == "TextStyle") {
                  TextStyle s;
                  s.read(e);
                  // Change 1.2 Poet to Lyricist
                  if (s.name() == "Poet")
                        s.setName("Lyricist");
                  _style.setTextStyle(s);
                  }

The above change gives the result shown in 1.2-fixed.png.

Despite the comment about _reloff::x and _reloff::y, I have not yet found any instances where zeroing the offsets actually improves compatibility, but I wanted to ask for comments before commiting the above change as a pull request.

Thanks -- Tony.

Attachment Size
1.2-problem.png 26.85 KB
1.2-fixed.png 25.4 KB

Comments