my-last-cv 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/my_last_cv/renderer.rb +14 -2
- data/lib/my_last_cv/style.rb +2 -1
- data/lib/my_last_cv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf2509574951b9a1befe15309696db3b3dbfd5ce8196fafbd8ec48d2d4ae9d80
|
4
|
+
data.tar.gz: f0c6d142419598ce2246156320db87a98062667acd39e8ed30fbc06529745366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32586b06068dcc7b74e3700581634f6bf693108b87181641edf25c69084e1ad42258fd64fee58492a8fd509bf0fc1873a3d4efb5291504383fd508a2857d625a
|
7
|
+
data.tar.gz: 7ce669851940b2e5f9c1fdec663eb8d84f90b75da8ef3e927c111d58bd038c55727386e0742b6135dc184c69e09c9f06f9ad5366f9422b3329f1eab9b40c6808
|
data/lib/my_last_cv/renderer.rb
CHANGED
@@ -19,9 +19,21 @@ module MyLastCV
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
+
def resolved_fonts_dir
|
23
|
+
candidates = []
|
24
|
+
candidates << @style.fonts_dir if @style.fonts_dir
|
25
|
+
candidates << ENV["MY_LAST_CV_FONTS_DIR"] if ENV["MY_LAST_CV_FONTS_DIR"]
|
26
|
+
candidates << File.join(Dir.pwd, "fonts")
|
27
|
+
|
28
|
+
# fallback if no fonts_dir specified
|
29
|
+
candidates << File.expand_path("../../fonts", __dir__)
|
30
|
+
|
31
|
+
candidates.find { |p| p && Dir.exist?(p) }
|
32
|
+
end
|
33
|
+
|
22
34
|
def register_fonts(pdf)
|
23
|
-
fonts_dir =
|
24
|
-
return unless
|
35
|
+
fonts_dir = resolved_fonts_dir
|
36
|
+
return unless fonts_dir
|
25
37
|
|
26
38
|
# Exemple : Inter (Regular / Bold)
|
27
39
|
pdf.font_families.update(
|
data/lib/my_last_cv/style.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module MyLastCV
|
2
2
|
class Style
|
3
|
-
attr_reader :header_font, :header_size, :section_font, :section_size, :body_font, :body_size, :page_options, :accent_color
|
3
|
+
attr_reader :header_font, :header_size, :section_font, :section_size, :body_font, :body_size, :page_options, :accent_color, :fonts_dir
|
4
4
|
|
5
5
|
def initialize(opts = {})
|
6
6
|
@header_font = opts[:header_font] || 'Helvetica'
|
@@ -11,6 +11,7 @@ module MyLastCV
|
|
11
11
|
@body_size = opts[:body_size] || 10
|
12
12
|
@page_options = opts[:page_options] || { margin: 48 }
|
13
13
|
@accent_color = opts[:accent_color] || '000000'
|
14
|
+
@fonts_dir = opts[:fonts_dir] # optional
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/my_last_cv/version.rb
CHANGED