diff options
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 |