About defining fonts

About defining fonts

Postby Massimo Linossi » Sun Feb 18, 2018 7:55 am

Hi to all.
I'm rewriting some functions of a big procedure and I'm trying to optimize some parts of it.
I have a procedure that launch another one that make a big use of several fonts and opening and closing
them for 70000 times sometimes gives memory problems.
That second procedure defines nearly 50 fonts, than prints some pages and than closes the print process.
The printer is PdfCreator that when the print process is closed creates a PDF on a certain folder.
The problem is that every time the second procedure is called, at the beginning defines all the fonts,
and before the return to the main procedure ends all the fonts.
I wish the define all the fonts in the main procedure, but they they can't be connected to the printer with the OF Oprn
because the printer is not yet used. And i can't define the open in the main procedure because if I make this I can't
make a PDF of every print process closing.
Have you some ideas on how to make something like this ?
Thanks a lot
Massimo
User avatar
Massimo Linossi
 
Posts: 500
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: About defining fonts

Postby nageswaragunupudi » Sun Feb 18, 2018 8:20 am

Code: Select all  Expand view  RUN
// Your Print Module

static aFont

//----------------------------------------------------------------------------//

function YourPrintFunction

   local oPrn
   
   PRINT oPrn
   
   if aFont == nil
      DEFINE FONT .... OF oPrn
      DEFINE FONT .... OF oPrn
   endif
   
   //
   // Printing routine
   //
   
   ENDPRINT
   
return nil

function ReleasePrinterFonts()

   if aFont != nil
      AEval( aFont, { |o| o:End() } )
      aFont := nil
   endif
   
return nik

END PROCEDURE printFuncsEnd

   ReleasePrinterFonts()
   
return

//----------------------------------------------------------------------------//
 


In the main program, after you close the main window call
Code: Select all  Expand view  RUN

ReleasePrinterFonts()
 
Regards

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

Re: About defining fonts

Postby Massimo Linossi » Sun Feb 18, 2018 8:28 am

Hi Nages.
YourPrintFuncion is called by a previous procedure, that is in another PRG that can't see the aFont array.
User avatar
Massimo Linossi
 
Posts: 500
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 55 guests