🎨 PDF : new helper method to set only font weight and size

This commit is contained in:
Pierre Goiffon
2019-01-02 14:58:57 +01:00
parent bdedd83368
commit 5723e9a77e
4 changed files with 29 additions and 9 deletions

View File

@@ -162,7 +162,8 @@ class DisplayableNode extends GraphNode
}
}
$oPdf->SetFont(iTopPDF::GetPdfFont(), '', 24 * $fScale, '', true);
$siTopFont = iTopPDF::GetPdfFont();
$oPdf->SetFont($siTopFont, '', 24 * $fScale, '', true);
$width = $oPdf->GetStringWidth($this->GetProperty('label'));
$height = $oPdf->GetStringHeight(1000, $this->GetProperty('label'));
$oPdf->setAlpha(0.6 * $Alpha);
@@ -547,7 +548,8 @@ class DisplayableRedundancyNode extends DisplayableNode
$oPdf->Circle($this->x*$fScale, $this->y*$fScale, 16*$fScale, 0, 360, 'DF');
$oPdf->SetTextColor(255, 255, 255);
$oPdf->SetFont(iTopPDF::GetPdfFont(), '', 28 * $fScale, '', true);
$siTopFont = iTopPDF::GetPdfFont();
$oPdf->SetFont($siTopFont, '', 28 * $fScale, '', true);
$sLabel = (string)$this->GetProperty('label');
$width = $oPdf->GetStringWidth($sLabel, iTopPDF::GetPdfFont(), 'B', 24 * $fScale);
$height = $oPdf->GetStringHeight(1000, $sLabel);
@@ -794,7 +796,8 @@ class DisplayableGroupNode extends DisplayableNode
$oPdf->Image($sIconPath, ($this->x - 17)*$fScale, ($this->y - 17)*$fScale, 16*$fScale, 16*$fScale);
$oPdf->Image($sIconPath, ($this->x + 1)*$fScale, ($this->y - 17)*$fScale, 16*$fScale, 16*$fScale);
$oPdf->Image($sIconPath, ($this->x -8)*$fScale, ($this->y +1)*$fScale, 16*$fScale, 16*$fScale);
$oPdf->SetFont(iTopPDF::GetPdfFont(), '', 24 * $fScale, '', true);
$siTopFont = iTopPDF::GetPdfFont();
$oPdf->SetFont($siTopFont, '', 24 * $fScale, '', true);
$width = $oPdf->GetStringWidth($this->GetProperty('label'));
$oPdf->SetTextColor(0, 0, 0);
$oPdf->Text($this->x*$fScale - $width/2, ($this->y + 25)*$fScale, $this->GetProperty('label'));
@@ -1295,7 +1298,8 @@ class DisplayableGraph extends SimpleGraph
$aIcons = array();
$aContexts = array();
$aContextIcons = array();
$oPdf->SetFont(iTopPDF::GetPdfFont(), '', $fFontSize, '', true);
$siTopFont = iTopPDF::GetPdfFont();
$oPdf->SetFont($siTopFont, '', $fFontSize, '', true);
foreach($oIterator as $sId => $oNode)
{
if ($sClass = $oNode->GetObjectClass())