@weasel-js/svg 1.3.0-pre.0 → 1.4.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1255,19 +1255,21 @@ function parseTextElement(el, ctm, style, gradients, onWarn) {
|
|
|
1255
1255
|
const dominantBaseline = el.getAttribute("dominant-baseline");
|
|
1256
1256
|
const explicitTopAnchor = dominantBaseline === "text-before-edge" || dominantBaseline === "hanging";
|
|
1257
1257
|
const topY = explicitTopAnchor ? ay : ay - fontSize;
|
|
1258
|
+
const ownShift = ownProp(el, "baseline-shift");
|
|
1259
|
+
const inheritedShift = ownShift != null ? parseBaselineShift(ownShift, onWarn) : {};
|
|
1258
1260
|
const runs = [];
|
|
1259
1261
|
for (let i = 0; i < el.childNodes.length; i++) {
|
|
1260
1262
|
const child = el.childNodes[i];
|
|
1261
1263
|
if (child.nodeType === 3) {
|
|
1262
1264
|
const t = child.textContent ?? "";
|
|
1263
1265
|
if (!t) continue;
|
|
1264
|
-
runs.push({ text: t });
|
|
1266
|
+
runs.push({ text: t, ...inheritedShift });
|
|
1265
1267
|
} else if (child.nodeType === 1) {
|
|
1266
1268
|
const sp = child;
|
|
1267
1269
|
if (sp.tagName.toLowerCase() !== "tspan") {
|
|
1268
1270
|
onWarn(`<text> child <${sp.tagName}> not supported; flattening text content`);
|
|
1269
1271
|
const t = sp.textContent ?? "";
|
|
1270
|
-
if (t) runs.push({ text: t });
|
|
1272
|
+
if (t) runs.push({ text: t, ...inheritedShift });
|
|
1271
1273
|
continue;
|
|
1272
1274
|
}
|
|
1273
1275
|
const run = readTspanRun(sp, gradients, leafStyle, onWarn);
|