Recent

Author Topic: problem with TsFont in fpspread  (Read 2859 times)

kjteng

  • Sr. Member
  • ****
  • Posts: 259
problem with TsFont in fpspread
« on: May 26, 2018, 11:57:12 am »
I noticed that the the size property of tsFont is of 'single' type where  normal tfont size is of integer type.  Is there any different  between the tsfont.size and tfont.size ?

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: problem with TsFont in fpspread
« Reply #1 on: May 26, 2018, 12:33:52 pm »
I think this came in in the early days of fpspreadsheet when visual controls did not exist yet. The font in xls files, is stored in units of "twips", i.e. 1/20 point, which makes the font size more accurate than an integer. Avoiding this strange definition it was decided to store the font size as single.

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: problem with TsFont in fpspread
« Reply #2 on: May 27, 2018, 04:06:41 am »
So if I assign tfont1.Size := round(tsfont1.size), the font size would be quite the same. I mean no special conversion required ?

Thaddy

  • Hero Member
  • *****
  • Posts: 14364
  • Sensorship about opinions does not belong here.
Re: problem with TsFont in fpspread
« Reply #3 on: May 27, 2018, 09:54:34 am »
Well there are 20 twips in a point and 72 points in an inch. The ratio is that as such a font can be used with high precision on multiple devices including printers.
They are real world absolute measurements, not pixels. To convert to pixels you need to know screen size and resolution. On Windows that requires a call to GetDeviceCaps.

Because of this, I would not change it at all.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: problem with TsFont in fpspread
« Reply #4 on: May 27, 2018, 10:13:34 am »
So if I assign tfont1.Size := round(tsfont1.size), the font size would be quite the same. I mean no special conversion required ?
Correct. But in the WorksheetGrid, the ZoomFactor of the worksheet may be active, then the "real" canvas font size is multiplied by this factor.

kjteng

  • Sr. Member
  • ****
  • Posts: 259
Re: problem with TsFont in fpspread
« Reply #5 on: May 27, 2018, 10:51:22 am »
TQ

 

TinyPortal © 2005-2018