Constructing text with astericks

aberba karabutaworld at gmail.com
Thu May 31 16:05:40 UTC 2018


On Wednesday, 30 May 2018 at 23:11:06 UTC, Adam D. Ruppe wrote:
> 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.

That doesn't sound like a trivial thing to do. Ha ha


More information about the Digitalmars-d-learn mailing list