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

Text object is missing several important fields. #75

Closed
reworks-org opened this issue Nov 4, 2022 · 3 comments · Fixed by #76
Closed

Text object is missing several important fields. #75

reworks-org opened this issue Nov 4, 2022 · 3 comments · Fixed by #76
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@reworks-org
Copy link

The following fields are missing from the text object.

Field Type Description
bold bool Whether to use a bold font (default: false)
fontfamily string Font family (default: sans-serif)
halign string Horizontal alignment (center, right, justify or left (default))
italic bool Whether to use an italic font (default: false)
kerning bool Whether to use kerning when placing characters (default: true)
pixelsize int Pixel size of font (default: 16)
strikeout bool Whether to strike out the text (default: false)
underline bool Whether to underline the text (default: false)
valign string Vertical alignment (center, bottom or top (default))
@SSBMTonberry
Copy link
Owner

Thank you for your issue 🙂
This seems like a change that has not been clearly mentioned in Tiled's changelist.
Shouldn't take a lot of time to implement though 😄

@SSBMTonberry
Copy link
Owner

SSBMTonberry commented Nov 4, 2022

@Domre : Okay, so this should be okay now.
You'll find the latest version using the tileson.hpp or tileson_min.hpp from master 🙂

Summary from the related test showcasing the new properties:

tson::Text text = map->getLayer("Object Layer")->firstObj("text")->getText();
REQUIRE(text.bold);
REQUIRE(text.fontFamily == "Courier");
REQUIRE(text.horizontalAlignment == tson::TextAlignment::Center);
REQUIRE(text.italic);
REQUIRE(!text.kerning);
REQUIRE(text.pixelSize == 20);
REQUIRE(text.strikeout);
REQUIRE(text.text == "Tileson - Demo Map");
REQUIRE(text.underline);
REQUIRE(text.verticalAlignment == tson::TextAlignment::Bottom);
REQUIRE(text.wrap);

tson::Colori color = text.color;
REQUIRE(color.r == 254);
REQUIRE(color.g == 254);
REQUIRE(color.b == 254);
REQUIRE(color.a == 255);

@reworks-org
Copy link
Author

Works perfect. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants