diff options
Diffstat (limited to 'docview/components')
-rw-r--r-- | docview/components/richtext/CanvasFontManager.pas | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/docview/components/richtext/CanvasFontManager.pas b/docview/components/richtext/CanvasFontManager.pas index 53fd1d34..c182ba91 100644 --- a/docview/components/richtext/CanvasFontManager.pas +++ b/docview/components/richtext/CanvasFontManager.pas @@ -1011,12 +1011,16 @@ begin end; function TCanvasFontManager.CharWidth( const C: Char ): longint; +var + f: TfpgFont; begin - EnsureMetricsLoaded; - Result := FCurrentFont.pCharWidthArray^[ C ]; - { TODO -ograemeg -chard-coded result : This is a temporary hard-code } -// result := fpgApplication.DefaultFont.TextWidth(C); - Result := FCurrentFont.lAveCharWidth; +// EnsureMetricsLoaded; +// Result := FCurrentFont.pCharWidthArray^[ C ]; + + { TODO -ograeme : This needs improvement: what about font attributes, and performance. } + f := fpgGetFont(FCurrentFont.FaceName + '-' + IntToStr(FCurrentFont.PointSize)); + Result := f.TextWidth(C); + f.Free; end; function TCanvasFontManager.AverageCharWidth: longint; |