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

FFText如何实现一个段落首行缩进两个汉字 #443

Closed
Caisen1988 opened this issue Sep 15, 2024 · 3 comments
Closed

FFText如何实现一个段落首行缩进两个汉字 #443

Caisen1988 opened this issue Sep 15, 2024 · 3 comments

Comments

@Caisen1988
Copy link

FFText如何实现一个段落首行缩进两个汉字,感谢!

@Caisen1988
Copy link
Author

已经试了下面方法

  1. 前面添加2个空格
  2. '\u2003\u2003\u2003\u2003'
  3. 使用textIndent
    都不行
if (weatherJson.message['天气概述']) {
            // const indentSpace = '\u2003\u2003'; // 使用 2 个 Em 空格作为缩进
            const weatherSummary = weatherJson.message['天气概述'] || '';
            // const indentedText = `${indentSpace}${weatherSummary}`;
            const text = new FFText({
                text: weatherSummary,
                x: 400,
                y: 390,
                color: '#ffffff',
                width: 1090,
                font: fontPath,
            });

            text.setStyle({
                fontSize: 50,
                fontStyle: 'normal',
                fontWeight: 'bold',
                fill: '#ffffff',
                stroke: '#b9b7b7',
                strokeThickness: 3,
                dropShadow: true,
                dropShadowColor: '#000000',
                dropShadowBlur: 3,
                dropShadowAngle: Math.PI / 6,
                dropShadowDistance: 1,
                wordWrap: true,
                wordWrapWidth: 1090,
                breakWords: true,
                align: 'left',
                lineHeight: 60,
                leading: 10,
                letterSpacing: 2,
                textIndent: 100,
            });
            text.addEffect('fadeIn', 0.5, 9.2);
            text.addEffect('fadeOut', 0.1, 33);
            scene.addChild(text);
        }

@Caisen1988
Copy link
Author

@drawcall Hi Could you help to take a look, thank you so much.

@drawcall
Copy link
Member

Possibly no good solution for now.

@drawcall drawcall closed this as completed Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants