support UTF-8 text via ttf
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ ENV BUNDLE_WITHOUT="development:test"
|
|||||||
|
|
||||||
WORKDIR /app
|
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 ./
|
COPY ./Gemfile ./Gemfile.lock ./
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,12 @@
|
|||||||
module Submissions
|
module Submissions
|
||||||
module GenerateResultAttachments
|
module GenerateResultAttachments
|
||||||
FONT_SIZE = 11
|
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
|
INFO_CREATOR = "#{Docuseal::PRODUCT_NAME} (#{Docuseal::PRODUCT_URL})".freeze
|
||||||
SIGN_REASON = 'Signed by %<email>s with DocuSeal.co'
|
SIGN_REASON = 'Signed by %<email>s with DocuSeal.co'
|
||||||
@@ -32,6 +37,7 @@ module Submissions
|
|||||||
|
|
||||||
field.fetch('areas', []).each do |area|
|
field.fetch('areas', []).each do |area|
|
||||||
pdf = pdfs_index[area['attachment_uuid']]
|
pdf = pdfs_index[area['attachment_uuid']]
|
||||||
|
pdf.fonts.add(FONT_NAME)
|
||||||
|
|
||||||
page = pdf.pages[area['page']]
|
page = pdf.pages[area['page']]
|
||||||
|
|
||||||
@@ -47,6 +53,7 @@ module Submissions
|
|||||||
next if Array.wrap(value).compact_blank.blank?
|
next if Array.wrap(value).compact_blank.blank?
|
||||||
|
|
||||||
canvas = page.canvas(type: :overlay)
|
canvas = page.canvas(type: :overlay)
|
||||||
|
canvas.font(FONT_NAME, size: font_size)
|
||||||
|
|
||||||
case field['type']
|
case field['type']
|
||||||
when 'image', 'signature'
|
when 'image', 'signature'
|
||||||
|
|||||||
Reference in New Issue
Block a user