Repository: pterm/pterm
Pull request #180 (2021-04-09 22:02:42)

fix(bigtext): fix height of some characters #180
### Description
I've noticed that numbers 5 and 9 are higher than others. Made a test and also found two more symbols with higher heights.
Also added two more symbols - is it ok to include them in the same PR?

### Scope
> What is affected by this pull request?

- [x] Bug Fix
- [ ] New Feature
- [ ] Documentation
- [ ] Other

### Related Issue
Fixes #


### To-Do Checklist
- [x] I tested my changes
- [ ] I have commented every method that I created/changed
- [ ] I updated the examples to fit with my changes
- [x] I have added tests for my newly created methods


codecov[bot]: # [Codecov](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=h1) Report
> Merging [#180](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=desc) (2bf825e) into [master](https://codecov.io/gh/pterm/pterm/commit/c1d770192bc3aa6da2d7d862bfd25ae5263ae6af?el=desc) (c1d7701) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pterm/pterm/pull/180/graphs/tree.svg?width=650&height=150&src=pr&token=C3EX231V76)](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##            master      #180   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          913       913           
=========================================
  Hits           913       913           
```


| [Impacted Files](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [bigtext\_printer.go](https://codecov.io/gh/pterm/pterm/pull/180/diff?src=pr&el=tree#diff-YmlndGV4dF9wcmludGVyLmdv) | `100.00% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=footer). Last update [c1d7701...2bf825e](https://codecov.io/gh/pterm/pterm/pull/180?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

MarvinJWendt: Hi @adie, thank you for the PR! Yes it's totally fine to add the characters to this PR.
Thanks for contributing ✨

Patch:
diff --git a/bigtext_printer.go b/bigtext_printer.go
index 8967ee5c..32715e28 100644
--- a/bigtext_printer.go
+++ b/bigtext_printer.go
@@ -416,8 +416,7 @@ var DefaultBigText = BigTextPrinter{
 ██      
 ███████ 
      ██ 
-███████ 
-       `,
+███████`,
 		"6": ` ██████  
 ██       
 ███████  
@@ -437,8 +436,7 @@ var DefaultBigText = BigTextPrinter{
 ██   ██ 
  ██████ 
      ██ 
- █████  
-        `,
+ █████ `,
 		" ": "    ",
 		"!": `██ 
 ██ 
@@ -460,8 +458,7 @@ var DefaultBigText = BigTextPrinter{
    ██  
   ██   
  ██    
-██     
-       `,
+██   `,
 		"(": ` ██ 
 ██  
 ██  
@@ -502,7 +499,6 @@ var DefaultBigText = BigTextPrinter{
 █████ 
       
       
-      
      `,
 		"<": `  ██ 
  ██  
@@ -529,5 +525,15 @@ var DefaultBigText = BigTextPrinter{
         
         
 ███████ `,
+		":": `   
+██ 
+   
+   
+██ `,
+		"°": ` ████  
+██  ██ 
+ ████  
+       
+      `,
 	},
 }


Test patch:
diff --git a/bigtext_printer_test.go b/bigtext_printer_test.go
index ee5ad834..1e2da077 100644
--- a/bigtext_printer_test.go
+++ b/bigtext_printer_test.go
@@ -5,6 +5,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	"io"
 	"testing"
+	"strings"
 )
 
 func TestBigTextPrinterNilPrint(t *testing.T) {
@@ -94,3 +95,12 @@ func TestNewLettersFromTextWithStyle(t *testing.T) {
 
 	assert.Equal(t, e, p)
 }
+
+func TestDefaultLettersMaxHeight(t *testing.T) {
+	maxHeight := 5
+	chars := DefaultBigText.BigCharacters
+	for s, l := range(chars) {
+		h := strings.Count(l, "\n")
+		assert.LessOrEqualf(t, h, maxHeight, "'%s' is too high", s)
+	}
+}