Hallo Uli,
tut mir leid, aber ich ändere zwischendurch immer mal wieder die Schriftarten bzw. -größen - und bei mir stimmt es!
Was ich jedoch anders mache:
Code: Alles auswählen
if pPS <> NIL
pPS:device():startDoc( ConvToAnsiCP( "EASYDOG: Urkunde" ) )
if oFont2 == NIL
oFontDlg := XbpFontDialog():New( fensterhandle, fensterhandle, , pPS )
oFontDlg:familyName := "Times New Roman"
oFontDlg:Create() // Font-Dialog erzeugen
oFont2 := oFontDlg:display()
else
compname := oFont2:compoundName
nomsize := oFont2:nominalPointSize
oFont2:destroy()
oFont2 := XbpFont():New( pPS )
oFont2:create( alltrim( str( nomsize ) ) + "." + compname) // Font erzeugen
if oFont2 <> NIL
attr := array( GRA_AS_COUNT )
select 1
do while recno() <= hhun
if xurkunde->hundename
oFont2:height := xurkunde->hundeschrg * 5
oFont2:width := xurkunde->hundeschrg * 2
oFont2:bold := ( "f" $ xurkunde->hundeschrs )
if "f" $ xurkunde->hundeschrs
oFont2:weightClass := XBPFONT_WEIGHT_BOLD
else
oFont2:weightClass := XBPFONT_WEIGHT_NORMAL
endif
oFont2:italic := ( "k" $ xurkunde->hundeschrs )
oFont2:configure() // Font erzeugen
GraSetFont( pPS, oFont2 )
attr[GRA_AS_HORIZALIGN] := xurkunde->hundeschra
GraSetAttrString( pPS, attr )
links := Max( 0, ( 100 * xurkunde->hundelinks ) - lrand )
unten := Max( 0, ( 100 * xurkunde->hundeunten ) - urand )
text := alltrim( hundenamen ) + " "
textteil1 := textteil2 := textteil3 := ""
if xurkunde->hundeschra == GRA_HALIGN_LEFT
if ( xurkunde->hundezeile > 1 )
if 100 * ( xurkunde->hundeende - 5 ) > links
laenge := ( 100 * xurkunde->hundeende ) - links
aTextBox := GraQueryTextBox( pPS, text )
nFontWidth := aTextBox[ 3, 1 ] - aTextBox[ 2, 1 ]
if nFontWidth > laenge
a := 0
do while .t.
b := at( " ", text, a + 1 )
if b > 0
textteil1 := left( text, b - 1 )
aTextBox := GraQueryTextBox( pPS, textteil1 )
nFontWidth := aTextBox[ 3, 1 ] - aTextBox[ 2, 1 ]
if nFontWidth > laenge
if a <> 0
textteil1 := left( text, a - 1 )
text := substr( text, a + 1 )
exit
endif
else
a := b
endif
elseif a <> 0
textteil1 := left( text, a - 1 )
text := substr( text, a + 1 )
exit
endif
enddo
if ( xurkunde->hundezeile > 2 ) .and. .not. empty( text )
aTextBox := GraQueryTextBox( pPS, text )
nFontWidth := aTextBox[ 3, 1 ] - aTextBox[ 2, 1 ]
if nFontWidth <= laenge
textteil2 := text
else
a := 0
do while .t.
b := at( " ", text, a + 1 )
if b > 0
textteil2 := left( text, b - 1 )
aTextBox := GraQueryTextBox( pPS, textteil2 )
nFontWidth := aTextBox[ 3, 1 ] - aTextBox[ 2, 1 ]
if nFontWidth > laenge
if a <> 0
textteil2 := left( text, a - 1 )
textteil3 := substr( text, a + 1 )
exit
endif
else
a := b
endif
elseif a <> 0
textteil2 := left( text, a - 1 )
textteil3 := substr( text, a + 1 )
exit
endif
enddo
endif
else
textteil2 := text
endif
else
textteil1 := text
endif
if .not. empty( textteil3 )
GraStringAt( pPS, { links, unten + ( xurkunde->hundeschrg * 11 ) }, textteil1 )
GraStringAt( pPS, { links, unten + ( xurkunde->hundeschrg * 5.5 ) }, textteil2 )
GraStringAt( pPS, { links, unten }, textteil3 )
elseif .not. empty( textteil2 )
GraStringAt( pPS, { links, unten + ( xurkunde->hundeschrg * 5.5 ) }, textteil1 )
GraStringAt( pPS, { links, unten }, textteil2 )
else
GraStringAt( pPS, { links, unten }, textteil1 )
endif
else
GraStringAt( pPS, { links, unten }, text )
endif
else
GraStringAt( pPS, { links, unten }, text )
endif
else
GraStringAt( pPS, { links, unten }, text )
endif
endif
...
Es ist zwar jedesmal die selbe Schrift, aber die Größe kann unterschiedlich sein und das berechnen/positionieren klappt.
Viele Grüße,
Martin