mcc2 1.5.4 → 1.5.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcf3cc173282198ab1be6840a1a144058ac88dba89e0c902fbc0c496b9f6822b
4
- data.tar.gz: b6d0905caada34aa1b01ca68342934e828006a6e41a7f31f17400fe010d3f248
3
+ metadata.gz: 04b179c2807041ccfec46f18af13d81c3d9d3e7bf98076efb2ee1848906cf0e2
4
+ data.tar.gz: 292e14fb85b636acc03b58ecbaf2c98500101ff8a2fc66e7e337f786ac94dece
5
5
  SHA512:
6
- metadata.gz: b93df1be1e1f894299cd3f28e9c971444970ba87a9ea69d6c3c3baeeb604bcb54bc4f0bd7713974a28bc84b637f01e34a2de5067a6ff28a3e5a62d5f6577ad32
7
- data.tar.gz: 797a3ae2635ae015ec65dd5afe4b204a9af1eb24dadbb0bf94338a55a5d0b2e3158908fde0f1d964210dbc392810270e3c192a84128473393db0681aa68486ae
6
+ metadata.gz: d74c2f2ad152f6fa47c37912f72ea2f17b265738b82b4e6323f4e7cea3bc8164086b1de24642db3ddb37a8af484140a8dea3f50bbb027bab8bf48c22e953c05a
7
+ data.tar.gz: 89a9179f3ab6611a8c2540d098b3a9a70f03f0a4db95b7fb470426f67a8b83825c106e883e85c56b366ba416ce2f9d12097cabaff9153d8c6b4691d55088827a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -243,7 +243,7 @@ PRINT 1
243
243
  set_attr_value(attr_name, param, S_CHIP)
244
244
  end
245
245
  elsif !param.to_s.empty?
246
- param = "#{i}=#{param}"
246
+ param = "#{i-1}=#{param}"
247
247
  set_attr_value(attr_name, param, S_CHIP)
248
248
  end
249
249
  end
@@ -16,7 +16,7 @@ module Mcc2
16
16
  add_attr(@go_attributes, GOA_FONT_COLOR, String, "000000FF")
17
17
  add_attr(@go_attributes, GOA_FONT_FILE, String, "")
18
18
  add_attr(@go_attributes, GOA_BACK_COLOR, String, "FFFFFFFF")
19
- add_attr(@go_attributes, GOA_FONT_WEIGHT, Integer, 0)
19
+ add_attr(@go_attributes, GOA_JUSTIFICATION, String, S_JUST_LEFT)
20
20
  add_attr(@go_attributes, GOA_BARCODE_OPTION_1, Integer, -1)
21
21
  add_attr(@go_attributes, GOA_BARCODE_OPTION_2, Integer, 0)
22
22
  add_attr(@go_attributes, GOA_BARCODE_OPTION_3, Integer, 0)
@@ -19,7 +19,7 @@ module Mcc2
19
19
  end
20
20
 
21
21
  def params_hash(row = nil)
22
- params.map do |param|
22
+ params(row).map do |param|
23
23
  key, value = param.split("=", 2)
24
24
  if key && value
25
25
  [key, value]
@@ -4,8 +4,8 @@ module Mcc2
4
4
  def initialize(xml_elem: nil, layout_file: nil)
5
5
  super
6
6
  @go_attributes[GOA_TYP].attr_value = TEXTOBJECT
7
- add_attr(@go_attributes, GOA_WIDTH, Integer, 30)
8
- add_attr(@go_attributes, GOA_HEIGHT, Integer, 6)
7
+ add_attr(@go_attributes, GOA_WIDTH, Integer, "")
8
+ add_attr(@go_attributes, GOA_HEIGHT, Integer, "")
9
9
  add_attr(@go_attributes, GOA_DATA, String, "")
10
10
  add_attr(@go_attributes, GOA_SAMPLE_DATA, String, "Sample-Text")
11
11
  add_attr(@go_attributes, GOA_FONT_HEIGHT, Integer, 10)
@@ -543,13 +543,6 @@ module Mcc2
543
543
  @lf.tabitem_font.shown = true
544
544
  @lf.textfield_text_color.text = obj[GOA_FONT_COLOR]
545
545
 
546
- fill_font_list
547
- fill_font_fields(obj)
548
- end
549
-
550
- # Attribute, die nur Texte haben
551
- if obj[GOA_TYP] == TEXTOBJECT
552
- @lf.horizontalframe_justify.shown = true
553
546
  # den Radiobutton der Ausrichtung setzen
554
547
  @lf.radiobutton_just_l.state = false
555
548
  @lf.radiobutton_just_m.state = false
@@ -562,6 +555,14 @@ module Mcc2
562
555
  when S_JUST_RIGHT
563
556
  @lf.radiobutton_just_r.state = true
564
557
  end
