Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-05

TFont.size

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

Does anyone the difference between TFont.Height and TFont.Size?

It seams to me that Height is measured in pixels and Size is some other unit which I don't know. Even worse, it doesn't seam to be an international system unit, but rather an american unit (some fraction of inches).

The Delphi docs say:

"Use Size to specify the point size of the font. If the value is negative, the internal leading that appears at the top of each line of text is included. If the value is positive, Size represents the height of the characters but not the internal leading.

To determine the size of the font in pixels, use the Height property instead. The value of Size can be obtained from the height in pixels using this formula:

Copy Code
Font.Size = -Font.Height * 72 / Font.PixelsPerInch When the Size property has a positive value, the Height property has a negative value. When the Height property has a positive value, the Size property has a negative value. "

A rather exoteric property IMHO. Or yet another Windowsism in Delphi

Felipe Monteiro de Carvalho

Reply by email

Howard Page-Clark
to Felipe Monteiro de Carvalho
Show quoted text 6 lines
Hello, Does anyone the difference between TFont.Height and TFont.Size? ... A rather exoteric property IMHO. Or yet another Windowsism in Delphi

Not so much a Windowsism as baggage from the days before screens when 'printing' was never to a screen but only a process that transferred ink from hand set lead typeface to paper. Traditionally type sizes were measured in printer points, defined as 1/72 inch as measured by the "EM" square of the font. The "EM" square is the size of the lead block that would enclose a capital letter M (the block is fractionally bigger than the actual printed size of the M).

The two different properties Delphi provides to set the size of a font relate to the two possible expressions of the font: printing to paper and 'printing' to the screen.

If you specify the font's size using the Font.Size property, the font is scaled to match the size you specify in printer points.

If you specify the font's size using the Font.Height property, the font is scaled in pixels. If you specify the Height as a positive value, the font's external leading is included in the calculation. If you specify a negative value, the font's external leading is not included in the calculation. (Traditionally leading, pronounced like the metal lead, means the line spacing, dating from the time when thin strips of lead were placed between lines of type to increase the space between lines).

Howard

Reply by email

Jesus Reyes
to Felipe Monteiro de Carvalho: Does anyone the difference between TFont.Height and TFont.Size? It seams to me that…

--- El vie 1-may-09, Felipe Monteiro de Carvalho escribi?:

Show quoted text 7 lines
It seams to me that Height is measured in pixels and Size is some other unit which I don't know. Even worse, it doesn't seam to be an international system unit, but rather an american unit (some fraction of inches).

Points, where 1 Point = 1/72 inch.

Why using points instead of just pixels?, it's convenient because you can forget about resolution, for example one might want to show some text on screen, maybe 20 pixels height would look nice for a big title, but that is so because screen resolution is perhaps 96 pixels per inch, but what happen when the text is printed on a 1200 dpi printer? it will probably do not stand out, so without points one would need a way to specify pixel heights for several resolutions. So a good property of points is that they are independent of resolution.

Jesus Reyes A.

?Obt?n la mejor experiencia en la web! Descarga gratis el nuevo Internet Explorer 8. http://downloads.yahoo.com/ieak8/?l=mx

Reply by email

zeljko
to Felipe Monteiro de Carvalho: Does anyone the difference between TFont.Height and TFont.Size? It seams to me that…
Felipe Monteiro de Carvalho wrote 27 lines
Hello, Does anyone the difference between TFont.Height and TFont.Size? It seams to me that Height is measured in pixels and Size is some other unit which I don't know. Even worse, it doesn't seam to be an international system unit, but rather an american unit (some fraction of inches). The Delphi docs say: "Use Size to specify the point size of the font. If the value is negative, the internal leading that appears at the top of each line of text is included. If the value is positive, Size represents the height of the characters but not the internal leading. To determine the size of the font in pixels, use the Height property instead. The value of Size can be obtained from the height in pixels using this formula: Copy Code Font.Size = -Font.Height * 72 / Font.PixelsPerInch When the Size property has a positive value, the Height property has a negative value. When the Height property has a positive value, the Size property has a negative value. " A rather exoteric property IMHO. Or yet another Windowsism in Delphi

No, it's not Windowsism, qt have the same thing on all platforms.

Reply by email