[fpc-devel] Unicodestring branch, please test and help fixing

Paul Ishenin ip at kmiac.ru
Thu Sep 11 10:39:42 CEST 2008


Anton Kavalenka wrote:

>> How would an OOP approach solve this? The problem isn't the tracking of
>> things like encoding or directions but handling all these information.
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>>
>>   
> procedure TLabel.Paint(...)
> begin
>   if *Caption.IsRTL *then
>     DrawCaptionRTL(0,0,*Caption.AsUTF8*, flags)
>  else
>     DrawCaption(0,0,*Caption.AsUTF8*, flags);
> end;
> 
> Is not that enough?

Sorry, cannot stay aside.
RTL is a control property, not a string. And AsUTF8 is imo unneeded:

procedure TLabel.DrawCaption(ACaption: TUTF8String);
begin
...
end;

procedure TLavel.DrawCaptionRTL(ACaption: TUTF8String);
begin
...
end;

procedure TLabel.Paint(...)
begin
   if RightToLeftAlignment then
     DrawCaptionRTL(0, 0, Caption, flags)
   else
     DrawCaption(0, 0, Caption, flags)
end;


And Caption can be any desired string type. It will be autoconverted to 
UTF8String if needed. I see no need in a string class - only unneeded 
overhead.

Best regards,
Paul Ishenin.




More information about the fpc-devel mailing list