1
0
Files
PPTX/docs/elements/text.md
lanyuanxiaoyao 124ef0e5ce refactor: 重构文档结构,采用渐进式信息披露模式
将 README.md 拆分为多个专题文档,减少认知负荷:
- 用户文档迁移到 docs/ (用户指南、元素、模板、参考等)
- 开发文档迁移到 docs/development/ (架构、模块、规范)
- README.md 精简至 ~290 行,仅保留概览和导航
- 删除 README_DEV.md,内容已迁移
- 归档 OpenSpec 变更 refactor-docs-progressive-disclosure
2026-03-06 15:11:36 +08:00

2.4 KiB
Raw Permalink Blame History

文本元素

文本元素用于在幻灯片中添加文本内容。

基本语法

- type: text
  box: [x, y, width, height]  # 位置和尺寸(英寸)
  content: "文本内容"
  font:
    size: 18              # 字号(磅)
    bold: true            # 粗体
    italic: false         # 斜体
    color: "#ff0000"      # 颜色
    align: center         # left/center/right

字体属性

基础属性

属性 类型 说明 默认值
size 数字 字号(磅) 18
bold 布尔 粗体 false
italic 布尔 斜体 false
color 字符串 颜色(#RRGGBB 或 #RGB #000000
align 字符串 对齐方式 left
family 字符串 字体族或预设类别 Arial

对齐方式

  • left - 左对齐
  • center - 居中对齐
  • right - 右对齐

高级字体样式

  • underline - 下划线true/false
  • strikethrough - 删除线true/false

段落属性

  • line_spacing - 行距倍数(如 1.5
  • space_before - 段前间距(磅)
  • space_after - 段后间距(磅)

高级属性

  • baseline - 基线位置normal/superscript/subscript
  • caps - 大小写转换normal/allcaps/smallcaps

示例

简单文本

slides:
  - elements:
      - type: text
        box: [1, 1, 8, 1]
        content: "Hello, World!"
        font:
          size: 44
          bold: true

多行文本

- type: text
  box: [1, 1, 8, 2]
  content: "第一行\n第二行\n第三行"
  font:
    size: 18

样式化文本

- type: text
  box: [1, 1, 8, 1]
  content: "标题文本"
  font:
    size: 32
    bold: true
    color: "#2c3e50"
    underline: true

使用字体主题

metadata:
  fonts:
    title:
      family: "cjk-sans"
      size: 44
      bold: true
      color: "#2c3e50"

slides:
  - elements:
      - type: text
        content: "标题文本"
        box: [1, 1, 8, 1]
        font: "@title"  # 引用字体主题

特性

文本框默认启用自动换行,文字超出宽度时会自动换行。

相关文档

返回文档索引