558
+
559
+ fill_font_list
560
+ fill_font_fields(obj)
561
+ end
562
+
563
+ # Attribute, die nur Texte haben
564
+ if obj[GOA_TYP] == TEXTOBJECT
565
+ @lf.checkbutton_justify.shown = true
565
566
  @lf.checkbutton_justify.setCheck(obj[GOA_JUSTIFICATION_BLOCK] == "true")
566
567
 
567
568
  data_block_shown
@@ -569,8 +570,8 @@ module Mcc2
569
570
 
570
571
  # Attribute, die nur Barcodes haben
571
572
  if obj[GOA_TYP] == BARCODEOBJECT
573
+ @lf.checkbutton_justify.shown = false
572
574
  @lf.tabitem_barcode.shown = true
573
- @lf.horizontalframe_justify.shown = false
574
575
  [1, 2, 3].each do |optx|
575
576
  @lf.send("spinner_barcode_option_#{optx}").value = obj[Mcc2.const_get("GOA_BARCODE_OPTION_#{optx}")].to_i
576
577
  end
@@ -192,6 +192,8 @@ module Mcc2
192
192
 
193
193
  attr_reader :font_map
194
194
 
195
+ # Attention: This method is called from the render thread.
196
+ # Be careful accessing instance variables!
195
197
  def draw_preview_now(row = nil)
196
198
  @font_map = {}
197
199
 
@@ -188,16 +188,19 @@ module Mcc2
188
188
 
189
189
  if layers.include?(1)
190
190
  pic = draw_rvg_image(layout_file, row, page, [1], x_offset, y_offset).negate
191
+ pic = pic.level2(Magick::QuantumRange / 2, Magick::QuantumRange / 2)
191
192
  data_k = pic.export_pixels_to_str(0, 0, pic.columns, pic.rows, "R", Magick::CharPixel)
192
193
  end
193
194
 
194
195
  if layers.include?(2)
195
196
  pic = draw_rvg_image(layout_file, row, page, [2], x_offset, y_offset).negate
197
+ pic = pic.level2(Magick::QuantumRange / 2, Magick::QuantumRange / 2)
196
198
  data_uv = pic.export_pixels_to_str(0, 0, pic.columns, pic.rows, "R", Magick::CharPixel)
197
199
  end
198
200
 
199
201
  if layers.include?(3)
200
202
  pic = draw_rvg_image(layout_file, row, page, [3], x_offset, y_offset).negate
203
+ pic = pic.level2(Magick::QuantumRange / 2, Magick::QuantumRange / 2)
201
204
  data_peeloff = pic.export_pixels_to_str(0, 0, pic.columns, pic.rows, "R", Magick::CharPixel)
202
205
  end
203
206
 
@@ -146,19 +146,18 @@ module Mcc2
146
146
  end.to_h.freeze
147
147
  end
148
148
  end
149
-
150
- @@font_map = SvgDrawer.builtin_font_names.dup
151
- @@pango_font_map = Pango::CairoFontMap.default
149
+ SvgDrawer.builtin_font_names
152
150
 
153
151
  def add_fonts_from_layout(layout_file)
152
+ @font_map = SvgDrawer.builtin_font_names.dup
154
153
  layout_file.sorted_id_list.each do |id|
155
154
  go = layout_file.find_graphic_object_by_id(id)
156
155
  font = go[GOA_FONT_TYP]
157
156
  if font == "from_file"
158
157
  font_path = go.layout_file.expand_path(go[GOA_FONT_FILE])
159
158
 
160
- @@font_map[font_path] ||= begin
161
- @@pango_font_map.add_font_file(font_path)
159
+ @font_map[font_path] ||= begin
160
+ PangoCairo::FontMap.default.add_font_file(font_path)
162
161
  fontinfo_from_file(font_path)
163
162
  end
164
163
  end
@@ -166,10 +165,10 @@ module Mcc2
166
165
  end
167
166
 
168
167
  def font_map
169
- @@font_map
168
+ @font_map
170
169
  end
171
170
  def pango_font_map
172
- @@pango_font_map
171
+ PangoCairo::FontMap.default
173
172
  end
174
173
 
175
174
  def flip_flop_mirrors(svg, tra, layout_file, preview, page)
@@ -485,6 +484,7 @@ module Mcc2
485
484
  option1 = go[GOA_BARCODE_OPTION_1].to_i
486
485
  option2 = go[GOA_BARCODE_OPTION_2].to_i
487
486
  option3 = go[GOA_BARCODE_OPTION_3].to_i
487
+ just = go[GOA_JUSTIFICATION]
488
488
  font = go[GOA_FONT_TYP]
489
489
  if font == "from_file"
490
490
  font = go.layout_file.expand_path(go[GOA_FONT_FILE])
@@ -536,37 +536,33 @@ module Mcc2
536
536
  xdim = xdim.to_i
537
537
  ydim = ydim.to_i if barcode.rows > 1 # optimize y dimension only on 2D codes
538
538
  end
