diff --git a/Dockerfile b/Dockerfile index 21f2b7c9..14e596bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ ENV BUNDLE_WITHOUT="development:test" WORKDIR /app -RUN apk add --no-cache build-base sqlite-dev libpq-dev mariadb-dev vips-dev vips-poppler vips-heif libc6-compat ttf-freefont +RUN apk add --no-cache build-base sqlite-dev libpq-dev mariadb-dev vips-dev vips-poppler vips-heif libc6-compat ttf-freefont ttf-liberation && cp /usr/share/fonts/liberation/LiberationSans-Regular.ttf /LiberationSans-Regular.ttf && apk del ttf-liberation COPY ./Gemfile ./Gemfile.lock ./ diff --git a/lib/submissions/generate_result_attachments.rb b/lib/submissions/generate_result_attachments.rb index 7867b655..2fd6f89b 100644 --- a/lib/submissions/generate_result_attachments.rb +++ b/lib/submissions/generate_result_attachments.rb @@ -3,7 +3,12 @@ module Submissions module GenerateResultAttachments FONT_SIZE = 11 - FONT_NAME = 'Helvetica' + FONT_PATH = '/LiberationSans-Regular.ttf' + FONT_NAME = if File.exist?(FONT_PATH) + FONT_PATH + else + 'Helvetica' + end INFO_CREATOR = "#{Docuseal::PRODUCT_NAME} (#{Docuseal::PRODUCT_URL})".freeze SIGN_REASON = 'Signed by %s with DocuSeal.co' @@ -32,6 +37,7 @@ module Submissions field.fetch('areas', []).each do |area| pdf = pdfs_index[area['attachment_uuid']] + pdf.fonts.add(FONT_NAME) page = pdf.pages[area['page']] @@ -47,6 +53,7 @@ module Submissions next if Array.wrap(value).compact_blank.blank? canvas = page.canvas(type: :overlay) + canvas.font(FONT_NAME, size: font_size) case field['type'] when 'image', 'signature'