Use OpenSans TTF for better utf-8 compability in prawn documents.

This commit is contained in:
Benjamin Meichsner 2015-06-07 18:46:22 +02:00 committed by wvengen
parent 6af83bbc77
commit 342b916ce6
5 changed files with 15 additions and 0 deletions

View file

@ -16,6 +16,17 @@ class OrderPdf < Prawn::Document
end
def to_pdf
# Use ttf for better utf-8 compability
font_families.update(
"OpenSans" => {
bold: font_path("OpenSans-Bold.ttf"),
italic: font_path("OpenSans-Italic.ttf"),
bold_italic: font_path("OpenSans-BoldItalic.ttf"),
normal: font_path("OpenSans-Regular.ttf")
}
)
font "OpenSans"
font_size fontsize(12)
# Define header
@ -86,4 +97,8 @@ class OrderPdf < Prawn::Document
cfg
end
end
def font_path(name)
File.join(Rails.root, "vendor", "assets", "fonts", name)
end
end

BIN
vendor/assets/fonts/OpenSans-Bold.ttf vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
vendor/assets/fonts/OpenSans-Italic.ttf vendored Normal file

Binary file not shown.

BIN
vendor/assets/fonts/OpenSans-Regular.ttf vendored Normal file

Binary file not shown.