539
- go_width, go_height = barcode_px_to_mm(xdim * xbars, barcode_dpi), barcode_px_to_mm(ydim * ybars, barcode_dpi)
540
- px_width, px_height = mm(go_width), mm(go_height)
539
+ go_width2, go_height2 = barcode_px_to_mm(xdim * xbars, barcode_dpi), barcode_px_to_mm(ydim * ybars, barcode_dpi)
540
+ px_width, px_height = mm(go_width2), mm(go_height2)
541
541
  xdim = px_width / xbars / xgran
542
542
  ydim = px_height / ybars / ygran
543
543
 
544
+ if just == S_JUST_RIGHT
545
+ apos = tra.translate(mm(go_width - go_width2), 0.0)
546
+ elsif just == S_JUST_MID
547
+ apos = tra.translate(mm(go_width - go_width2) / 2.0, 0.0)
548
+ else
549
+ apos = tra
550
+ end
551
+
544
552
  pathd = +""
545
553
  bcvector.each_rectangle do |bar|
546
554
  # p [bar.x, bar.y, bar.width, bar.height]
547
555
  # p [xdim*bar.width, ydim*bar.height, xdim*bar.x, ydim*bar.y]
548
- x = tra.x + xdim * bar.x
549
- y = tra.y + ydim * bar.y
550
- # drawing.rectangle(
551
- # x,
552
- # y,
553
- # x + [xdim * bar.width - 1, 0].max,
554
- # y + [ydim * bar.height - 1, 0].max
555
- # )
556
+ x = apos.x + xdim * bar.x
557
+ y = apos.y + ydim * bar.y
556
558
  # drawing.rect(x: x, y: y, width: xdim * bar.width, height: ydim * bar.height, fill: font_color, stroke: "none")
557
- # body.rect([xdim * bar.width / 2 - 1, 0].max, [ydim * bar.height / 2 - 1, 0].max, xdim * bar.x / 2, ydim * bar.y / 2)
558
559
  w = xdim * bar.width
559
560
  h = ydim * bar.height
560
561
  pathd << "M#{x} #{y}h#{w}v#{h}h-#{w}Z"
561
562
  end
562
563
  drawing.path(d: pathd, stroke: "none", fill: font_color)
563
564
  bcvector.each_string do |str|
564
- # p [str.x, str.y, str.text, str.halign, str.fsize]
565
- # drawing.text_anchor(HALIGNMENT[str.halign])
566
- # apos = tra.translate(xdim * str.x / xgran, )
567
- # drawing.text(tra.x + xdim * str.x, tra.y + ydim * str.y, str.text)
568
- # body.text(xdim * str.x / 2, ydim * str.y / 2, str.text).styles(text_anchor: HALIGNMENT[str.halign])
569
- drawing.text_(str.text, x: tra.x + xdim * str.x, y: tra.y + ydim * str.y,
565
+ drawing.text_(str.text, x: apos.x + xdim * str.x, y: apos.y + ydim * str.y,
570
566
  'text-anchor': HALIGNMENT[str.halign],
571
567
  fill: font_color,
572
568
  'font-size': pt(fontsize),
@@ -645,7 +641,8 @@ module Mcc2
645
641
  end
646
642
 
647
643
  def get_font_info(font, obj)
648
- font_info = @@font_map[font]
644
+ raise "add_fonts_from_layout wasn't called" unless font_map
645
+ font_info = font_map[font]
649
646
  unless font_info
650
647
  raise Printer::Base::ResourceNotFoundError, I18n.t(:font_not_found, default: "Die Schriftart '%{font}' in Object %{obj} konnte nicht gefunden werden.", font:, obj: obj[GOA_NAME].inspect )
651
648
  end
data/lib/mcc2/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mcc2
2
- VERSION = "1.5.4"
2
+ VERSION = "1.5.6"
3
3
  end
data/lib/mcc2.rb CHANGED
@@ -105,9 +105,6 @@ module Mcc2
105
105
  GOA_LAYER = "layer"
106
106
  GOA_FONT_HEIGHT = "font_height"
107
107
  GOA_FONT_TYP = "font_typ"
108
- GOA_FONT_WEIGHT = "font_weight"
109
- GOA_FONT_STYLE = "font_style"
110
- GOA_FONT_STRETCH = "font_stretch"
111
108
  GOA_FONT_COLOR = "font_color"
112
109
  GOA_FONT_FILE = "font_file"
113
110
  GOA_BACK_COLOR = "back_color"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcc2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Kanis
@@ -428,7 +428,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
428
428
  - !ruby/object:Gem::Version
429
429
  version: '0'
430
430
  requirements: []
431
- rubygems_version: 4.0.16
431
+ rubygems_version: 4.0.20
432
432
  specification_version: 4
433
433
  summary: Layout editor and card printer GUI
434
434
  test_files: []
metadata.gz.sig CHANGED
Binary file