Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Framework » Printing Σ (Sigma) not possible in PDF
Printing Σ (Sigma) not possible in PDF [message #7894] Tue, 31 December 2024 10:23 Go to next message
htManager is currently offline  htManager
Messages: 441
Registered: May 2014
Senior Member
I want to print the Σ Sign in a pdf document but it won't be printed.

With var_dump($str = "\u{2211}"); the Σ sign will be shown correctly. I use the Times font.

I read that the Times font supports the sigma character. Do I have to include an additional library? Or do I have to do something else?
Re: Printing Σ (Sigma) not possible in PDF [message #7895 is a reply to message #7894] Wed, 01 January 2025 04:37 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2373
Registered: April 2006
Location: Surrey, UK
Senior Member
Where did you read that the Times font supports the sigma character? That is a unicode character, so you need a font that supports unicode.

If you take a look at GREEK CAPITAL LETTER SIGMA (U+03A3) Font Support you will see that the code for the SIGMA character is actually \u{03A3}


Re: Printing Σ (Sigma) not possible in PDF [message #7896 is a reply to message #7895] Wed, 01 January 2025 07:00 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 441
Registered: May 2014
Senior Member
I don't know where is my fault.

If I call the following php file, the ∑ sign will be shown correctly in a pdf file.

<?php
require('c:\xampp\htdocs\radicore\includes\tcpdf\tcpdf.php') ;
$pdf = new TCPDF();
$pdf->AddPage();
$pdf->SetFont('times', '', 16);
$pdf->Cell(40, 10, 'Großes Sigma: Σ'); // Funktioniert mit Unicode
or
$pdf->Cell(40, 10, 'Großes Sigma: ' . "\u{03A3}"); // Funktioniert mit Unicode
$pdf->Output();
?>

If I define a field in my report nothing will be shown. - array('field' => 'sigma', 'width' => 10, 'x' => 0); - $sigma = "\u{03A3}";
If I define a label with value "\u{03A3}", a ? will be shown. - array('label' => "\u{03A3}", 'width' => 10, 'x' => 0);

The value sigma will also be shown correctly if I output it in my class file with var_dump("\u{03A3}");
Re: Printing Σ (Sigma) not possible in PDF [message #7897 is a reply to message #7896] Thu, 02 January 2025 06:27 Go to previous message
AJM is currently offline  AJM
Messages: 2373
Registered: April 2006
Location: Surrey, UK
Senior Member
I tried ruuning a test with the sigma character on my PC using the Times font and it displayed as '?' which is incorrect.

I tried running example_008.php in the TCPDF download as this demonstrates the ability to print numerous UTF-8 characters. I even added 'Großes Sigma: Σ' to the 'German (de)' entry in the examples/data/utf8test.txt file and it printed as it should. I noticed that the font used in that test was 'freeserif', so I changed the font in the RADICORE test to 'freeserif' and the sigma character displayed correctly. I even tried the 'freesans' font, and that displayed correctly as well.

It would appear that the 'Times' font will not display this character, so you will need to switch to a font that does.


Previous Topic: Importing default values -> enclosed in quotes
Next Topic: Introduction to the Radicore framework
Goto Forum:
  


Current Time: Sat Jan 04 20:47:07 EST 2025

Total time taken to generate the page: 0.01256 seconds