tomakita / Colorful.Console

Style your .NET console output!
MIT License
1.3k stars 127 forks source link

Figlet font width? #7

Open hmemcpy opened 8 years ago

hmemcpy commented 8 years ago

Hi, me again :)

I was wondering, is it possible to control the width of the figlet fonts from Colorful.Console? The default seems to be writing out the fonts at full width, but I'd like to print out smushed. Is it possible currently?

Thanks! Igal.

tomakita commented 8 years ago

Hi Igal,

Good question. I'm not aware of a way to do this via the Colorful.Console API, but am fairly certain that it can be done by editing a FIGlet font file directly.

@RehanSaeed, do you know if this is possible via the Colorful.Console API?

RehanSaeed commented 8 years ago

Yes, there is. This is actually called Kerning. There is an integer Kerning property on the FigletFont class among many others. Now there is a condition, the Kerning can be added to but you can't make it smaller. There are libraries out there that support doing that (I forget the technical term for this type of 'squishing') but we don't support that. It's fairly complicated to implement because you have to think about what happens when one character touches another. I'm sure @tomakita would accept a PR for this feature. I hope that helps!

tomakita commented 8 years ago

Thanks for the info, Muhammad! You're right, I would definitely accept a PR for this feature. I don't have enough time at the moment to implement this myself, but have put it on my list of possible improvements.

hmemcpy commented 8 years ago

Thanks very much, both, for the info! I'll try to send a PR for this :) Thanks again for the awesome library!

RehanSaeed commented 8 years ago

Figlet.js is the best implementation of Figlet I have seen but it's in JavaScript unfortunately. It may be some help in how to implement this feature.

tomakita commented 7 years ago

Figgle is a .NET library that supports smushing! Try the following to see it in action. I'm not sure if it's supported on all fonts at this point, and I'm not quite sure how it works in general, but it's very cool!

Console.WriteLine(FiggleFonts.BigFig.Render("pizza")); // no smushing Console.WriteLine(FiggleFonts.BigFig.Render("pizza", 5)); // 5 is the smushing override