diff --git a/htdocs/includes/fpdf/fpdf/fpdf.php b/htdocs/includes/fpdf/fpdf/fpdf.php index 9b6391fd12e..89024c9dc5d 100644 --- a/htdocs/includes/fpdf/fpdf/fpdf.php +++ b/htdocs/includes/fpdf/fpdf/fpdf.php @@ -90,6 +90,8 @@ var $keywords; //keywords var $creator; //creator var $AliasNbPages; //alias for total number of pages var $PDFVersion; //PDF version number +var $prevFontFamily; //store previous font family +var $prevFontStyle; //store previous style family // variables pour HTML PARSER @@ -734,9 +736,12 @@ function AddFont($family,$style='',$file='') function SetFont($family,$style='',$size=0) { + // save previous values + $this->prevFontFamily = $this->FontFamily; + $this->prevFontStyle = $this->FontStyle; + //Select a font; size given in points global $fpdf_charwidths; - $family=strtolower($family); if($family=='') $family=$this->FontFamily; @@ -2189,9 +2194,13 @@ function _out($s) $this->SetTextColor($coul['R'],$coul['G'],$coul['B']); $this->issetcolor=true; } + + // convertir les noms des polices de FckEditor + $attr['face'] = $this->convertNameFont($attr['face']); + if (isset($attr['face']) and in_array(strtolower($attr['face']), $this->fontlist)) { $this->SetFont(strtolower($attr['face'])); - $this->issetfont=true; + //$this->issetfont=true; //créait un problème de police dans le pdf } if (isset($attr['size'])) { $headsize = intval($attr['size']); @@ -2465,6 +2474,41 @@ function _out($s) function getScaleFactor() { return $this->k; } + + /** + * Converti les noms des polices FckEditor. + * @string string chaine à convertir + * @return string chaine convertie. + * @author Régis Houssin + */ + function convertNameFont($namefont) + { + if ($namefont == "Times New Roman") + { + $name = "times"; + } + else if ($namefont == "Arial") + { + $name = "helvetica"; + } + else if ($namefont == "Verdana") + { + $name = "helvetica"; + } + else if ($namefont == "Comic Sans MS") + { + $name = "helvetica"; + } + else if ($namefont == "Courier New") + { + $name = "helvetica"; + } + else if ($namefont == "Tahoma") + { + $name = "helvetica"; + } + return $name; + } //End of class } diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 9fcbdfaa8a0..2fb34442ed6 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -268,6 +268,8 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J'); } + $pdf->SetFont('Arial','', 9); // On repositionne la police par défaut + $nexY = $pdf->GetY(); // TVA diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 562a6b91e7f..3bc815c1742 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -269,6 +269,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J'); } + $pdf->SetFont('Arial','', 9); // On repositionne la police par défaut $nexY = $pdf->GetY(); // TVA diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index dcdbb264f8c..52bd90b46e0 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -266,6 +266,7 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J'); } + $pdf->SetFont('Arial','', 9); // On repositionne la police par défaut $nexY = $pdf->GetY(); // TVA