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

Problem of SVG image's textLength #27

Open
akuma opened this issue Jan 17, 2018 · 10 comments
Open

Problem of SVG image's textLength #27

akuma opened this issue Jan 17, 2018 · 10 comments

Comments

@akuma
Copy link

akuma commented Jan 17, 2018

When I use Chinese characters, the SVG image's textLength is smaller then expected.

actual

2018-01-17 8 01 23

source code:

<text xmlns="http://www.w3.org/2000/svg" fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="14" x="104" y="28.1543">中文</text>

expected

2018-01-17 8 03 02

source code:

<text xmlns="http://www.w3.org/2000/svg" fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="24" x="104" y="28.1543">中文</text>
@gfx
Copy link
Contributor

gfx commented Jan 17, 2018

Is this a PlantUML issue? or a plantuml-server issue?

@akuma
Copy link
Author

akuma commented Jan 18, 2018

It's right when I test with PlantUML.

Java Version: 1.8.0_152
PlantUML Version: git master

Perhaps this issue is related to the java version.
I try to deploy the plantuml-service locally for testing.

@gfx
Copy link
Contributor

gfx commented Jan 18, 2018

Thanks for the information.

Can you give us the PlantUML code?

@akuma
Copy link
Author

akuma commented Jan 18, 2018

PlantUML test code:

FileFormatOption formatOption = new FileFormatOption(FileFormat.SVG, true);
SourceStringReader renderer = new SourceStringReader(Defines.createEmpty(), "@startuml\n"
        + "class Hello\n"
        + "class 中文\n"
        + "Hello --> 中文\n"
        + "@enduml", new ArrayList<String>());

ByteArrayOutputStream out = new ByteArrayOutputStream();
renderer.outputImage(out, formatOption);
System.out.println(out.toString("UTF-8"));

@akuma
Copy link
Author

akuma commented Jan 18, 2018

I deploy the plantuml-service locally for testing.
And it's OK.

@gfx
Copy link
Contributor

gfx commented Jan 18, 2018

@startuml
    class Hello
    class 中文
    Hello --> 中文
@enduml

reproduces this problem.

@gfx
Copy link
Contributor

gfx commented Jan 18, 2018

Upgrading JDK (#29) does not solve this issue. I guess it might be caused by fonts.

@akuma
Copy link
Author

akuma commented Jan 18, 2018

Maybe you are right.

@gfx
Copy link
Contributor

gfx commented Jan 18, 2018

Install takao-fonts that is used in our production (98859ac), but the problem remains.

Hmm, maybe Chinese fonts are required?

@akuma
Copy link
Author

akuma commented Jan 18, 2018

Hmm, I agree with you.

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