Skip to content
Discussion options

You must be logged in to vote

Hi @Hyper3x, a lot depends on the design and the code of your SVG file. We often have to write handlebar helper functions to wrap text and sometimes manipulate the SVG code and tags to create areas that dynamically reposition given the text content supplied to it.

2 common helper functions we use are below. You would put them in here: https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/src/form/common/certificate/handlebars/helpers.ts

const LINE_HEIGHT = 15
const DEFAULT_FONTSIZE = 11

function wordWrap(
  text: string,
  boundary: number,
  fontSize?: number,
  fontWeight?: string
) {
  const letterSizeFactor =
    (fontSize != null ? (fontSize + 1.13) / DEFAULT_FONTSIZE : 1)…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Hyper3x
Comment options

Answer selected by euanmillar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants