Skip to content

Commit 3243af7

Browse files
authored
Merge pull request #1536 from privy-open-source/release/1.0.0
feat(core): expose `usePsPDF`, `loadFont`, and `createCanvas`
2 parents dc4df03 + 2398526 commit 3243af7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/components/pdf-text/utils/text-to-image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export default async function generate (options: GenerateOptions, dpi = 1) {
160160
context.fillStyle = labelColor
161161

162162
for (const line of labelLines) {
163-
context.fillText(line, padding, y)
163+
context.fillText(line, padding, y, maxWidth)
164164

165165
y += (labelSize * lineHeight)
166166
}
@@ -211,7 +211,7 @@ export default async function generate (options: GenerateOptions, dpi = 1) {
211211
context.fillStyle = color
212212

213213
for (const line of lines) {
214-
context.fillText(line, padding, y)
214+
context.fillText(line, padding, y, maxWidth)
215215

216216
y += (fontSize * lineHeight)
217217
}

src/components/signature-draw/utils/smooth-line.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ export class SmoothLine {
7777
* @param length
7878
*/
7979
export function createLines (length: number): SmoothLine[] {
80-
return Array.from({ length }).map((_, i) => new SmoothLine(i / (length * 1.25)))
80+
return Array.from({ length }, (_, i) => new SmoothLine(i / (length * 1.25)))
8181
}

src/core/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,15 @@ export {
185185
export {
186186
useTableQuery,
187187
} from '../components/table-static'
188+
189+
export {
190+
usePspdf,
191+
} from '../components/pspdfkit'
192+
193+
export {
194+
default as loadFont,
195+
} from '../components/signature-text/utils/load-font'
196+
197+
export {
198+
createCanvas,
199+
} from '../components/signature-draw/utils/canvas'

0 commit comments

Comments
 (0)