TFPFontCacheItem.TextWidth() reports wrong value for (some?) monospace fonts
Original Reporter info from Mantis: joellinn
-
Reporter name: joellinn
Original Reporter info from Mantis: joellinn
- Reporter name: joellinn
Description:
Size calculation is broken for monospace fonts like 'UbuntuMono-Regular' or 'CourierNewPSMT'.
For example ('UbuntuMono-Regular', fontsize=10):
'w' = 437.35
'e' = 0.00
Steps to reproduce:
const
pt = 10.0;
var
s: string;
w1, w2: single;
begin
s := THETEXT;
with gTTFontCache.Find('Ubuntu') do begin
w1 := TextWidth(s, pt);
end;
with gTTFontCache.Find('UbuntuMono-Regular') do begin
w2 := TextWidth(s, pt);
end;
WriteLn(Format('%f %f', [w1, w2]));
Mantis conversion info:
- Mantis ID: 38354
- Platform: All
- Fixed in version: 3.3.1
- Fixed in revision: 48694 (#54a48183)
- Target version: 3.2.2