|
of_updatefontsize
|
|
Full name
|
pfc_w_message.of_updatefontsize
|
Access
|
protected
|
Override of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_updatefontsize()
|
Name
|
Datatype
|
lb_bold
|
boolean
|
li_FontSize
|
Integer
|
li_Height
|
Integer
|
li_rc
|
Integer
|
li_Width
|
Integer
|
lnv_Platform
|
n_cst_platform
|
ls_FontFace
|
String
|
lw_this
|
window
|
protected function integer of_updatefontsize ();//////////////////////////////////////////////////////////////////////////////
//
// Function: of_UpdateFontSize
//
// Access: protected
//
// Arguments: (none)
//
// Returns: integer
// 1 if it succeeds and -1 if it fails.
//
// Description: Handle multiple font sizes.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0.02 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
Integer li_rc=1
Integer li_Height
Integer li_Width
Integer li_FontSize
String ls_FontFace
boolean lb_bold
window lw_this
n_cst_platform lnv_Platform
// Create the Platform-Specific Functions Service.
If f_SetPlatform(lnv_Platform, True) < 0 Then Return -1
// Get information required to determine the character size.
lw_this = this
lb_bold = (mle_message.Weight = 700)
li_FontSize = Abs(mle_message.TextSize)
ls_FontFace = mle_message.FaceName
// Get the font size and handle multiple font sizes.
If lnv_Platform.of_gettextsize(lw_this, "X", ls_FontFace, &
li_FontSize, lb_bold, mle_message.Italic, &
mle_message.Underline, li_height, li_width) > 0 Then
// If appropriate, update the character width value.
If li_width >= 14 Then
ii_charwidth *= 2.1
ElseIf li_width >= 13 Then
ii_charwidth *= 1.7
ElseIf li_width >= 11 Then
ii_charwidth *= 1.3
ElseIf li_width >= 10 Then
ii_charwidth *= 1.1
End If
// If appropriate, update the line length value.
If li_height >= 25 Then
ii_lineheight *= 1.9
ElseIf li_height >= 22 Then
ii_lineheight *= 1.7
ElseIf li_height >= 20 Then
ii_lineheight *= 1.3
ElseIf li_height >= 16 Then
ii_lineheight *= 1.1
End If
Else
// Set up an Error return value.
li_rc = -1
End If
// Destroy the Platform-Specific Functions Service.
If f_SetPlatform(lnv_Platform, False) < 0 Then Return -1
Return li_rc
end function