mcc2 1.5.0 → 1.5.2
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
- checksums.yaml.gz.sig +0 -0
- data/lib/mcc2/layout.rb +5 -3
- data/lib/mcc2/layout_file.rb +3 -19
- data/lib/mcc2/printer/svg_drawer.rb +37 -26
- data/lib/mcc2/version.rb +1 -1
- data/locales/en.yml +3 -7
- data/locales/rs.yml +2 -6
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a08ba5a70ae6c9037682ade7613288e942d03f0414138363263774a629eb230
|
|
4
|
+
data.tar.gz: 92f09489f9bc5d51b219f9f8e759c88733b84879fdecbcfaa12e879b12fe506e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82eb11ee4eb3970afe30618e14cc134853bf2cb421b50fb7ce9bb642476cfd439762fa2445933775111407e3a4e56f41a41893004654acb27309987b97591bf8
|
|
7
|
+
data.tar.gz: ba7b7fbfcfb13e1adf97cdf29e656d552b411332115960254ce9328e8f546ec8743af7863da1fb370865ccf5729578178a64b312a70972c205746506cce3ce97
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/mcc2/layout.rb
CHANGED
|
@@ -177,9 +177,11 @@ module Mcc2
|
|
|
177
177
|
unless layout_file.warnings.empty?
|
|
178
178
|
wa = layout_file.warnings.join("\n\n")
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
@parent.app.addChore do
|
|
181
|
+
msg_box = FXMessageBox.new(@parent.app, I18n.t(:open_layout_file_warning, default: "Warnung beim Laden von %{filename}", filename:), wa, opts: MBOX_OK, ic: loadImage("mcc2/images/messagebox_warning.png"))
|
|
182
|
+
msg_box.create
|
|
183
|
+
msg_box.show(PLACEMENT_OWNER)
|
|
184
|
+
end
|
|
183
185
|
end
|
|
184
186
|
end
|
|
185
187
|
|
data/lib/mcc2/layout_file.rb
CHANGED
|
@@ -282,9 +282,7 @@ PRINT 1
|
|
|
282
282
|
# and object's Y means the text baseline, not the bounding box.
|
|
283
283
|
if filever < 4
|
|
284
284
|
@warnings << I18n.t(:open_layout_old_text_box, default: <<~EOT)
|
|
285
|
-
Diese Datei
|
|
286
|
-
Die Rahmengröße der Textobjekte wurde nun automatisch auf den des Beispieltextes gesetzt.
|
|
287
|
-
Evtl. muss aber eine Anpassung für die variablen Daten erfolgen.
|
|
285
|
+
Diese Datei wurde mit MCC2 version < 1.5.0 erstellt und wurde nun konvertiert.
|
|
288
286
|
|
|
289
287
|
Bitte prüfen Sie, dass alle Texte an der richtigen Position stehen.
|
|
290
288
|
EOT
|
|
@@ -308,19 +306,6 @@ PRINT 1
|
|
|
308
306
|
get_pango_font(font_info, pt(fontsize))
|
|
309
307
|
end
|
|
310
308
|
|
|
311
|
-
def get_text_sizes(go)
|
|
312
|
-
data = go[GOA_SAMPLE_DATA].to_s
|
|
313
|
-
if !data.empty?
|
|
314
|
-
pango_font = pango_font_of(go)
|
|
315
|
-
context = pango_font_map.create_context
|
|
316
|
-
layout = Pango::Layout.new(context)
|
|
317
|
-
layout.font_description = pango_font
|
|
318
|
-
layout.text = data # set the text to render
|
|
319
|
-
|
|
320
|
-
layout.pixel_size.map{|px| px_to_mm(px) }
|
|
321
|
-
end
|
|
322
|
-
end
|
|
323
|
-
|
|
324
309
|
def get_new_coods(go)
|
|
325
310
|
x = go[GOA_X].to_f
|
|
326
311
|
y = go[GOA_Y].to_f
|
|
@@ -360,13 +345,12 @@ PRINT 1
|
|
|
360
345
|
.sub("Mitte", "mid")
|
|
361
346
|
.sub("Rechts", "right")
|
|
362
347
|
|
|
363
|
-
w, h = converter.get_text_sizes(go)
|
|
364
348
|
# set bounding box and keep a little bit of space for safty
|
|
365
349
|
if just == S_JUST_LEFT
|
|
366
350
|
# Don't change middle or right aligned, they should already be valid
|
|
367
|
-
set_object_by_ids([id], GOA_WIDTH,
|
|
351
|
+
set_object_by_ids([id], GOA_WIDTH, "")
|
|
368
352
|
end
|
|
369
|
-
set_object_by_ids([id], GOA_HEIGHT,
|
|
353
|
+
set_object_by_ids([id], GOA_HEIGHT, "")
|
|
370
354
|
|
|
371
355
|
x, y = converter.get_new_coods(go)
|
|
372
356
|
# move text up, because old old Y means text baseline
|
|
@@ -231,8 +231,8 @@ module Mcc2
|
|
|
231
231
|
# die allgemeinen Attribute ermitteln
|
|
232
232
|
x = go[GOA_X].to_f
|
|
233
233
|
y = go[GOA_Y].to_f
|
|
234
|
-
go_width = go[GOA_WIDTH].to_f
|
|
235
|
-
go_height = go[GOA_HEIGHT].to_f
|
|
234
|
+
go_width = go[GOA_WIDTH].to_f unless go[GOA_WIDTH].to_s.empty?
|
|
235
|
+
go_height = go[GOA_HEIGHT].to_f unless go[GOA_HEIGHT].to_s.empty?
|
|
236
236
|
rotation = go[GOA_ROTATION].to_f
|
|
237
237
|
typ = go[GOA_TYP]
|
|
238
238
|
|
|
@@ -245,21 +245,14 @@ module Mcc2
|
|
|
245
245
|
data = go[GOA_SAMPLE_DATA].to_s
|
|
246
246
|
end
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
rec = tra.translate(mm(x).round, mm(y).round).rotate(rotation)
|
|
250
|
-
rec2 = rec.translate(mm(go_width), 0)
|
|
251
|
-
rec3 = rec.translate(mm(go_width), mm(go_height))
|
|
252
|
-
rec4 = rec.translate(0, mm(go_height))
|
|
253
|
-
orec = ObjRectangle.new(rec.vector2d, rec2.vector2d, rec3.vector2d, rec4.vector2d, id)
|
|
254
|
-
rect_list.add(orec)
|
|
255
|
-
end
|
|
248
|
+
rec = tra.translate(mm(x).round, mm(y).round).rotate(rotation)
|
|
256
249
|
|
|
257
250
|
drawing.g transform: "rotate(#{rec.a})" do
|
|
258
251
|
opos = rec.inverse
|
|
259
252
|
|
|
260
253
|
begin
|
|
261
254
|
# die Objekt-spezifischen Attribute ermitteln
|
|
262
|
-
if typ == TEXTOBJECT
|
|
255
|
+
go_width, go_height = if typ == TEXTOBJECT
|
|
263
256
|
draw_textobject(drawing, opos, go, go_width, go_height, data.empty? ? data_nosub : data)
|
|
264
257
|
elsif typ == PICTUREOBJECT
|
|
265
258
|
draw_pictureobject(drawing, opos, go, go_width, go_height, data)
|
|
@@ -275,6 +268,12 @@ module Mcc2
|
|
|
275
268
|
raise err, "#{go[GOA_NAME]}: #{err}"
|
|
276
269
|
end
|
|
277
270
|
|
|
271
|
+
rec2 = rec.translate(mm(go_width), 0)
|
|
272
|
+
rec3 = rec.translate(mm(go_width), mm(go_height))
|
|
273
|
+
rec4 = rec.translate(0, mm(go_height))
|
|
274
|
+
orec = ObjRectangle.new(rec.vector2d, rec2.vector2d, rec3.vector2d, rec4.vector2d, id)
|
|
275
|
+
rect_list.add(orec)
|
|
276
|
+
|
|
278
277
|
# in Vorschau einen Rahmen um das selektierte Objekt zeichnen
|
|
279
278
|
if preview && selected_object_ids.include?(id)
|
|
280
279
|
# drawing.fill("none")
|
|
@@ -349,6 +348,21 @@ module Mcc2
|
|
|
349
348
|
|
|
350
349
|
if data && !data.empty?
|
|
351
350
|
font_info = get_font_info(font, go)
|
|
351
|
+
context = pango_font_map.create_context
|
|
352
|
+
context.resolution = dpi
|
|
353
|
+
context.round_glyph_positions = false
|
|
354
|
+
layout = Pango::Layout.new(context)
|
|
355
|
+
|
|
356
|
+
pango_font = get_pango_font(font_info, pt(fontsize))
|
|
357
|
+
layout.font_description = pango_font
|
|
358
|
+
layout.width = mm(go_width) * Pango::SCALE if go_width
|
|
359
|
+
layout.height = mm(go_height) * Pango::SCALE if go_height
|
|
360
|
+
layout.wrap = Pango::WrapMode::WORD_CHAR
|
|
361
|
+
layout.justify = just_block
|
|
362
|
+
layout.alignment = pjust
|
|
363
|
+
layout.ellipsize = Pango::EllipsizeMode::END
|
|
364
|
+
layout.text = data # set the text to render
|
|
365
|
+
|
|
352
366
|
drawing.text_(fill: font_color,
|
|
353
367
|
'text-anchor': just,
|
|
354
368
|
'font-size': pt(fontsize),
|
|
@@ -358,20 +372,7 @@ module Mcc2
|
|
|
358
372
|
'font-stretch': font_info.font_stretch,
|
|
359
373
|
'xml:space': "preserve") do
|
|
360
374
|
|
|
361
|
-
|
|
362
|
-
layout = Pango::Layout.new(context)
|
|
363
|
-
|
|
364
|
-
pango_font = get_pango_font(font_info, pt(fontsize))
|
|
365
|
-
layout.font_description = pango_font
|
|
366
|
-
layout.width = mm(go_width) * Pango::SCALE
|
|
367
|
-
layout.height = mm(go_height) * Pango::SCALE
|
|
368
|
-
layout.wrap = Pango::WrapMode::WORD_CHAR
|
|
369
|
-
layout.justify = just_block
|
|
370
|
-
layout.alignment = pjust
|
|
371
|
-
layout.ellipsize = Pango::EllipsizeMode::END
|
|
372
|
-
layout.text = data # set the text to render
|
|
373
|
-
|
|
374
|
-
# iterate all lines of the text box
|
|
375
|
+
# iterate all characters of the text box
|
|
375
376
|
iter = layout.iter
|
|
376
377
|
loop do
|
|
377
378
|
|
|
@@ -398,12 +399,16 @@ module Mcc2
|
|
|
398
399
|
end
|
|
399
400
|
end
|
|
400
401
|
|
|
401
|
-
drawing.tspan(cluster_text, x: tra.x + line_x, y: tra.y + line_y_baseline, **overflow)
|
|
402
|
+
drawing.tspan(cluster_text, x: tra.x + line_x, y: tra.y + line_y_baseline, **(overflow || {}))
|
|
402
403
|
|
|
403
404
|
break unless next_byte_index
|
|
404
405
|
end
|
|
405
406
|
end
|
|
407
|
+
new_width, new_height = layout.pixel_size.map{|px| px_to_mm(px) }
|
|
408
|
+
|
|
409
|
+
return go_width || new_width, go_height || new_height
|
|
406
410
|
end
|
|
411
|
+
return 1, 1
|
|
407
412
|
end
|
|
408
413
|
|
|
409
414
|
def draw_pictureobject(drawing, tra, go, go_width, go_height, data)
|
|
@@ -458,6 +463,8 @@ module Mcc2
|
|
|
458
463
|
else
|
|
459
464
|
raise Printer::Base::ResourceNotFoundError, I18n.t(:image_not_found, default: "Das Bild '%{path}' konnte nicht gefunden werden.", path: )
|
|
460
465
|
end
|
|
466
|
+
|
|
467
|
+
return go_width, go_height
|
|
461
468
|
end
|
|
462
469
|
|
|
463
470
|
BARCODE_ALIAS = {
|
|
@@ -570,6 +577,7 @@ module Mcc2
|
|
|
570
577
|
'xml:space': "preserve")
|
|
571
578
|
end
|
|
572
579
|
end
|
|
580
|
+
return go_width, go_height
|
|
573
581
|
end
|
|
574
582
|
|
|
575
583
|
def barcode_mm_to_px(l, barcode_dpi)
|
|
@@ -592,6 +600,8 @@ module Mcc2
|
|
|
592
600
|
"stroke-width": mm(border_width).round,
|
|
593
601
|
x: tra.x, y: tra.y, width: mm(go_width).round, height: mm(go_height).round,
|
|
594
602
|
rx: mm(corner_radius), ry: mm(corner_radius))
|
|
603
|
+
|
|
604
|
+
return go_width, go_height
|
|
595
605
|
end
|
|
596
606
|
|
|
597
607
|
def draw_embedobject(drawing, tra, go, go_width, go_height, data, row_number, barcode_dpi)
|
|
@@ -630,6 +640,7 @@ module Mcc2
|
|
|
630
640
|
else
|
|
631
641
|
raise Printer::Base::ResourceNotFoundError, I18n.t(:embedded_object_not_found, default: "Das Layout '%{path}' konnte nicht gefunden werden.", path: )
|
|
632
642
|
end
|
|
643
|
+
return go_width, go_height
|
|
633
644
|
end
|
|
634
645
|
|
|
635
646
|
def get_font_info(font, obj)
|
data/lib/mcc2/version.rb
CHANGED
data/locales/en.yml
CHANGED
|
@@ -435,19 +435,15 @@ en:
|
|
|
435
435
|
Please set the correct data source type in the layout properties
|
|
436
436
|
and save the settings.
|
|
437
437
|
open_layout_old_barby: |
|
|
438
|
-
This file
|
|
438
|
+
This file uses Barby barcodes instead of the newer Zint barcodes.
|
|
439
439
|
|
|
440
440
|
Therefore, all barcodes must be checked and, if necessary, readjusted!
|
|
441
441
|
|
|
442
442
|
This warning will disappear once the file is saved.
|
|
443
443
|
open_layout_old_text_box: |
|
|
444
|
-
This file
|
|
444
|
+
This file was created with an MCC2 version < 1.5.0 and has now been converted.
|
|
445
445
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
However, adjustments may be necessary for the variable data.
|
|
449
|
-
|
|
450
|
-
Please verify that all text is positioned correctly.
|
|
446
|
+
Please verify that all text elements are in the correct position.
|
|
451
447
|
open_layout_version_error: The file %{filename} is structured according to version %{filever}, but this program can only process versions %{supported}.
|
|
452
448
|
preview_dpi_and_print_differ: The barcode DPI for the preview (%{preview_dpi}) and the print version (%{print_dpi}) differ. Please adjust the DPI and re-check the barcodes!
|
|
453
449
|
preview_error_printing_exception:
|
data/locales/rs.yml
CHANGED
|
@@ -441,13 +441,9 @@ rs:
|
|
|
441
441
|
|
|
442
442
|
Ово упозорење ће нестати када се датотека сачува.
|
|
443
443
|
open_layout_old_text_box: |
|
|
444
|
-
Ова датотека
|
|
444
|
+
Ова датотека је креирана помоћу верзије MCC2 < 1.5.0 и сада је конвертована.
|
|
445
445
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
Међутим, могу бити потребна подешавања за променљиве податке.
|
|
449
|
-
|
|
450
|
-
Молимо вас да проверите да ли је сав текст правилно позициониран.
|
|
446
|
+
Молимо вас да проверите да ли се сви текстуални елементи налазе на исправним позицијама.
|
|
451
447
|
open_layout_version_error: Датотека %{filename} је структурирана према верзији %{filever}, али овај програм може да обрађује само верзије %{supported}.
|
|
452
448
|
preview_dpi_and_print_differ: DPI вредности бар-кода за преглед (%{preview_dpi}) и верзију за штампу (%{print_dpi}) се разликују. Молимо вас да подесите DPI и поново проверите бар-кодове!
|
|
453
449
|
preview_error_printing_exception:
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|