prawn-swiss_qr_bill 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faa2f8fb8c38ea2681890f7573bb42ab424cadb413d57699e0e64145088c8911
4
- data.tar.gz: 2fa0db096bc0d9fb4060858dd0fe88ba187c20a54ae36babcb66848c6a102a33
3
+ metadata.gz: 427079ece5871b80503cf648e5f855d3ff1a0862e120fcf7ce9b125f641aaf0b
4
+ data.tar.gz: f0a5e3e4e28ce8ef24b4888e56d06bf48ed0c98a23890c5b642195a6a92a275f
5
5
  SHA512:
6
- metadata.gz: e1d30550f53e1ed3dc74a0256d826a25fa2290f06a9b4e282e8529dabeaf334907b87613e6babd52667ee3cf248098464dd9381743e4883014a7a85c8783c97d
7
- data.tar.gz: 536068e41ad5d54e70dcebe9deeeb19a1984eb52b4bee5e020e5644bbdcf4e7c66453b449ae3e811b523f37dc2b3fc1a2dcaacd51c072562a1628b0b3ef509ea
6
+ metadata.gz: 7f1bf0ea06f6a9cf152763d0cf0f721efd403b066fd27bba3a4dde2635e72a2426708f799daa45f46eff49027435211f6b916ce08acba407786e186580b205a9
7
+ data.tar.gz: 7408f2208b8c129392ce77233c32666eb283a39cd86af927aa66c12e79cd093d06147c64de30bba81b1f6e5ebaad5abee88556fd29b6d4f548cfa01f81a62a45
data/README.md CHANGED
@@ -3,6 +3,11 @@
3
3
  A Ruby library for creating Swiss QR-bill payment slips inside a PDF. It is
