Page 1 of 1

Printing Barcode

Posted: Thu Aug 17, 2017 12:06 pm
by omni
Roger,

A user changed servers and now his barcodes do not print. Printed yesterday. and I cannot remember how to set it up.

The code is as follows.

@ln+1,62 dcprint say bPronum FONT '30.Free 3 of 9 Extended'

I thought they needed the fre30f9x.tff file, but if I delete that out of my folder here the barcode still prints, to its apparenly something else.
He also says that file was not in his folder on old server.

My memory is swiss cheese

Any help is appreciated.

Fred
Omni

Re: Printing Barcode

Posted: Thu Aug 17, 2017 12:18 pm
by Wolfgang Ciriack
You have to copy the ttf file in the windows font folder.

Re: Printing Barcode

Posted: Thu Aug 17, 2017 12:36 pm
by omni
I told him that also...will get him to retry that.

Re: Printing Barcode

Posted: Thu Aug 17, 2017 3:05 pm
by Cliff Wiernik
Plus you often have to make certain it is installed there. This registers it. You can access the fonts information inside something like word that will also make certain it is registered as sometimes I have seen just copying not be sufficient.

Cliff

Re: Printing Barcode

Posted: Sun Aug 20, 2017 3:41 am
by c-tec
Hello,
maybe this can help
regards
Rudolf

Code: Select all

function installfont(cFont,lSilent)
******************************************************************
local cFontFile,lUpdate := .f. ,cRet
local cWinFontfile
default lSilent to .f.
if !".ttf" $ cFont
     cFont += ".ttf"
endif
cFontFile    := addpath(al_path,"\fonts\" + cFont)              // font in program folder
cWinFontfile := addpath(getenv("SystemRoot"),"fonts\" + cFont)  // font in Windows font folder

if !fexists(cFontFile) .and. !lSilent
     toastmsg("Font " + cFOntFIle + " not found !")
     return .f.
endif
if !comparefiles(cFontFile,cWinFontfile)
     filecopy(cFontFile,cWinFontfile)
     lUpdate := .t.
endif
cReg := dc_regquery(,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts",cFont + " Plain (TrueType)")
if empty(cReg) .and. fexists(cWinFontfile)
     dc_regwrite(,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts",cFont + " Plain (TrueType)",cFont)
     lUpdate := .t.
endif
cReg := dc_regquery(,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts",cFont + " Plain (TrueType)")
if lUpdate
     DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", cFont )
endif
return !empty(cReg) .and. fexists(cWinFontfile)

Re: Printing Barcode

Posted: Wed Aug 23, 2017 12:02 am
by skiman
Hi,

The easiest way is to instal the font every time at startup. This is very fast, and I do it in a separate thread at startup of my application.

I install all the fonts I need. Since I added this to my application, I never had any problem with 'missing' fonts after one of my customers had a new pc.

Code: Select all

function installfonts()
*************************
Local aList := directory(".\fonts\*.ttf")
Local i , cFont , cPath:=amain(5,2) 
for i := 1 to len(aList)
	cFont := cPath+'\fonts\'+aList[i][F_NAME]
	DllCall("GDI32.DLL", DLL_STDCALL, "AddFontResourceA", cFont )
next
return nil