The Case Against Autodecode

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Mon May 30 11:30:12 PDT 2016


On Monday, 30 May 2016 at 16:03:03 UTC, Marco Leise wrote:
> When on the other hand you work with real world international 
> text, you'll want to work with graphemes.

Actually, my main rule of thumb is: don't mess with strings. Get 
them from the user, store them without modification, spit them 
back out again. Wherever possible, don't do anything more.

But if you do have to implement the rest, eh, it depends on what 
you're doing still. If I want an ellipsis, for example, I like to 
take font size into account too - basically, I do a dry-run of 
the whole font render to get the length in pixels, then slice off 
the partial grapheme...

So yeah that's kinda complicated...



More information about the Digitalmars-d mailing list