Fix: la police Times New Roman n'était pas prise en compte dans les pdf

This commit is contained in:
Regis Houssin 2007-04-02 14:01:30 +00:00
parent 6227ea1c49
commit f83618046f
4 changed files with 50 additions and 2 deletions

View File

@ -90,6 +90,8 @@ var $keywords; //keywords
var $creator; //creator var $creator; //creator
var $AliasNbPages; //alias for total number of pages var $AliasNbPages; //alias for total number of pages
var $PDFVersion; //PDF version number var $PDFVersion; //PDF version number
var $prevFontFamily; //store previous font family
var $prevFontStyle; //store previous style family
// variables pour HTML PARSER // variables pour HTML PARSER
@ -734,9 +736,12 @@ function AddFont($family,$style='',$file='')
function SetFont($family,$style='',$size=0) function SetFont($family,$style='',$size=0)
{ {
// save previous values
$this->prevFontFamily = $this->FontFamily;
$this->prevFontStyle = $this->FontStyle;
//Select a font; size given in points //Select a font; size given in points
global $fpdf_charwidths; global $fpdf_charwidths;
$family=strtolower($family); $family=strtolower($family);
if($family=='') if($family=='')
$family=$this->FontFamily; $family=$this->FontFamily;
@ -2189,9 +2194,13 @@ function _out($s)
$this->SetTextColor($coul['R'],$coul['G'],$coul['B']); $this->SetTextColor($coul['R'],$coul['G'],$coul['B']);
$this->issetcolor=true; $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)) { if (isset($attr['face']) and in_array(strtolower($attr['face']), $this->fontlist)) {
$this->SetFont(strtolower($attr['face'])); $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'])) { if (isset($attr['size'])) {
$headsize = intval($attr['size']); $headsize = intval($attr['size']);
@ -2465,6 +2474,41 @@ function _out($s)
function getScaleFactor() { function getScaleFactor() {
return $this->k; 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 //End of class
} }

View File

@ -268,6 +268,8 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J'); $pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J');
} }
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA

View File

@ -269,6 +269,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J'); $pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J');
} }
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA

View File

@ -266,6 +266,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J'); $pdf->MultiCell(108, 4, dol_entity_decode($libelleproduitservice), 0, 'J');
} }
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
// TVA // TVA