Mattias Gaertner ha scritto:
On Sun, 04 Nov 2007 18:29:40 +0100
Giuliano Colla <[EMAIL PROTECTED]> wrote:

[...]
There's a Font property, Pitch, which is intended exactly for this
purpose. Its possible values are fpdefault (i.e. use the font pitch
as defined in the font itself), fpfixed (i.e. force the font to be
monospace even if it isn't), and fpvariable (i.e. force the font to
be variable even if it isn't). According Delphi manual this property
(together with the other properties) is used to find the best match
and the best setting among the available fonts.

Fractionals are needed only for correctly scaled texts.
For example if you scale text by 0.6 then the total text width should
be 0.6 times the original width. When rounding the character widths, you
don't get the 0.6 total width. When rounding each character position,
then you get the 0.6 total width, but the characters can be spaced 2
pixels as seen in the Tobias' screenshot.

fpFixed means every character has the same width. A 'm' is the same as
'i'.
fpVariable means every character can have a different width.

Fractionals can be applied to both. So it is not sufficient to add a
fpFractional.

Conclusion:
fractionals are not yet supported by the Delphi/LCL TFont, but
gladfully only few programs really need it. Most programs live happily
with rounding.
If we add support for fractionals to the LCL canvas then the
fpFixed/fpVariable will still be valid.
So, there is nothing to be horrified of Delphi incompatibility.

At the moment I still think it is a carbon intf problem and should be
fixed there. We don't need to support fractionals yet in the LCL.

What I gathered from the discussion is that SynEdit, and other custom controls rely on width(char) x number of chars in string = width(string). Therefore they can only work with fpFixed. If such is the case then Font Pitch should be properly set, so that an appropriate font can be selected/adapted from the font engine of the widgetset. If the widgetset interface does it wrong, it is a widgetset interface problem. But if widgetset iterface isn't properly told what to do, then that's an LCL problem.

Font size can only be given in either an integer number of pixels, or in Point Size, which (currently) gets rounded to an integer number of pixels, and therefore, given usual font metrics, fpFixed should never give rise to a fractional width.

Giuliano

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to