A free open source IT asset/license management system
add fonts for L7162_A and vertical field stacking to custom sheet labels
Godfrey M565ab17520e5
diff --git a/app/Models/Labels/CustomLabels/Concerns/RenderCustomLabelContent.php b/app/Models/Labels/CustomLabels/Concerns/RenderCustomLabelContent.phpindex 3fb2a586d0..1dc77cdfc9 100644--- a/app/Models/Labels/CustomLabels/Concerns/RenderCustomLabelContent.php+++ b/app/Models/Labels/CustomLabels/Concerns/RenderCustomLabelContent.php@@ -231,6 +231,23 @@ trait RenderCustomLabelContentprotected function renderVerticalStackedTextBlock($pdf, $record, array $layout): void{+ if (!empty($layout['title'])) {+ static::writeText(+ $pdf,+ $record->get('title'),+ $layout['title']['x'],+ $layout['title']['y'],+ $this->getTitleFont(),+ 'B',+ $layout['title']['font_size'],+ 'L',+ $layout['title']['w'],+ $layout['title']['h'],+ true,+ 0+ );+ }+if (empty($layout['fields'])) {return;}diff --git a/app/Models/Labels/CustomLabels/CustomSheetLabel.php b/app/Models/Labels/CustomLabels/CustomSheetLabel.phpindex ac786d5a03..003bb9c226 100644--- a/app/Models/Labels/CustomLabels/CustomSheetLabel.php+++ b/app/Models/Labels/CustomLabels/CustomSheetLabel.php@@ -169,6 +169,11 @@ abstract class CustomSheetLabel extends RectangleSheetreturn $this->tagVAlign;}+ public function getTextRenderMode(): string+ {+ return $this->textRenderMode;+ }+public function preparePDF($pdf){$pdf->SetMargins(0, 0, 0);@@ -229,7 +234,7 @@ abstract class CustomSheetLabel extends RectangleSheet$this->renderLogo($pdf, $record, $layout);$this->render2DBarcode($pdf, $record, $layout);$this->renderBlockTag($pdf, $record, $layout);- $this->renderStackedTextBlock($pdf, $record, $layout);+ $this->renderTextBlock($pdf, $record, $layout);}protected function buildLayout($pdf, $record, $pa): array@@ -347,4 +352,14 @@ abstract class CustomSheetLabel extends RectangleSheetreturn $layout;}++ protected function renderTextBlock($pdf, $record, array $layout): void+ {+ if ($this->getTextRenderMode() === 'vertical_stack') {+ $this->renderVerticalStackedTextBlock($pdf, $record, $layout);+ return;+ }++ $this->renderStackedTextBlock($pdf, $record, $layout);+ }}diff --git a/app/Models/Labels/Sheets/Avery/L6009_A.php b/app/Models/Labels/Sheets/Avery/L6009_A.phpindex ed601ea2e6..ddaa3b5a89 100644--- a/app/Models/Labels/Sheets/Avery/L6009_A.php+++ b/app/Models/Labels/Sheets/Avery/L6009_A.php@@ -130,7 +130,7 @@ class L6009_A extends L6009'field_label_font_size' => $this->getLabelSize(),'field_label_margin' => $this->getLabelMargin(),'field_value_font' => 'freemono',- 'field_value_font_size' => $this->getLabelSize(),+ 'field_value_font_size' => $this->getFieldSize(),'field_value_margin' => $this->getFieldMargin(),];}diff --git a/app/Models/Labels/Sheets/Avery/L7162_A.php b/app/Models/Labels/Sheets/Avery/L7162_A.phpindex 1da99ba13f..32a4fd86c2 100644--- a/app/Models/Labels/Sheets/Avery/L7162_A.php+++ b/app/Models/Labels/Sheets/Avery/L7162_A.php@@ -115,18 +115,30 @@ class L7162_A extends L7162return true;}+ public function getTextRenderMode(): string+ {+ return 'vertical_stack';+ }+protected function getContentEditorConfig(): array{- return [+ return array('barcode_margin' => $this->getBarcodeMargin(),+ 'barcode_2d_size' => $this->getLabelPrintableArea()->h - (self::TITLE_SIZE + self::TITLE_MARGIN),+ 'tag_font' => 'freemono','tag_font_size' => $this->getTagSize(),- 'title_font_size' => $this->getTitleSize(),- 'title_margin' => $this->getTitleMargin(),+ 'tag_offset_x' => 4,+ 'title_font' => 'freesans',+ 'title_font_size' => 3.2,+ 'title_margin' => .4,+ 'field_label_font' => 'freesans','field_label_font_size' => $this->getLabelSize(),'field_label_margin' => $this->getLabelMargin(),- 'field_value_font_size' => $this->getFieldSize(),+ 'field_label_value_font' => 'freemono',+ 'field_value_font_size' => 3.6,'field_value_margin' => $this->getFieldMargin(),- ];+ 'text_render_mode' => $this->getTextRenderMode(),+ );}protected function getSupportsEditorConfig(): array