Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ Under an Upgrading section, the bullets after **Local installs (`sdpm update`).*

### Fixed

- **A textbox border keeps its `lineOpacity`** (#667). The textbox builder ignored
`lineOpacity`, so a translucent border came out fully opaque, and a PPTX β†’ JSON β†’ PPTX
round trip lost the opacity `pptx_to_json` had read. It now writes the border alpha as
shapes do. Local mode and the AWS stack (SdpmRuntime).

- **Charts keep theme styling when `valueAxis` or `categoryAxis` is set.** Setting either
no longer drops theme styling of the axis tick labels, axis lines and title. Only a chart
read back from a PPTX keeps the styling it came with; JSON written by hand or by an agent
Expand Down
1 change: 1 addition & 0 deletions sdpm/references/guides/slide-json-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Expands an external JSON file's elements array. Draw order is controlled by posi
- `autoWidth`: true β†’ word_wrap disabled (width fits text)
- `line`: border color. Omit or `"none"` for no border
- `lineWidth`: border thickness (pt, default 1)
- `lineOpacity`: border opacity (default 1.0)
- `margin*`: px (same 1920-wide canvas basis as other coordinates)
- `verticalAlign`: `top`, `middle`, `bottom` (default: top for textbox)
- **Line breaks**: `\n` creates a line break (internally split into paragraphs)
Expand Down
3 changes: 3 additions & 0 deletions sdpm/sdpm/engine/builder/elements/textbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ def _add_textbox(self, slide, elem):
int(hex_color[4:6], 16)
)
textbox.line.width = Pt(line_width)
line_opacity = elem.get("lineOpacity")
if line_opacity is not None and 0 <= line_opacity < 1:
self._set_line_opacity(textbox, line_opacity)

# Apply text frame margins (px input β†’ EMU)
margin_left = elem.get("marginLeft")
Expand Down
9 changes: 9 additions & 0 deletions tests/test_element_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,15 @@ def test_box_properties_survive(self, tmp_path):
assert (out["verticalAlign"], out["textDirection"]) == ("bottom", "vert270")
assert (out["marginTop"], out["autoWidth"]) == (5, True)

def test_border_opacity_survives(self, tmp_path):
border = {"text": "t", "line": "#FF0000", "lineWidth": 2}
(sp,) = _built_shapes(tmp_path, [_textbox(**border, lineOpacity=0.5)])
assert sp._element.spPr.find(f"{_A}ln/{_A}solidFill/{_A}srgbClr/{_A}alpha").get("val") == "50000"
assert _one(tmp_path / "rt", _textbox(**border, lineOpacity=0.5))["lineOpacity"] == 0.5
for extra in ({}, {"lineOpacity": 1}):
(sp,) = _built_shapes(tmp_path / f"o{len(extra)}", [_textbox(**border, **extra)])
assert sp._element.spPr.find(f".//{_A}alpha") is None

def test_text_gradient_survives(self, tmp_path):
out = _one(tmp_path, _textbox(text="grad", fontSize=40,
textGradient={"angle": 0, "stops": GRADIENT["stops"]}))
Expand Down
Loading