(target: MergedRunStyle, rPr: SafeXmlNode, ctx: RenderContext)
| 261 | } |
| 262 | |
| 263 | function mergeRunProps(target: MergedRunStyle, rPr: SafeXmlNode, ctx: RenderContext): void { |
| 264 | if (!rPr.exists()) return |
| 265 | |
| 266 | const sz = rPr.numAttr('sz') |
| 267 | if (sz !== undefined) target.fontSize = sz / 100 // hundredths of point -> pt |
| 268 | |
| 269 | const b = rPr.attr('b') |
| 270 | if (b !== undefined) target.bold = b === '1' || b === 'true' |
| 271 | |
| 272 | const i = rPr.attr('i') |
| 273 | if (i !== undefined) target.italic = i === '1' || i === 'true' |
| 274 | |
| 275 | const u = rPr.attr('u') |
| 276 | if (u !== undefined && u !== 'none') target.underline = true |
| 277 | if (u === 'none') target.underline = false |
| 278 | |
| 279 | const strike = rPr.attr('strike') |
| 280 | if (strike !== undefined && strike !== 'noStrike') target.strikethrough = true |
| 281 | if (strike === 'noStrike') target.strikethrough = false |
| 282 | |
| 283 | // Color from solidFill or gradFill child |
| 284 | const solidFill = rPr.child('solidFill') |
| 285 | if (solidFill.exists()) { |
| 286 | const { color, alpha } = resolveColor(solidFill, ctx) |
| 287 | const hex = color.startsWith('#') ? color : `#${color}` |
| 288 | if (alpha < 1) { |
| 289 | const { r, g, b: bl } = hexToRgb(hex) |
| 290 | target.color = `rgba(${r},${g},${bl},${alpha.toFixed(3)})` |
| 291 | } else { |
| 292 | target.color = hex |
| 293 | } |
| 294 | } |
| 295 | const gradFill = rPr.child('gradFill') |
| 296 | if (gradFill.exists()) { |
| 297 | const css = resolveGradientForText(gradFill, ctx) |
| 298 | if (css) target.textGradientCss = css |
| 299 | } |
| 300 | |
| 301 | // Font family |
| 302 | const latin = rPr.child('latin') |
| 303 | if (latin.exists()) { |
| 304 | const typeface = latin.attr('typeface') |
| 305 | if (typeface) { |
| 306 | target.fontFamily = resolveThemeFont(typeface, ctx) |
| 307 | } |
| 308 | } |
| 309 | if (!target.fontFamily) { |
| 310 | const ea = rPr.child('ea') |
| 311 | if (ea.exists()) { |
| 312 | const typeface = ea.attr('typeface') |
| 313 | if (typeface) { |
| 314 | target.fontFamily = resolveThemeFont(typeface, ctx) |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | if (!target.fontFamily) { |
| 319 | const cs = rPr.child('cs') |
| 320 | if (cs.exists()) { |
no test coverage detected