toUTFz and WinAPI GetTextExtentPoint32W

Jonathan M Davis jmdavisProg at gmx.com
Tue Sep 20 14:31:22 PDT 2011


On Tuesday, September 20, 2011 14:27 Andrej Mitrovic wrote:
> Don't use length, use std.utf.count, ala:
> 
> import std.utf;
> alias toUTFz!(const(wchar)*, string) toUTF16z;
> GetTextExtentPoint32W(str.toUTF16z, std.utf.count(str), s);

Or std.range.walkLength. I don't know why we really have std.utf.count. I just 
calls walkLength anyway. I suspect that it's a function that predates 
walkLength and was made to use walkLength after walkLength was introduced. But 
it's kind of pointless now.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list