James Bott wrote:oFont:nWidth:= oFont:nWidth * (80/132)
#include "FiveWin.ch"
FUNCTION MAIN()
LOCAL oPrn, oFnt, oFnt2
LOCAL nHStep, nVStep
PRINT oPrn PREVIEW
DEFINE FONT oFnt NAME "Arial" SIZE 0, -10 OF oPrn
DEFINE FONT oFnt2 NAME "Arial" SIZE 0, -10 OF oPrn
oFnt2:nWidth = oFnt2:nWidth * 100
nHStep = oPrn:nHorzRes() / 80
nVStep = oPrn:nVertRes() / 66
PAGE
oPrn:Say( 0, 0, "This is a test", oFnt )
oPrn:Say( 1 * nVStep, 0, "This is a test", oFnt2 )
ENDPAGE
ENDPRINT
RELEASE FONT oFnt
RELEASE FONT oFnt2
RETURN NIL
#include "fivewin.ch"
#include "report.ch"
function main()
local oReport, oFont
field last, first
use test
DEFINE FONT oFont NAME "ARIAL" SIZE 0,-12
// oFont:nWidth:= oFont:nWidth * (80/132) // simulate compressed font
oFont:nWidth:= oFont:nWidth * 3
REPORT oReport;
TITLE "Font Width Test";
font oFont;
preview
column title "Last" data last
end report
activate report oReport
return nil
#include "FiveWin.ch"
FUNCTION MAIN()
LOCAL oPrn, oFnt
PRINT oPrn PREVIEW
oFnt := GetDosFnt(oPrn, 12)
PAGE
oPrn:Say( 0, 0, "This is a test", oFnt )
ENDPAGE
ENDPRINT
RELEASE FONT oFnt
RETURN NIL
//---------------------------------------------------------------------------------------
function GetDosFnt(oDev, nCPI, lBold)
// experimental function to mimic cpi
local oFont, nWid, nHgt, oBaseFont
local nLogPixX := oDev:nLogPixelX()
local nLogPixY := oDev:nLogPixelY()
default lBold := .f.
define font oBaseFont name "Courier New" size 0,-12
nHgt := oBaseFont:nHeight
if nCPI==10
nWid := oBaseFont:nWidth*(1.3)
elseif nCPI==12
nWid := oBaseFont:nWidth*(1.136)
elseif nCPI==15
nWid := oBaseFont:nWidth*(0.953)
elseif nCPI==20
nWid := oBaseFont:nWidth*(0.8)
endif
oFont := TFont():New(oBaseFont:cFaceName ,;
Int(nWid*nLogPixX/72) ,;
Int(nHgt*nLogPixY/72) ,;
.F. ,;
lBold ,;
oBaseFont:nEscapement ,;
oBaseFont:nOrientation ,;
oBaseFont:nWeight ,;
oBaseFont:lItalic ,;
oBaseFont:lUnderline ,;
oBaseFont:lStrikeOut ,;
oBaseFont:nCharSet ,;
oBaseFont:nOutPrecision ,;
oBaseFont:nClipPrecision ,;
oBaseFont:nQuality)
oBaseFont:end()
return oFont
//----------------------------------------------------------------------------
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 89 guests