-1

I use this method to convert TFont.Pitch into an Integer value:

var
  ThisPitch: Integer;

case Font.Pitch of
    TFontPitch.fpDefault:  ThisPitch := 0;
    TFontPitch.fpVariable: ThisPitch := 1;
    TFontPitch.fpFixed:    ThisPitch := 2;
end;

Is there a simpler method to convert TFont.Pitch into an Integer value?

user1580348
  • 5,721
  • 4
  • 43
  • 105

1 Answers1

1

The TFontPitch enum values have the same numeric values that you are converting to, so a simple Ord() conversion will suffice:

var
  ThisPitch: Integer;

ThisPitch := Ord(Font.Pitch);
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770