diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-30 09:14:37 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-30 09:14:37 +0200 |
commit | a8de93f8686702933db0cf11d0331d4beea3a043 (patch) | |
tree | bb1fab2250139bc28657fa92046bc8eac611c71c /src | |
parent | 589a72ebf95a4a08b918df42b5c096fb301b9646 (diff) | |
download | fpGUI-a8de93f8686702933db0cf11d0331d4beea3a043.tar.xz |
IsFixedWidth fallback implementation for TfpgFont
Signed-off-by: Graeme Geldenhuys <graeme@mastermaths.co.za>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/fpg_base.pas | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 020f9943..52a83050 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -227,6 +227,7 @@ type protected FFontDesc: string; FFontRes: TfpgFontResourceBase; + function GetIsFixedWidth: boolean; virtual; public function TextWidth(const txt: string): integer; function Ascent: integer; @@ -235,6 +236,7 @@ type property FontDesc: string read FFontDesc; property FontRes: TfpgFontResourceBase read FFontRes; property Handle: TfpgFontResourceBase read FFontRes; + property IsFixedWidth: boolean read GetIsFixedWidth; end; @@ -1616,6 +1618,17 @@ end; { TfpgFontBase } +function TfpgFontBase.GetIsFixedWidth: boolean; +begin + // very crude but handy as a fallback option + if (Pos('mono', Lowercase(FFontDesc)) > 0) or + (Pos('courier', Lowercase(FFontDesc)) > 0) or + (Pos('fixed', Lowercase(FFontDesc)) > 0) then + Result := True + else + Result := False; +end; + function TfpgFontBase.TextWidth(const txt: string): integer; begin if Length(txt) = 0 then |