Skip to content

Commit

Permalink
Fix standard font display of space k ~ characters
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Apr 24, 2022
1 parent 2e548ee commit 347f6b5
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 44 deletions.
40 changes: 24 additions & 16 deletions fonts/standard.md
@@ -1,27 +1,35 @@
# standard

```
_ ____ ____ ____ _____ _____ ____
/ \ | __ ) / ___| _ \| ____| ___/ ___|
/ _ \ | _ \| | | | | | _| | |_ | | _
/ ___ \| |_) | |___| |_| | |___| _|| |_| |
/_/ \_\____/ \____|____/|_____|_| \____|
_ ____ ____ ____ _____ _____ ____
/ \ | __ ) / ___| | _ \ | ____| | ___| / ___|
/ _ \ | _ \ | | | | | | | _| | |_ | | _
/ ___ \ | |_) | | |___ | |_| | | |___ | _| | |_| |
/_/ \_\ |____/ \____| |____/ |_____| |_| \____|
```

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

```
_ ____ _____ _ _ ____ __ _____
/ | |___ \ |___ / | || | | ___| / /_ |___ |
| | __) | |_ \ | || |_ |___ \ | '_ \ / /
| | / __/ ___) | |__ _| ___) | | (_) | / /
|_| |_____| |____/ |_| |____/ \___/ /_/
```

```
_ ____ _____ _ _ ____ __ _____
/ |___ \|___ /| || || ___| / /|___ |
| | __) | |_ \| || ||___ \| '_ \ / /
| |/ __/ ___) |__ _|__) | (_) / /
|_|_____|____/ |_||____/ \___/_/
_ _ _ _ _ _ _ __ _ __
| | ( | ) _| || |_ | | (_)/ / ( ) / /
| | V V |_ .. _| / __) / / |/ | |
|_| |_ _| \__ \ / /_ | |
(_) |_||_| ( / /_/(_) | |
|_| \_\
```
27 changes: 11 additions & 16 deletions lib/tty/fonts/standard.yml
@@ -1,9 +1,15 @@
# Authors: Glenn Chappell & Ian Chai
name: standard
author: "Glenn Chappell & Ian Chai"
char_height: 6
char_space: 0
max_line_length: 11
chars:
" ": [
" ",
" ",
" ",
" ",
" ",
" "
]
"!": [
" _ ",
" | |",
Expand Down Expand Up @@ -346,7 +352,7 @@ chars:
" | ' / ",
" | . \\ ",
" |_|\\_\\",
" "
" "
]
L: [
" _ ",
Expand Down Expand Up @@ -748,22 +754,11 @@ chars:
" | | ",
" /_/ "
]
"\"": [
"~": [
" /\\/|",
" |/\\/ ",
" ",
" ",
" ",
" "
]
" ": [
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "
]

37 changes: 25 additions & 12 deletions spec/unit/write_spec.rb
@@ -1,6 +1,19 @@
# frozen_string_literal: true

RSpec.describe TTY::Font, "#write" do
let(:ascii_chars) { (32..126).map(&:chr).join }

{
"standard" => 6
}.each do |name, height|
it "writes supported ASCII characters in '#{name}' font" do
font = described_class.new(name)
output = font.write(ascii_chars)

expect(output.lines.size).to eq(height)
end
end

it "writes lowercase letters in 'standard' font" do
font = described_class.new
expect(font.write("abcde")).to eq([
Expand Down Expand Up @@ -52,12 +65,12 @@
it "writes text with space character in 'standard' font" do
font = described_class.new
expect(font.write("a b c d e")).to eq([
" _ _ ",
" __ _ | |__ ___ __| | ___ ",
" / _` | | '_ \\ / __| / _` | / _ \\",
" | (_| | | |_) | | (__ | (_| | | __/",
" \\__,_| |_.__/ \\___| \\__,_| \\___|",
" "
" _ _ ",
" __ _ | |__ ___ __| | ___ ",
" / _` | | '_ \\ / __| / _` | / _ \\",
" | (_| | | |_) | | (__ | (_| | | __/",
" \\__,_| |_.__/ \\___| \\__,_| \\___|",
" "
].join("\n"))
end

Expand Down Expand Up @@ -88,12 +101,12 @@
it "writes text with space characters and :letter_spacing set" do
font = described_class.new
expect(font.write("ab cd e", letter_spacing: 2)).to eq([
" _ _ ",
" __ _ | |__ ___ __| | ___ ",
" / _` | | '_ \\ / __| / _` | / _ \\",
" | (_| | | |_) | | (__ | (_| | | __/",
" \\__,_| |_.__/ \\___| \\__,_| \\___|",
" "
" _ _ ",
" __ _ | |__ ___ __| | ___ ",
" / _` | | '_ \\ / __| / _` | / _ \\",
" | (_| | | |_) | | (__ | (_| | | __/",
" \\__,_| |_.__/ \\___| \\__,_| \\___|",
" "
].join("\n"))
end

Expand Down

0 comments on commit 347f6b5

Please sign in to comment.