drewnoakes / figgle

ASCII banner generation for .NET
Apache License 2.0
412 stars 42 forks source link

Support smushing #1

Closed drewnoakes closed 6 years ago

drewnoakes commented 6 years ago
Console.WriteLine(
    FiggleFonts.Standard.Format("Hello, World!"));

Without fitting, text looks like this:

  _   _          _   _                __        __                 _       _   _
 | | | |   ___  | | | |   ___         \ \      / /   ___    _ __  | |   __| | | |
 | |_| |  / _ \ | | | |  / _ \         \ \ /\ / /   / _ \  | '__| | |  / _` | | |
 |  _  | |  __/ | | | | | (_) |  _      \ V  V /   | (_) | | |    | | | (_| | |_|
 |_| |_|  \___| |_| |_|  \___/  ( )      \_/\_/     \___/  |_|    |_|  \__,_| (_)
                                |/

With fitting, text looks like this:

 _   _        _  _           __        __            _      _  _
| | | |  ___ | || |  ___     \ \      / /___   _ __ | |  __| || |
| |_| | / _ \| || | / _ \     \ \ /\ / // _ \ | '__|| | / _` || |
|  _  ||  __/| || || (_) |_    \ V  V /| (_) || |   | || (_| ||_|
|_| |_| \___||_||_| \___/( )    \_/\_/  \___/ |_|   |_| \__,_|(_)
                         |/

With smushing, it will look like this:

 _   _      _ _         __        __         _     _ _ 
| | | | ___| | | ___    \ \      / /__  _ __| | __| | |
| |_| |/ _ \ | |/ _ \    \ \ /\ / / _ \| '__| |/ _` | |
|  _  |  __/ | | (_) |    \ V  V / (_) | |  | | (_| |_|
|_| |_|\___|_|_|\___( )    \_/\_/ \___/|_|  |_|\__,_(_)
                    |/                                 

There are several smushing rules, both horizontal and vertical.

drewnoakes commented 6 years ago

figlet.c might be a useful reference, as the documentation is a bit confusing wrt smushing.

https://github.com/cmatsuoka/figlet/blob/master/figlet.c#L1235