Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breakWords causes lines to overlap unless splitStyle is "characters" #389

Open
mimshwright opened this issue Jun 9, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mimshwright
Copy link
Owner

Screenshot 2023-06-09 at 12 46 29

When you use the style breakWords: true (which allows line breaks in the middle of a block of long, unbroken text), the word is rendered correctly but the height of the text on the following line is not factored into the layout causing it to run into subsequent lines of text. This issue doesn't appear when you set splitStyle to "characters" but these settings are slightly different and it shouldn't be required to use splitStyle characters.

Repro:

const breakWordsText = `Use <code>splitStyle: "characters"</code> and <code>breakWords: true</code> to allow line breaks between characters. Can be useful for languages such as chinese.

<big>Selbstständigkeitserklärung</big>

全局设置的<blue>对齐</blue>属性由「默认」来<big>控制</big>。而且不能被<blue>别的样式</blue>所<red>覆盖</red>。`;
            const breakWordsStyle = {
              default: {
                fontFamily: "Arial",
                fontSize: "16px",
                fill: "#cccccc",
                wordWrap: true,
                wordWrapWidth: 260,
              },
              code: { fontFamily: "Courier" },
              blue: {
                fill: 0x4488ff,
                stroke: 0x2244cc,
                fontSize: "24px",
                breakWords: true,
              },
              red: { fill: 0xff8888, stroke: 0xcc4444, breakWords: true },
              big: {
                fill: 0x88ff88,
                stroke: 0x44cc44,
                fontSize: "36px",
                breakWords: true,
              },
            };
new TaggedText(breakWordsText, breakWordsStyle)

Related: #48

@mimshwright mimshwright added the bug Something isn't working label Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant