Constructing text with astericks

Adam D. Ruppe destructionator at
Wed May 30 23:11:06 UTC 2018

On Wednesday, 30 May 2018 at 22:57:06 UTC, aberba wrote:
> How will you approach this problem in D idiomatically?

Well, I never bother with "idiomatically", so I can't speak to 
that, but a simple solution that would work is to realize that 
what you're basically asking for here is a bitmap.

Each letter in your "font" would be a little bitmap that you copy 
into a destination buffer - itself a larger bitmap.

Then, when it is complete, you can draw the destination buffer 
line by line to the screen.

The data for your font may just be a bunch of string arrays in 
source, or an actual bitmap file you create outside the program 
and load at runtime or something like that. Just remember that 
you can't just `buffer ~= letter` - you need to do line by line 
since the two bitmaps will have different sizes.

More information about the Digitalmars-d-learn mailing list