MCPcopy
hub / github.com/vercel/satori / buildText

Function buildText

src/builder/text.ts:46–160  ·  view source on GitHub ↗
(
  {
    id,
    content,
    filter,
    left,
    top,
    width,
    height,
    matrix,
    opacity,
    image,
    clipPathId,
    debug,
    shape,
    decorationShape,
  }: {
    content: string
    filter: string
    id: string
    left: number
    top: number
    width: number
    height: number
    matrix: string
    opacity: number
    image: string | null
    clipPathId?: string
    debug?: boolean
    shape?: boolean
    decorationShape?: string
  },
  style: Record<string, number | string>
)

Source from the content-addressed store, hash-verified

44}
45
46export default function buildText(
47 {
48 id,
49 content,
50 filter,
51 left,
52 top,
53 width,
54 height,
55 matrix,
56 opacity,
57 image,
58 clipPathId,
59 debug,
60 shape,
61 decorationShape,
62 }: {
63 content: string
64 filter: string
65 id: string
66 left: number
67 top: number
68 width: number
69 height: number
70 matrix: string
71 opacity: number
72 image: string | null
73 clipPathId?: string
74 debug?: boolean
75 shape?: boolean
76 decorationShape?: string
77 },
78 style: Record<string, number | string>
79) {
80 let extra = ''
81 if (debug) {
82 extra = buildXMLString('rect', {
83 x: left,
84 y: top - height,
85 width,
86 height,
87 fill: 'transparent',
88 stroke: '#575eff',
89 'stroke-width': 1,
90 transform: matrix || undefined,
91 'clip-path': clipPathId ? `url(#${clipPathId})` : undefined,
92 })
93 }
94
95 // This grapheme should be rendered as an image.
96 if (image) {
97 const shapeProps = {
98 href: image,
99 x: left,
100 y: top,
101 width,
102 height,
103 transform: matrix || undefined,

Callers 1

buildTextNodesFunction · 0.85

Calls 1

buildXMLStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…