Felipe Monteiro de Carvalho wrote:
> Hello,
> 
> I would like to create some official guidelines about how to implement
> unicode support for win32 interface, so volunteers can base on those
> to implement it and we get a uniform work. And I think that a good
> example to create a guideline is by an example.
> 
> Consider the line 292 of the win32wsbuttons.pp file:
> 
>  GetTextExtentPoint32(hdcNewBitmap, LPSTR(ButtonCaption),
> Length(ButtonCaption), TextSize);
> 
> My initial idea is to transform this into:
> 
> var
>  WideText: PWideChar;
>  AnsiText: string;
>  WideSize: Integer;
> 
>  ........
> 
> {$ifdef UnicodeWinInterface}
>  if UnicodeEnabledOS then
>  begin
>    WideSize := Utf8ToUnicode(nil, ButtonCaption, 0);
>    WideText := GetMem(WideSize * 2);

Are you sure about the 2 here ? I wouldn't rely on that. As I wrote in
another mail, Utf8ToUnicode should return the number of bytes and not
the number of chars. Since the number of chars is irrelevant.

BTW, why is Utf8ToAnsi returning a string and Utf8ToUnicode a count ?
This is inconsistent.

Marc



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

Reply via email to