FONT Object +
Updated: Sep 8, 2009

The Font Object is a non-visible component used to select fonts based on
properties and to obtain their handles.

Then a Font handle may be assigned to the .Font property of visible Form
objects to set the Font used to display text.

hotwin.bas and an example below may clarify usage.

Font properties are read/write variables.  When a Font handle is used as a
source variable -- e.g., MyLabel.Font = MyFont.Handle -- the font properties
set in source code are examined by the system and a font available on the
system which most closely matches those properties is selected.

Once the system has selected a font for a particular Font object, it may be
of interest to read the properties of the font selected.

Font properties are presented in the win32.hlp description of the LOGFONT
structure.

The .Name property is a string and the other properties are integers.
Default values are zero or null, except .Weight = 400 and .CharSet = 1.


PROPERTIES (Read/Write):
~~~~~~~~~~ ~~~~~~~~~~~~~
CharSet    Character Set.  Default = 1 (DEFAULT_CHARSET)

ClipPrecision
           Clip precision determines display of characters at border
           of object rectangle

Escapement Angle in tenths of degrees between escapement vector and the x-axis

Height     Height in logical units (not same as point size)

Italic     Italic if = 1

Name       String descriptor of font

Orientation
           Angle in tenths of degrees between character baseline and the x-axis

OutPrecision
           Output precision guides system selection of font

PitchAndFamily
           Two low-order bits = 0 (default), 1 (fixed) or 2 (variable)
           Bits 4 - 7 specify family

Quality    How carefully logical and physical fonts are matched

StrikeOut  StrikeOut if = 1

UnderLine  UnderLine if = 1

Weight     Weight (0 to 1000)  Default = 400  Bold = 700

Width      Average width in logical units


PROPERTIES (Read Only Numeric):
~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
Handle     Handle of physical font selected by the system


hbFont
~~~~~~
hbFont is an internal variable which must hold a valid font handle, which you
can easily change at any time to determine the "default" font that will be used
in subsequent CREATE/DIM of GUI objects.  This demo program shows usage:

=====def_font.bas
$APPTYPE GUI: $TYPECHECK ON

Dim font0 as font
font0.name="Fixedsys"
'set our hbFont handle
hbFont=font0
'now all below will use *our font*

create f As FORM
  create b1 as BUTTON
    left=0: top=0
    width=100: height=20
    caption="My Text"
  end create
  create b2 as BUTTON
    left=0: top=20
    width=100: height=20
    caption="My Text"
  end create
end create
f.showmodal
END
=====def_font.bas


+ Penthouse (registered) version

Copyright 2003-2009 James J Keene PhD
Original Publication: Nov 24, 2003