4
4
  built as a [Prawn](https://github.com/prawnpdf/prawn) extension.
5
5
 
6
+
7
+ [![Gem](https://img.shields.io/gem/v/prawn-swiss_qr_bill?color=green&label=gem%20version)](https://rubygems.org/gems/prawn-swiss_qr_bill)
8
+ [![Build Status](https://github.com/mitosch/prawn-swiss_qr_bill/workflows/CI/badge.svg)](https://github.com/mitosch/prawn-swiss_qr_bill/actions/workflows/ci.yml)
9
+ [![Test Coverage](https://codecov.io/gh/mitosch/prawn-swiss_qr_bill/graph/badge.svg)](https://codecov.io/gh/mitosch/prawn-swiss_qr_bill)
10
+
6
11
  ## Installation
7
12
 
8
13
  Add the following line to your `Gemfile`:
Binary file
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -4,17 +4,33 @@ module Prawn
4
4
  module SwissQRBill
5
5
  # Bill renders the Swiss QR-bill at the bottom of a page
6
6
  class Bill
7
+ FONT_DIR = File.expand_path("#{__dir__}/../../../assets/fonts")
8
+
7
9
  def initialize(document, data)
8
10
  @doc = document
9
11
  @data = data
10
12
  end
11
13
 
12
14
  def draw
15
+ set_font
16
+
13
17
  @doc.canvas do
14
18
  Sections.draw_all(@doc, @data)
15
19
  CuttingLines.new(@doc).draw
16
20
  end
17
21
  end
22
+
23
+ private
24
+
25
+ def set_font
26
+ @doc.font_families.update(
27
+ 'Inter' => {
28
+ normal: "#{FONT_DIR}/inter/Inter-Regular.ttf",
29
+ bold: "#{FONT_DIR}/inter/Inter-Bold.ttf"
30
+ }
31
+ )
32
+ @doc.font 'Inter'
33
+ end
18
34
  end
19
35
  end
20
36
  end
@@ -4,7 +4,7 @@ module Prawn
4
4
  module SwissQRBill
5
5
  # Horizontal and vertical cutting lines with a scissor symbol
6
6
  class CuttingLines
7
- SCISSOR_FILE = File.expand_path("#{__dir__}/images/scissor.png")
7
+ SCISSOR_FILE = File.expand_path("#{__dir__}/../../../assets/images/scissor.png")
8
8
 
9
9
  SCISSOR_WIDTH = 5.mm
10
10
  SCISSOR_HEIGHT = 3.mm
@@ -17,7 +17,7 @@ module Prawn
17
17
  def initialize(document)
18
18
  @doc = document
19
19
 
20
- @brain = {}
20
+ @brain = { border: { color: nil, width: nil } }
21
21
 
22
22
  load_specs
23
23
  end
@@ -40,8 +40,10 @@ module Prawn
40
40
  end
41
41
 
42
42
  def set_styles
43
- @brain[:line_width] = doc.line_width
43
+ @brain[:border][:width] = doc.line_width
44
+ @brain[:border][:color] = doc.stroke_color
44
45
 
46
+ doc.stroke_color '000000'
45
47
  doc.line_width 0.5
46
48
  doc.dash 2, space: 2
47
49
  end
@@ -66,7 +68,8 @@ module Prawn
66
68
  end
67
69
 
68
70
  def reset_styles
69
- doc.line_width = @brain[:line_width]
71
+ doc.line_width = @brain[:border][:width]
72
+ doc.stroke_color = @brain[:border][:color]
70
73
  doc.undash
71
74
  end
72
75
  end
@@ -18,7 +18,7 @@ module Prawn
18
18
  AMOUNT_WIDTH = 29.mm
19
19
 
20
20
  # height of the amount label when corner-box has to be displayed
21
- AMOUNT_LABEL_HEIGHT = 3.5.mm
21
+ AMOUNT_LABEL_HEIGHT = 4.mm
22
22
 
23
23
  # measurement of amount corner-box
24
24
  AMOUNT_BOX_WIDTH = 40.mm
@@ -18,7 +18,7 @@ module Prawn
18
18
 
19
19
  QR_PX_SIZE = 1160
20
20
 
21
- SWISS_CROSS_FILE = File.expand_path("#{__dir__}/../images/swiss_cross.png")
21
+ SWISS_CROSS_FILE = File.expand_path("#{__dir__}/../../../../assets/images/swiss_cross.png")
22
22
 
23
23
  MAPPING = {
24
24
  creditor_address_type: %i[creditor address type],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prawn
4
4
  module SwissQRBill
5
- VERSION = '0.4.1'
5
+ VERSION = '0.4.2'
6
6
  end
7
7
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.files = Dir['lib/**/**/*.rb',
18
18
  'lib/prawn/swiss_qr_bill/specs.yml',
19
- 'lib/prawn/swiss_qr_bill/images/*.png',
19
+ 'assets/images/*', 'assets/fonts/inter/*',
20
20
  'config/locales/*.yml',
21
21
  'prawn-swiss_qr_bill.gemspec',
22
22
  'Gemfile', 'README.md', 'CHANGELOG.mg'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-swiss_qr_bill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mischa Schindowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-18 00:00:00.000000000 Z
11
+ date: 2022-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -159,6 +159,11 @@ extra_rdoc_files: []
159
159
  files:
160
160
  - Gemfile
161
161
  - README.md
162
+ - assets/fonts/inter/Inter-Bold.ttf
163
+ - assets/fonts/inter/Inter-Regular.ttf
164
+ - assets/fonts/inter/OFL.txt
165
+ - assets/images/scissor.png
166
+ - assets/images/swiss_cross.png
162
167
  - config/locales/de.yml
163
168
  - config/locales/en.yml
164
169
  - config/locales/fr.yml
@@ -172,8 +177,6 @@ files:
172
177
  - lib/prawn/swiss_qr_bill/helpers/box_helper.rb
173
178
  - lib/prawn/swiss_qr_bill/helpers/number_helper.rb
174
179
  - lib/prawn/swiss_qr_bill/iban.rb
175
- - lib/prawn/swiss_qr_bill/images/scissor.png
176
- - lib/prawn/swiss_qr_bill/images/swiss_cross.png
177
180
  - lib/prawn/swiss_qr_bill/padded_box.rb
178
181
  - lib/prawn/swiss_qr_bill/qr/data.rb
179
182
  - lib/prawn/swiss_qr_bill/sections.rb