add symbol fallback font to pdf export

This adds support for ToDo lists, both checked and unchecked
pull/11814/head
ulferts 2 years ago
parent d3b5929051
commit 49e2be3cfb
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 18
      app/models/work_package/pdf_export/view.rb
  2. BIN
      public/fonts/noto/NotoSansSymbols2-Regular.ttf

@ -55,27 +55,25 @@ class WorkPackage::PDFExport::View
end end
def fallback_fonts def fallback_fonts
[] [noto_font_base_path.join('NotoSansSymbols2-Regular.ttf')]
end end
def register_fonts!(document) def register_fonts!(document)
font_path = Rails.public_path.join('fonts')
document.font_families['NotoSans'] = { document.font_families['NotoSans'] = {
normal: { normal: {
file: font_path.join('noto/NotoSans-Regular.ttf'), file: noto_font_base_path.join('NotoSans-Regular.ttf'),
font: 'NotoSans-Regular' font: 'NotoSans-Regular'
}, },
italic: { italic: {
file: font_path.join('noto/NotoSans-Italic.ttf'), file: noto_font_base_path.join('NotoSans-Italic.ttf'),
font: 'NotoSans-Italic' font: 'NotoSans-Italic'
}, },
bold: { bold: {
file: font_path.join('noto/NotoSans-Bold.ttf'), file: noto_font_base_path.join('NotoSans-Bold.ttf'),
font: 'NotoSans-Bold' font: 'NotoSans-Bold'
}, },
bold_italic: { bold_italic: {
file: font_path.join('noto/NotoSans-BoldItalic.ttf'), file: noto_font_base_path.join('NotoSans-BoldItalic.ttf'),
font: 'NotoSans-BoldItalic' font: 'NotoSans-BoldItalic'
} }
} }
@ -99,4 +97,10 @@ class WorkPackage::PDFExport::View
document.font document.font
end end
private
def noto_font_base_path
Rails.public_path.join('fonts/noto')
end
end end

Loading…
Cancel
Save