FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to print character sigma in Haru?
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 05:22 AM
After defining font in Haru
Code (fw): Select all Collapse
oFont := oPrn:DefineFont("Symbol", 9)
How to print the sigma symbol?

I was printing it this way in TPrinter
Code (fw): Select all Collapse
oPrn:say(nRow, nCol, "S", oFont)
But this doesn't work under Haru

I am not using unicode.

Actually, how to inspect the attributes of a font used in Haru e.g. typeface name, bold or not, etc
TIA
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 10:44 AM
Tested using SAMPLES\pdfh.prg
The font Symbol is not loaded eventhough it should be amongst the Base14



FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 10:58 AM
This is working for me
Code (fw): Select all Collapse
function printSigma

   local oPrn, oFont, nRow := 1

   FW_SetUnicode( .t. )

   TPrinter():lUseHaruPDF := .t.

   PRINT oPrn PREVIEW file "sigma.pdf"
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-30 OF oPrn
   PAGE
   @ nRow,1 PRINT TO oPrn TEXT "Print Sigma separately" SIZE 5,0.5 INCHES ;
      FONT oFont LASTROW nRow
   @ nRow,1 PRINT TO oPrn TEXT hb_utf8chr( 0x03a3 ) SIZE 5,0.5 INCHES ;
      FONT oFont LASTROW nRow
   @ nRow,1 PRINT TO oPrn TEXT "Like This" SIZE 5,1 INCHES ;
      FONT oFont
   ENDPAGE
   ENDPRINT
   RELEASE FONT oFont

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 11:07 AM

Sumbol font is not working with Haru.

Without Haru, using the default PDF generation of TPrinter, we can have the Symbol fonts in pdf.

Let us keep trying.

Regards



G. N. Rao.

Hyderabad, India
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 02:00 PM
Have you tried this way?
Code (fw): Select all Collapse
     TPrinter():lUseHaruPDF  := .T.

      GetHaruFontList( , .F. )
      // For use fonts not installed
      HaruAddFont( 'Arial Black', '.\ariblk.ttf', , .F. )
      HaruAddFont( 'EAN-13', '.\EAN13_0.ttf', .T., .F. )

      oPrn := THaruPDF():New()
      oFontTitle  := oPrn:DefineFont( 'Arial Black', 15 )
      oFontBold   := oPrn:DefineFont( 'Arial Black',  9 )
      oFontText   := oPrn:DefineFont( 'Verdana', 8 )
      oFontText1  := oPrn:DefineFont( 'Arial', 8 )
      oFontBar    := oPrn:DefineFont( 'EAN-13', 20, .T. )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 05:32 PM
Mr. Cristobal

So, are you able to print Σ ?
If so, by using which font and which character please?
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 07:45 PM

PDF's internal Symbol font is different from Windows Symbol font.

We are working on how to make our FWPDF class to use Windows Symbol font, though it seems difficult as of now.

For now, the immediate solution is to use HB_UTF8CHR(0x03A3) and setting FW_SetUnicode() to .T., atleast temporarily.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to print character sigma in Haru?
Posted: Wed Aug 16, 2023 08:12 PM
Some notes for information:
FWH does not provide THaruPDF class.
Instead we have FWPDF class derived from TPDF class.

PDF internal font list:
Code (fw): Select all Collapse
Courier
Courier-Bold
Courier-Oblique
Courier-BoldOblique
Helvetica
Helvetica-Bold
Helvetica-Oblique
Helvetica-BoldOblique
Times-Roman
Times-Bold
Times-Italic
Times-BoldItalic
Symbol
ZapfDingbats
Instead of GetHaruFontList(..) you may use
oPdf:aTTFFontList
Initially, FWPdf is loaded with this list
Code (fw): Select all Collapse
+-----------+----------------------------+
|Arial      |C:\WINDOWS\Fonts\arial.ttf  |
|Verdana    |C:\WINDOWS\Fonts\verdana.ttf|
|Courier New|C:\WINDOWS\Fonts\cour.ttf   |
|Calibri    |C:\WINDOWS\Fonts\calibri.ttf|
|Tahoma     |C:\WINDOWS\Fonts\tahoma.ttf |
|Impact     |C:\WINDOWS\Fonts\impact.ttf |
|Segoe UI   |C:\WINDOWS\Fonts\segoeui.ttf|
+-----------+----------------------------+
Instead of HaruAddFont()
we can use oPdf:AddFont( cFontname, cTtfFileName )

We have not added EAN font in the default list, because this font is not installed on all computers bu default and we prefer to generate bar codes on our own than using barcode fonts.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: How to print character sigma in Haru?
Posted: Thu Aug 17, 2023 03:50 AM
nageswaragunupudi wrote: For now, the immediate solution is to use HB_UTF8CHR(0x03A3) and setting FW_SetUnicode() to .T., atleast temporarily.
Thanks Rao, for the time being I adopted this workaround
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion