mapeditor / rs-tiled

Reads files from the Tiled editor into Rust
https://crates.io/crates/tiled
MIT License
268 stars 102 forks source link

text for text objects is not parsed #293

Closed AberDerBart closed 5 months ago

AberDerBart commented 5 months ago

When parsing text objects from a map file, the metadata (font family, pixel size, etc.) is parsed, but the actual text is skipped.

e.g.

<object id="2" x="48" y="288" width="304" height="32">
 <text fontfamily="8bitoprtyr" pixelsize="24" wrap="1" color="#003152">Look, over there is the stage...</text>
</object>

is parsed to

Object {
    data: ObjectData {
        id: 2,
        tile: None,
        name: "",
        user_type: "",
        x: 48.0,
        y: 288.0,
        rotation: 0.0,
        visible: true,
        shape: Text {
            font_family: "8bitoprtyr",
            pixel_size: 24,
            wrap: true,
            color: Color {
                alpha: 255,
                red: 0,
                green: 49,
                blue: 82,
            },
            bold: false,
            italic: false,
            underline: false,
            strikeout: false,
            kerning: false,
            halign: Left,
            valign: Top,
        },
        properties: {},
    },
}

(I omitted the map key from the debug output of the object containing the whole map)

aleokdev commented 5 months ago

Fixed in next branch. I'll publish it in crates.io

aleokdev commented 5 months ago

Workaround for now: tiled = {git = "https://github.com/mapeditor/rs-tiled.git", branch = "next" } in your Cargo.toml

bjorn commented 5 months ago

For the record, the change that fixed this is 4d3f19996365a910abb1a2ee53452639fd1c1440.

AberDerBart commented 5 months ago

Thanks for the fast response! The workaround works fine :)

aleokdev commented 5 months ago

Fixed on the last release