How to print character sigma in Haru?

Post Reply
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

How to print character sigma in Haru?

Post by hua »

After defining font in Haru

Code: Select all | Expand

oFont := oPrn:DefineFont("Symbol", 9)
How to print the sigma symbol? Image

I was printing it this way in TPrinter

Code: Select all | Expand

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?

Post by hua »

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

Re: How to print character sigma in Haru?

Post by nageswaragunupudi »

This is working for me

Code: Select all | Expand

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: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to print character sigma in Haru?

Post by nageswaragunupudi »

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

Re: How to print character sigma in Haru?

Post by cnavarro »

Have you tried this way?

Code: Select all | Expand

     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
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to print character sigma in Haru?

Post by nageswaragunupudi »

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: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to print character sigma in Haru?

Post by nageswaragunupudi »

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: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: How to print character sigma in Haru?

Post by nageswaragunupudi »

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

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

+-----------+----------------------------+
|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
hua
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to print character sigma in Haru?

Post by hua »

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
Post Reply