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

> Mattias Gaertner ha scritto:
> > On Sun, 04 Nov 2007 15:15:41 +0100
> > Tobias Giesen <[EMAIL PROTECTED]> wrote:
> >
> >   
> >> Hello,
> >>
> >> if we add the property to TCarbonDeviceContext, is that accessible
> >> from a custom component in a reasonable way? Would Phil be willing
> >> to change a property in TCarbonDeviceContext using the appropriate
> >> typecasts?
> >>
> >> Fractional positioning should never be turned off globally for the 
> >> application, since I am sure Phil's applications will use TLabels
> >> too. So the property must be in each canvas or DC.
> >>     
> >
> > You can add for example
> >
> > function SetFontFractionalPositioning(DC: HDC;
> >   UseFractionalPositioning: boolean): boolean;
> > to carboncanvas.pp
> >
> > Then you can use
> >
> > {$IFDEF LCLcarbon}
> > uses carboncanvas;
> > {$ENDIF}
> >
> > function SetFontFractionalPositioning(DC: HDC;
> >   UseFractionalPositioning: boolean): boolean;
> > begin
> >   {$IFDEF LCLcarbon}
> >   Result:=carboncanvas....
> >   {$ELSE}
> >   Result:=true;
> >   {$ENDIF}
> > end;
> >
> >
> >   
> I followed this discussion, and I must confess that I'm a bit
> horrified.
> 
> 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.
> 
> If Lazarus is supposed to be Delphi compatible, or at least decently 
> self consistent, the only reasonable thing to do is just to use this 
> property (maybe adding a further value fpFractional, but I don't
> believe it necessary from what I read up to now), and let the
> components with special needs (or the users with special needs), to
> force the Pitch of the font according their needs.
> 
> If basic component properties are unused and/or overridden here and 
> there, the usability of Lazarus for anything other than academic 
> exercise becomes highly questionable.

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.


Mattias

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

Reply via email to