Text object is missing several important fields.
reworks-org opened this issue ยท 3 comments
reworks-org commented
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 commented
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 commented
@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 commented
Works perfect. Thanks.