How to print character sigma in Haru?

How to print character sigma in Haru?

Postby hua » Wed Aug 16, 2023 5:22 am

After defining font in Haru
Code: Select all  Expand view
oFont := oPrn:DefineFont("Symbol", 9)

How to print the sigma symbol? Image

I was printing it this way in TPrinter
Code: Select all  Expand view
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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to print character sigma in Haru?

Postby hua » 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

Image

Image
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to print character sigma in Haru?

Postby nageswaragunupudi » Wed Aug 16, 2023 10:58 am

This is working for me
Code: Select all  Expand view
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


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to print character sigma in Haru?

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to print character sigma in Haru?

Postby cnavarro » Wed Aug 16, 2023 2:00 pm

Have you tried this way?
Code: Select all  Expand view

     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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: How to print character sigma in Haru?

Postby nageswaragunupudi » Wed Aug 16, 2023 5: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to print character sigma in Haru?

Postby nageswaragunupudi » Wed Aug 16, 2023 7: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to print character sigma in Haru?

Postby nageswaragunupudi » Wed Aug 16, 2023 8: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: Select all  Expand view

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: Select all  Expand view

+-----------+----------------------------+
|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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to print character sigma in Haru?

Postby hua » Thu Aug 17, 2023 3: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
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 45 guests