Merge pull request #5296 from betagouv/Marianne-font-on-prints
This commit is contained in:
commit
deeab55857
6 changed files with 32 additions and 32 deletions
|
@ -28,8 +28,8 @@ logo = @attestation[:logo]
|
|||
signature = @attestation[:signature]
|
||||
|
||||
prawn_document(margin: [top_margin, right_margin, bottom_margin, left_margin], page_size: page_size) do |pdf|
|
||||
pdf.font_families.update( 'liberation serif' => { normal: Rails.root.join('lib/prawn/fonts/liberation_serif/LiberationSerif-Regular.ttf' )})
|
||||
pdf.font 'liberation serif'
|
||||
pdf.font_families.update( 'marianne' => { normal: Rails.root.join('lib/prawn/fonts/marianne/marianne-regular.ttf' )})
|
||||
pdf.font 'marianne'
|
||||
|
||||
grey = '555555'
|
||||
black = '333333'
|
||||
|
@ -47,13 +47,13 @@ prawn_document(margin: [top_margin, right_margin, bottom_margin, left_margin], p
|
|||
end
|
||||
|
||||
pdf.fill_color grey
|
||||
pdf.pad_top(40) { pdf.text "le #{l(created_at, format: '%e %B %Y')}", size: 10, align: :right, character_spacing: -0.5 }
|
||||
pdf.pad_top(40) { pdf.text "le #{l(created_at, format: '%e %B %Y')}", size: 9, align: :right, character_spacing: -0.5 }
|
||||
|
||||
pdf.fill_color black
|
||||
pdf.pad_top(40) { pdf.text title, size: 18, character_spacing: -0.2 }
|
||||
pdf.pad_top(40) { pdf.text title, size: 14, character_spacing: -0.2 }
|
||||
|
||||
pdf.fill_color grey
|
||||
pdf.pad_top(30) { pdf.text body, size: 10, character_spacing: -0.2, align: :justify }
|
||||
pdf.pad_top(30) { pdf.text body, size: 9, character_spacing: -0.2, align: :justify }
|
||||
|
||||
if signature.present?
|
||||
pdf.pad_top(40) do
|
||||
|
|
|
@ -8,7 +8,7 @@ def render_in_2_columns(pdf, label, text)
|
|||
end
|
||||
|
||||
def format_in_2_lines(pdf, champ, nb_lines = 1)
|
||||
add_single_line(pdf, champ.libelle, 12, :bold)
|
||||
add_single_line(pdf, champ.libelle, 9, :bold)
|
||||
add_optionnal_description(pdf, champ)
|
||||
height = 10 * (nb_lines+1)
|
||||
pdf.bounding_box([0, pdf.cursor],:width => 460,:height => height) do
|
||||
|
@ -27,7 +27,7 @@ def format_in_2_columns(pdf, label)
|
|||
end
|
||||
|
||||
def format_with_checkbox(pdf, label, offset = 0)
|
||||
pdf.font 'liberation serif', size: 12 do
|
||||
pdf.font 'marianne', size: 9 do
|
||||
pdf.stroke_rectangle [0 + offset, pdf.cursor], 10, 10
|
||||
pdf.text_box label, at: [15 + offset, pdf.cursor]
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ def add_identite_individual(pdf, dossier)
|
|||
end
|
||||
|
||||
def add_identite_etablissement(pdf, libelle)
|
||||
add_single_line(pdf, libelle, 12, :bold)
|
||||
add_single_line(pdf, libelle, 9, :bold)
|
||||
|
||||
format_in_2_columns(pdf, "SIRET")
|
||||
format_in_2_columns(pdf, "Dénomination")
|
||||
|
@ -71,18 +71,18 @@ def add_identite_etablissement(pdf, libelle)
|
|||
end
|
||||
|
||||
def add_single_line(pdf, libelle, size, style)
|
||||
pdf.font 'liberation serif', style: style, size: size do
|
||||
pdf.font 'marianne', style: style, size: size do
|
||||
pdf.text libelle
|
||||
end
|
||||
end
|
||||
|
||||
def add_title(pdf, title)
|
||||
add_single_line(pdf, title, 24, :bold)
|
||||
add_single_line(pdf, title, 20, :bold)
|
||||
pdf.text "\n"
|
||||
end
|
||||
|
||||
def add_libelle(pdf, champ)
|
||||
add_single_line(pdf, champ.libelle, 12, :bold)
|
||||
add_single_line(pdf, champ.libelle, 9, :bold)
|
||||
end
|
||||
|
||||
def add_explanation(pdf, explanation)
|
||||
|
@ -98,7 +98,7 @@ def render_single_champ(pdf, champ)
|
|||
when 'Champs::RepetitionChamp'
|
||||
raise 'There should not be a RepetitionChamp here !'
|
||||
when 'Champs::PieceJustificativeChamp'
|
||||
add_single_line(pdf, 'Pièce justificative à joindre en complément du dossier', 12, :bold)
|
||||
add_single_line(pdf, 'Pièce justificative à joindre en complément du dossier', 9, :bold)
|
||||
format_with_checkbox(pdf, champ.libelle)
|
||||
add_optionnal_description(pdf, champ)
|
||||
pdf.text "\n"
|
||||
|
@ -116,7 +116,7 @@ def render_single_champ(pdf, champ)
|
|||
format_with_checkbox(pdf, Individual::GENDER_MALE)
|
||||
pdf.text "\n"
|
||||
when 'Champs::HeaderSectionChamp'
|
||||
add_single_line(pdf, champ.libelle, 18, :bold)
|
||||
add_single_line(pdf, champ.libelle, 14, :bold)
|
||||
add_optionnal_description(pdf, champ)
|
||||
pdf.text "\n"
|
||||
when 'Champs::ExplicationChamp'
|
||||
|
@ -175,12 +175,12 @@ def add_champs(pdf, champs)
|
|||
end
|
||||
|
||||
prawn_document(page_size: "A4") do |pdf|
|
||||
pdf.font_families.update( 'liberation serif' => {
|
||||
normal: Rails.root.join('lib/prawn/fonts/liberation_serif/LiberationSerif-Regular.ttf' ),
|
||||
bold: Rails.root.join('lib/prawn/fonts/liberation_serif/LiberationSerif-Bold.ttf' ),
|
||||
italic: Rails.root.join('lib/prawn/fonts/liberation_serif/LiberationSerif-Italic.ttf' ),
|
||||
pdf.font_families.update( 'marianne' => {
|
||||
normal: Rails.root.join('lib/prawn/fonts/marianne/marianne-regular.ttf' ),
|
||||
bold: Rails.root.join('lib/prawn/fonts/marianne/marianne-bold.ttf' ),
|
||||
italic: Rails.root.join('lib/prawn/fonts/marianne/marianne-thin.ttf' ),
|
||||
})
|
||||
pdf.font 'liberation serif'
|
||||
pdf.font 'marianne'
|
||||
pdf.svg IO.read("app/assets/images/header/logo-ds-wide.svg"), width: 300, position: :center
|
||||
pdf.move_down(40)
|
||||
|
||||
|
@ -199,7 +199,7 @@ prawn_document(page_size: "A4") do |pdf|
|
|||
pdf.text "\n"
|
||||
|
||||
add_title(pdf, 'Formulaire')
|
||||
add_single_line(pdf, @procedure.description + "\n", 12, :italic) if @procedure.description.present?
|
||||
add_single_line(pdf, @procedure.description + "\n", 9, :italic) if @procedure.description.present?
|
||||
add_champs(pdf, @dossier.champs)
|
||||
add_page_numbering(pdf)
|
||||
add_procedure(pdf, @dossier)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require 'prawn/measurement_extensions'
|
||||
|
||||
def format_in_2_lines(pdf, label, text)
|
||||
pdf.font 'liberation serif', style: :bold, size: 12 do
|
||||
pdf.font 'marianne', style: :bold, size: 10 do
|
||||
pdf.text label
|
||||
end
|
||||
pdf.text text
|
||||
pdf.text "\n"
|
||||
pdf.text text, size: 9
|
||||
pdf.text "\n", size: 9
|
||||
end
|
||||
|
||||
def format_in_2_columns(pdf, label, text)
|
||||
|
@ -16,8 +16,8 @@ def format_in_2_columns(pdf, label, text)
|
|||
end
|
||||
|
||||
def add_title(pdf, title)
|
||||
title_style = {style: :bold, size: 24}
|
||||
pdf.font 'liberation serif', title_style do
|
||||
title_style = {style: :bold, size: 20}
|
||||
pdf.font 'marianne', title_style do
|
||||
pdf.text title
|
||||
end
|
||||
pdf.text "\n"
|
||||
|
@ -83,7 +83,7 @@ def render_single_champ(pdf, champ)
|
|||
when 'Champs::PieceJustificativeChamp'
|
||||
return
|
||||
when 'Champs::HeaderSectionChamp'
|
||||
pdf.font 'liberation serif', style: :bold, size: 18 do
|
||||
pdf.font 'marianne', style: :bold, size: 14 do
|
||||
pdf.text champ.libelle
|
||||
end
|
||||
pdf.text "\n"
|
||||
|
@ -92,7 +92,7 @@ def render_single_champ(pdf, champ)
|
|||
when 'Champs::CarteChamp'
|
||||
format_in_2_lines(pdf, champ.libelle, champ.to_feature_collection.to_json)
|
||||
when 'Champs::SiretChamp'
|
||||
pdf.font 'liberation serif', style: :bold, size: 12 do
|
||||
pdf.font 'marianne', style: :bold, size: 9 do
|
||||
pdf.text champ.libelle
|
||||
end
|
||||
pdf.text " - SIRET: #{champ.to_s}"
|
||||
|
@ -130,8 +130,8 @@ def add_message(pdf, message)
|
|||
end
|
||||
|
||||
pdf.text "#{sender}, #{format_date(message.created_at)}", style: :bold
|
||||
pdf.text ActionView::Base.full_sanitizer.sanitize(message.body)
|
||||
pdf.text "\n"
|
||||
pdf.text ActionView::Base.full_sanitizer.sanitize(message.body), size: 9
|
||||
pdf.text "\n", size: 9
|
||||
end
|
||||
|
||||
def add_avis(pdf, avis)
|
||||
|
@ -159,11 +159,11 @@ def add_etats_dossier(pdf, dossier)
|
|||
end
|
||||
|
||||
prawn_document(page_size: "A4") do |pdf|
|
||||
pdf.font_families.update( 'liberation serif' => {
|
||||
normal: Rails.root.join('lib/prawn/fonts/liberation_serif/LiberationSerif-Regular.ttf' ),
|
||||
bold: Rails.root.join('lib/prawn/fonts/liberation_serif/LiberationSerif-Bold.ttf' ),
|
||||
pdf.font_families.update( 'marianne' => {
|
||||
normal: Rails.root.join('lib/prawn/fonts/marianne/marianne-regular.ttf' ),
|
||||
bold: Rails.root.join('lib/prawn/fonts/marianne/marianne-bold.ttf' ),
|
||||
})
|
||||
pdf.font 'liberation serif'
|
||||
pdf.font 'marianne'
|
||||
|
||||
pdf.svg IO.read("app/assets/images/header/logo-ds-wide.svg"), width: 300, position: :center
|
||||
pdf.move_down(40)
|
||||
|
|
BIN
lib/prawn/fonts/marianne/marianne-bold.ttf
Normal file
BIN
lib/prawn/fonts/marianne/marianne-bold.ttf
Normal file
Binary file not shown.
BIN
lib/prawn/fonts/marianne/marianne-regular.ttf
Normal file
BIN
lib/prawn/fonts/marianne/marianne-regular.ttf
Normal file
Binary file not shown.
BIN
lib/prawn/fonts/marianne/marianne-thin.ttf
Normal file
BIN
lib/prawn/fonts/marianne/marianne-thin.ttf
Normal file
Binary file not shown.
Loading…
Reference in a new issue