Today's programming challenge - How's your Range-Fu ?

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 20 11:03:49 PDT 2015


On Monday, 20 April 2015 at 17:48:17 UTC, Panke wrote:
> To measure the columns needed to print a string, you'll need 
> the number of graphemes. (d|)?string.length gives you the 
> number of code units.

Even that's not really true. In the end it's up to the font and 
layout engine to decide how much space anything takes up. Unicode 
doesn't play nicely with the idea of text as a grid of rows and 
fixed-width columns of characters, although quite a lot can (and 
is, see urxvt for example) be shoe-horned in.


More information about the Digitalmars-d mailing list