From cc263fe07a5076df2b624169c2f31ec18b335185 Mon Sep 17 00:00:00 2001 From: Patrick Huesmann Date: Wed, 21 Feb 2024 11:53:45 +0100 Subject: [PATCH 1/6] feat: margin/border around image --- svgscreen/svgscreen.go | 36 ++++++++++++++++++++++++++++-------- svgscreen/template.svg | 6 ++++++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/svgscreen/svgscreen.go b/svgscreen/svgscreen.go index 30b9a10..6691724 100644 --- a/svgscreen/svgscreen.go +++ b/svgscreen/svgscreen.go @@ -58,6 +58,8 @@ type bgRect struct { type SvgDom struct { Width string Height string + MarginX string + MarginY string FontName string FontEmbedded []byte FontRef string @@ -96,13 +98,13 @@ type Screen struct { Dom SvgDom } -func (s *Screen) columnCoordinate(col int) string { +func (s *Screen) columnCoordinate(col float32) string { unit := "ch" if s.CharacterBoxSize.Width > 0 { unit = "px" - col *= s.CharacterBoxSize.Width + col *= float32(s.CharacterBoxSize.Width) } - return strconv.Itoa(col) + unit + return fmt.Sprintf("%g%s", col, unit) } func (s *Screen) rowCoordinate(row float32) string { @@ -185,7 +187,7 @@ func (s *Screen) lineToTextElement(l Line) textElement { newSpan := s.charToFgText(c) if s.GridMode { // In grid mode, set X coordinate for each text span - newSpan.X = s.columnCoordinate(col) + newSpan.X = s.columnCoordinate(float32(col)) // In grid mode, we never consolidate appendSpan() currentSpan = newSpan @@ -246,9 +248,9 @@ func (s *Screen) setupBgRects() { return } s.Dom.BgRects = append(s.Dom.BgRects, bgRect{ - X: s.columnCoordinate(currentRect.x), + X: s.columnCoordinate(float32(currentRect.x)), Y: s.rowCoordinate(float32(y)), - Width: s.columnCoordinate(currentRect.w), + Width: s.columnCoordinate(float32(currentRect.w)), Height: s.rowCoordinate(1), Color: currentRect.color, }) @@ -298,9 +300,27 @@ func (s *Screen) Render(w io.Writer) error { s.Foreground.Custom = map[string]int{} s.Background.Custom = map[string]int{} + marginX := float32(5.0) + marginY := float32(5.0) + // Set SVG size - s.Dom.Width = s.columnCoordinate(s.TerminalWidth) - s.Dom.Height = s.rowCoordinate(float32(s.NrLines)) + if s.CharacterBoxSize.Width == 0 { + // Font-relative coordinates + s.Dom.Width = s.columnCoordinate(float32(s.TerminalWidth) + 2*marginX) + s.Dom.Height = s.rowCoordinate(float32(s.NrLines) + 2*marginY) + if marginX > 0 || marginY > 0 { + s.Dom.MarginX = fmt.Sprintf("%gch", marginX) + s.Dom.MarginY = fmt.Sprintf("%gem", marginY) + } + } else { + // Pixel coordinates + s.Dom.Width = fmt.Sprintf("%gpx", float32(s.CharacterBoxSize.Width*s.TerminalWidth)+2*marginX) + s.Dom.Height = fmt.Sprintf("%gpx", float32(s.CharacterBoxSize.Height*s.NrLines)+2*marginY) + if marginX > 0 || marginY > 0 { + s.Dom.MarginX = fmt.Sprintf("%gpx", marginX) + s.Dom.MarginY = fmt.Sprintf("%gpx", marginY) + } + } s.handleColorInversion() s.setupBgRects() diff --git a/svgscreen/template.svg b/svgscreen/template.svg index 33a5a56..6e3eb51 100644 --- a/svgscreen/template.svg +++ b/svgscreen/template.svg @@ -9,6 +9,12 @@ whitespace only tspan:s preventing underline to be properly rendered. */ -}} - -regular -bold -italic -bold italic -underline -strikethrough - +regular +bold +italic +bold italic +underline +strikethrough diff --git a/cli/testdata/charboxfontsize.svg b/cli/testdata/charboxfontsize.svg index 1aedbdf..d7d27e5 100644 --- a/cli/testdata/charboxfontsize.svg +++ b/cli/testdata/charboxfontsize.svg @@ -15,8 +15,6 @@ } - -hello -world - +hello +world diff --git a/cli/testdata/colortest.svg b/cli/testdata/colortest.svg index d17f932..81705c5 100644 --- a/cli/testdata/colortest.svg +++ b/cli/testdata/colortest.svg @@ -182,25 +182,23 @@ - - 40m 41m 42m 43m 44m 45m 46m 47m - m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 30m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 31m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 32m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 33m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 34m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 35m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 36m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 37m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw - + 40m 41m 42m 43m 44m 45m 46m 47m + m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 30m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 31m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 32m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 33m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 34m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 35m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 36m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 37m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw diff --git a/cli/testdata/colortest_slate.svg b/cli/testdata/colortest_slate.svg index 964fdfa..634a2ab 100644 --- a/cli/testdata/colortest_slate.svg +++ b/cli/testdata/colortest_slate.svg @@ -182,25 +182,23 @@ - - 40m 41m 42m 43m 44m 45m 46m 47m - m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 30m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 31m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 32m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 33m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 34m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 35m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 36m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 37m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw - + 40m 41m 42m 43m 44m 45m 46m 47m + m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 30m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 31m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 32m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 33m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 34m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 35m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 36m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 37m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw diff --git a/cli/testdata/colortest_transparent.svg b/cli/testdata/colortest_transparent.svg index 73203f4..5b221a8 100644 --- a/cli/testdata/colortest_transparent.svg +++ b/cli/testdata/colortest_transparent.svg @@ -181,25 +181,23 @@ - - 40m 41m 42m 43m 44m 45m 46m 47m - m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 30m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 31m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 32m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 33m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 34m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 35m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 36m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 37m gYw gYw gYw gYw gYw gYw gYw gYw gYw - 1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw - + 40m 41m 42m 43m 44m 45m 46m 47m + m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 30m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;30m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 31m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;31m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 32m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;32m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 33m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;33m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 34m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;34m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 35m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;35m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 36m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;36m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 37m gYw gYw gYw gYw gYw gYw gYw gYw gYw + 1;37m gYw gYw gYw gYw gYw gYw gYw gYw gYw diff --git a/cli/testdata/cowsay-osc-colon-color.svg b/cli/testdata/cowsay-osc-colon-color.svg index 224210a..6c33c4a 100644 --- a/cli/testdata/cowsay-osc-colon-color.svg +++ b/cli/testdata/cowsay-osc-colon-color.svg @@ -62,14 +62,12 @@ .fc45 { fill: #fd324f; } - - ____________ -< Hello ANSI > - ------------ - \ ^__^ - \ (oo)\_______ - (__)\ )\/\ - ||----w | - || || - + ____________ +< Hello ANSI > + ------------ + \ ^__^ + \ (oo)\_______ + (__)\ )\/\ + ||----w | + || || diff --git a/cli/testdata/fontembedded.svg b/cli/testdata/fontembedded.svg index 1bc4b06..88d04fe 100644 --- a/cli/testdata/fontembedded.svg +++ b/cli/testdata/fontembedded.svg @@ -19,7 +19,5 @@ } - -test - +test diff --git a/cli/testdata/fontname.svg b/cli/testdata/fontname.svg index 21dd3ac..fdbda53 100644 --- a/cli/testdata/fontname.svg +++ b/cli/testdata/fontname.svg @@ -15,7 +15,5 @@ } - -test - +test diff --git a/cli/testdata/fontref.svg b/cli/testdata/fontref.svg index 0d7035f..70b36ed 100644 --- a/cli/testdata/fontref.svg +++ b/cli/testdata/fontref.svg @@ -19,7 +19,5 @@ } - -test - +test diff --git a/cli/testdata/fq.svg b/cli/testdata/fq.svg index 8081a81..9c155be 100644 --- a/cli/testdata/fq.svg +++ b/cli/testdata/fq.svg @@ -25,15 +25,13 @@ .fa15 { fill: #ffffff; } - - |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.: {} ../fq/testfiles/test.mp3 (mp3) -0x000|49 44 33 04 00 00 00 00 00 32 54 50 45 31 00 00|ID3......2TPE1..| headers: [1] -* |until 0x3b.7 (60) | | -0x030| ff fb 50 00| ..P.| frames: [3] -0x040|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................| -* |until 0x44e.7 (1043) | | - | | | footers: [0] -0x440| 61| a| unknown0: 61736461 -0x450|73 64 61| |sda| | - + |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.: {} ../fq/testfiles/test.mp3 (mp3) +0x000|49 44 33 04 00 00 00 00 00 32 54 50 45 31 00 00|ID3......2TPE1..| headers: [1] +* |until 0x3b.7 (60) | | +0x030| ff fb 50 00| ..P.| frames: [3] +0x040|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|................| +* |until 0x44e.7 (1043) | | + | | | footers: [0] +0x440| 61| a| unknown0: 61736461 +0x450|73 64 61| |sda| | diff --git a/cli/testdata/invert_color.svg b/cli/testdata/invert_color.svg index b29e4ec..d59330f 100644 --- a/cli/testdata/invert_color.svg +++ b/cli/testdata/invert_color.svg @@ -26,7 +26,5 @@ - - red yellow red - + red yellow red diff --git a/cli/testdata/invert_default.svg b/cli/testdata/invert_default.svg index 3c2cdae..5a96baa 100644 --- a/cli/testdata/invert_default.svg +++ b/cli/testdata/invert_default.svg @@ -22,7 +22,5 @@ - - black write black - + black write black diff --git a/cli/testdata/jq.svg b/cli/testdata/jq.svg index 2c04aee..b718278 100644 --- a/cli/testdata/jq.svg +++ b/cli/testdata/jq.svg @@ -21,17 +21,15 @@ .fa4 { fill: #0000bb; } - -{ - "true": true, - "false": false, - "string": "string", - "number": 123.1, - "array": [ - 1, - 2, - 3 - ] -} - +{ + "true": true, + "false": false, + "string": "string", + "number": 123.1, + "array": [ + 1, + 2, + 3 + ] +} diff --git a/cli/testdata/main.go.bat.svg b/cli/testdata/main.go.bat.svg index 87b6ae7..ccc2b89 100644 --- a/cli/testdata/main.go.bat.svg +++ b/cli/testdata/main.go.bat.svg @@ -24,62 +24,60 @@ .fc7 { fill: #be84ff; } - -package main -import ( - "flag" - "fmt" - "os" - "strconv" - "strings" - "github.com/wader/ansisvg/ansitosvg" -) -type boxSize struct { - Width int - Height int -} -func (d *boxSize) String() string { - return fmt.Sprintf("%dx%d", d.Width, d.Height) -} -func (d *boxSize) Set(s string) error { - parts := strings.Split(s, "x") - if len(parts) != 2 { - return fmt.Errorf("must be WxH") - } - d.Width, _ = strconv.Atoi(parts[0]) - d.Height, _ = strconv.Atoi(parts[1]) - return nil -} -var fontFlag = flag.String("font", ansisvg.DefaultOptions.Font, "Font") -var fontSizeFlag = flag.Int("fontsize", ansisvg.DefaultOptions.FontSize, "Font size") -var terminalWidthFlag = flag.Int("width", 0, "Terminal width (auto)") -var characterBoxSize = boxSize{ - Width: ansisvg.DefaultOptions.CharacterBoxSize.Width, - Height: ansisvg.DefaultOptions.CharacterBoxSize.Height, -} -var colorSchemeFlag = flag.String("colorscheme", ansisvg.DefaultOptions.ColorScheme, "Color scheme") -func init() { - flag.Var(&characterBoxSize, "charboxsize", "Character box size") -} -func main() { - flag.Parse() - if err := ansisvg.Convert( - os.Stdin, - os.Stdout, - ansisvg.Options{ - Font: *fontFlag, - FontSize: *fontSizeFlag, - TerminalWidth: *terminalWidthFlag, - CharacterBoxSize: ansisvg.BoxSize{ - Width: characterBoxSize.Width, - Height: characterBoxSize.Height, - }, - ColorScheme: *colorSchemeFlag, - }, - ); err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} - +package main +import ( + "flag" + "fmt" + "os" + "strconv" + "strings" + "github.com/wader/ansisvg/ansitosvg" +) +type boxSize struct { + Width int + Height int +} +func (d *boxSize) String() string { + return fmt.Sprintf("%dx%d", d.Width, d.Height) +} +func (d *boxSize) Set(s string) error { + parts := strings.Split(s, "x") + if len(parts) != 2 { + return fmt.Errorf("must be WxH") + } + d.Width, _ = strconv.Atoi(parts[0]) + d.Height, _ = strconv.Atoi(parts[1]) + return nil +} +var fontFlag = flag.String("font", ansisvg.DefaultOptions.Font, "Font") +var fontSizeFlag = flag.Int("fontsize", ansisvg.DefaultOptions.FontSize, "Font size") +var terminalWidthFlag = flag.Int("width", 0, "Terminal width (auto)") +var characterBoxSize = boxSize{ + Width: ansisvg.DefaultOptions.CharacterBoxSize.Width, + Height: ansisvg.DefaultOptions.CharacterBoxSize.Height, +} +var colorSchemeFlag = flag.String("colorscheme", ansisvg.DefaultOptions.ColorScheme, "Color scheme") +func init() { + flag.Var(&characterBoxSize, "charboxsize", "Character box size") +} +func main() { + flag.Parse() + if err := ansisvg.Convert( + os.Stdin, + os.Stdout, + ansisvg.Options{ + Font: *fontFlag, + FontSize: *fontSizeFlag, + TerminalWidth: *terminalWidthFlag, + CharacterBoxSize: ansisvg.BoxSize{ + Width: characterBoxSize.Width, + Height: characterBoxSize.Height, + }, + ColorScheme: *colorSchemeFlag, + }, + ); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} diff --git a/cli/testdata/margintest_gridmode.ansi b/cli/testdata/margintest_gridmode.ansi new file mode 100644 index 0000000..1b1d3fc --- /dev/null +++ b/cli/testdata/margintest_gridmode.ansi @@ -0,0 +1,15 @@ +[48:2:247:247:247m[38:2:74:69:67m3024 Day [48:2:9:3:0m [48:2:1:160:228m [48:2:181:228:244m [48:2:1:162:82m [48:2:161:106:148m [48:2:219:45:32m [48:2:165:162:162m [48:2:253:237:2m [48:2:92:88:85m [48:2:128:125:124m [48:2:205:171:83m [48:2:58:52:50m [48:2:214:213:212m [48:2:232:187:208m [48:2:247:247:247m [48:2:74:69:67m [48:2:165:162:162m [48:2:74:69:67m  +[48:2:9:3:0m[38:2:165:162:162m3024 Night [48:2:9:3:0m [48:2:1:160:228m [48:2:181:228:244m [48:2:1:162:82m [48:2:161:106:148m [48:2:219:45:32m [48:2:165:162:162m [48:2:253:237:2m [48:2:92:88:85m [48:2:128:125:124m [48:2:205:171:83m [48:2:58:52:50m [48:2:214:213:212m [48:2:232:187:208m [48:2:247:247:247m [48:2:74:69:67m [48:2:74:69:67m [48:2:165:162:162m  +[48:2:16:32:64m[38:2:221:221:221mAardvark Blue [48:2:25:25:25m [48:2:19:112:211m [48:2:0:142:176m [48:2:75:140:15m [48:2:196:58:195m [48:2:170:52:46m [48:2:190:190:190m [48:2:219:186:0m [48:2:69:69:69m [48:2:96:164:236m [48:2:96:182:203m [48:2:149:220:85m [48:2:226:107:226m [48:2:240:91:80m [48:2:247:247:247m [48:2:255:231:99m [48:2:191:219:254m [48:2:0:122:204m  +[48:2:17:20:22m[38:2:238:238:236mAbernathy [48:2:0:0:0m [48:2:16:147:245m [48:2:0:205:205m [48:2:0:205:0m [48:2:205:0:205m [48:2:205:0:0m [48:2:250:235:215m [48:2:205:205:0m [48:2:64:64:64m [48:2:17:181:246m [48:2:0:255:255m [48:2:0:255:0m [48:2:255:0:255m [48:2:255:0:0m [48:2:255:255:255m [48:2:255:255:0m [48:2:238:238:236m [48:2:187:187:187m  +[48:2:4:4:4m[38:2:254:255:255mAdventure [48:2:4:4:4m [48:2:65:122:179m [48:2:189:207:229m [48:2:93:166:2m [48:2:229:196:153m [48:2:216:74:51m [48:2:219:222:216m [48:2:238:187:110m [48:2:104:86:86m [48:2:151:215:239m [48:2:189:207:229m [48:2:153:181:44m [48:2:170:121:0m [48:2:215:107:66m [48:2:228:213:199m [48:2:255:182:112m [48:2:96:96:96m [48:2:254:255:255m  +[48:2:31:29:69m[38:2:248:220:192mAdventureTime [48:2:5:4:4m [48:2:15:74:198m [48:2:112:165:152m [48:2:74:177:24m [48:2:102:89:147m [48:2:189:0:19m [48:2:248:220:192m [48:2:231:116:30m [48:2:78:124:191m [48:2:25:151:198m [48:2:200:250:244m [48:2:158:255:110m [48:2:155:89:83m [48:2:252:95:90m [48:2:246:245:251m [48:2:239:193:26m [48:2:112:107:78m [48:2:239:191:56m  +[48:2:33:33:33m[38:2:208:208:208mAfterglow [48:2:21:21:21m [48:2:108:153:187m [48:2:125:214:207m [48:2:126:142:80m [48:2:159:78:133m [48:2:172:65:66m [48:2:208:208:208m [48:2:229:181:103m [48:2:80:80:80m [48:2:108:153:187m [48:2:125:214:207m [48:2:126:142:80m [48:2:159:78:133m [48:2:172:65:66m [48:2:245:245:245m [48:2:229:181:103m [48:2:48:48:48m [48:2:208:208:208m  +[48:2:247:247:247m[38:2:0:0:0mAlabaster [48:2:0:0:0m [48:2:50:92:192m [48:2:0:131:178m [48:2:68:140:39m [48:2:122:62:157m [48:2:170:55:49m [48:2:247:247:247m [48:2:203:144:0m [48:2:119:119:119m [48:2:0:122:204m [48:2:0:170:203m [48:2:96:203:0m [48:2:230:76:230m [48:2:240:80:80m [48:2:247:247:247m [48:2:255:188:93m [48:2:191:219:254m [48:2:0:122:204m  +[48:2:15:22:16m[38:2:99:125:117mAlienBlood [48:2:17:38:22m [48:2:47:106:127m [48:2:50:127:119m [48:2:47:126:37m [48:2:71:88:127m [48:2:127:43:39m [48:2:100:125:117m [48:2:113:127:36m [48:2:60:72:18m [48:2:0:170:224m [48:2:0:224:196m [48:2:24:224:0m [48:2:0:88:224m [48:2:224:128:9m [48:2:115:250:145m [48:2:189:224:0m [48:2:29:65:37m [48:2:115:250:145m  +[48:2:38:42:51m[38:2:229:229:229mAndromeda [48:2:0:0:0m [48:2:36:114:200m [48:2:15:168:205m [48:2:5:188:121m [48:2:188:63:188m [48:2:205:49:49m [48:2:229:229:229m [48:2:229:229:18m [48:2:102:102:102m [48:2:36:114:200m [48:2:15:168:205m [48:2:5:188:121m [48:2:188:63:188m [48:2:205:49:49m [48:2:229:229:229m [48:2:229:229:18m [48:2:90:92:98m [48:2:248:248:240m  +[48:2:44:43:43m[38:2:213:162:0mApple Classic [48:2:0:0:0m [48:2:2:37:199m [48:2:0:197:199m [48:2:0:194:0m [48:2:202:48:199m [48:2:201:27:0m [48:2:199:199:199m [48:2:199:196:0m [48:2:104:104:104m [48:2:104:113:255m [48:2:96:253:255m [48:2:95:250:104m [48:2:255:119:255m [48:2:255:110:103m [48:2:255:255:255m [48:2:255:252:103m [48:2:107:91:2m [48:2:199:199:199m  +[48:2:30:30:30m[38:2:255:255:255mApple System Colors [48:2:26:26:26m [48:2:8:105:203m [48:2:71:158:194m [48:2:38:164:57m [48:2:150:71:191m [48:2:204:55:46m [48:2:152:152:157m [48:2:205:172:8m [48:2:70:70:70m [48:2:10:132:255m [48:2:118:214:255m [48:2:50:215:75m [48:2:191:90:242m [48:2:255:69:58m [48:2:255:255:255m [48:2:255:214:10m [48:2:63:99:139m [48:2:152:152:157m  +[48:2:14:16:25m[38:2:255:250:244mArgonaut [48:2:35:35:35m [48:2:0:141:248m [48:2:0:216:235m [48:2:140:225:11m [48:2:109:67:166m [48:2:255:0:15m [48:2:255:255:255m [48:2:255:185:0m [48:2:68:68:68m [48:2:0:146:255m [48:2:103:255:240m [48:2:171:225:91m [48:2:154:95:235m [48:2:255:39:64m [48:2:255:255:255m [48:2:255:210:66m [48:2:0:42:59m [48:2:255:0:24m  +[48:2:28:28:28m[38:2:221:238:221mArthur [48:2:61:53:42m [48:2:100:149:237m [48:2:176:196:222m [48:2:134:175:128m [48:2:222:184:135m [48:2:205:92:92m [48:2:187:170:153m [48:2:232:174:91m [48:2:85:68:68m [48:2:135:206:235m [48:2:176:196:222m [48:2:136:170:34m [48:2:153:102:0m [48:2:204:85:51m [48:2:221:204:187m [48:2:255:167:93m [48:2:77:77:77m [48:2:226:187:239m  +[48:2:32:39:70m[38:2:151:157:180mAtelierSulphurpool [48:2:32:39:70m [48:2:61:143:209m [48:2:34:162:201m [48:2:172:151:57m [48:2:102:121:204m [48:2:201:73:34m [48:2:151:157:180m [48:2:192:139:48m [48:2:107:115:148m [48:2:137:142:164m [48:2:156:99:122m [48:2:41:50:86m [48:2:223:226:241m [48:2:199:107:41m [48:2:245:247:255m [48:2:94:102:135m [48:2:94:102:135m [48:2:151:157:180m  diff --git a/cli/testdata/margintest_gridmode.args b/cli/testdata/margintest_gridmode.args new file mode 100644 index 0000000..3883a43 --- /dev/null +++ b/cli/testdata/margintest_gridmode.args @@ -0,0 +1 @@ +--charboxsize 8x16 --marginsize 10x10 diff --git a/cli/testdata/margintest_gridmode.svg b/cli/testdata/margintest_gridmode.svg new file mode 100644 index 0000000..150a02e --- /dev/null +++ b/cli/testdata/margintest_gridmode.svg @@ -0,0 +1,553 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +3024 Day +3024 Night +Aardvark Blue +Abernathy +Adventure +AdventureTime +Afterglow +Alabaster +AlienBlood +Andromeda +Apple Classic +Apple System Colors +Argonaut +Arthur +AtelierSulphurpool + diff --git a/cli/testdata/margintest_nogridmode.ansi b/cli/testdata/margintest_nogridmode.ansi new file mode 100644 index 0000000..1b1d3fc --- /dev/null +++ b/cli/testdata/margintest_nogridmode.ansi @@ -0,0 +1,15 @@ +[48:2:247:247:247m[38:2:74:69:67m3024 Day [48:2:9:3:0m [48:2:1:160:228m [48:2:181:228:244m [48:2:1:162:82m [48:2:161:106:148m [48:2:219:45:32m [48:2:165:162:162m [48:2:253:237:2m [48:2:92:88:85m [48:2:128:125:124m [48:2:205:171:83m [48:2:58:52:50m [48:2:214:213:212m [48:2:232:187:208m [48:2:247:247:247m [48:2:74:69:67m [48:2:165:162:162m [48:2:74:69:67m  +[48:2:9:3:0m[38:2:165:162:162m3024 Night [48:2:9:3:0m [48:2:1:160:228m [48:2:181:228:244m [48:2:1:162:82m [48:2:161:106:148m [48:2:219:45:32m [48:2:165:162:162m [48:2:253:237:2m [48:2:92:88:85m [48:2:128:125:124m [48:2:205:171:83m [48:2:58:52:50m [48:2:214:213:212m [48:2:232:187:208m [48:2:247:247:247m [48:2:74:69:67m [48:2:74:69:67m [48:2:165:162:162m  +[48:2:16:32:64m[38:2:221:221:221mAardvark Blue [48:2:25:25:25m [48:2:19:112:211m [48:2:0:142:176m [48:2:75:140:15m [48:2:196:58:195m [48:2:170:52:46m [48:2:190:190:190m [48:2:219:186:0m [48:2:69:69:69m [48:2:96:164:236m [48:2:96:182:203m [48:2:149:220:85m [48:2:226:107:226m [48:2:240:91:80m [48:2:247:247:247m [48:2:255:231:99m [48:2:191:219:254m [48:2:0:122:204m  +[48:2:17:20:22m[38:2:238:238:236mAbernathy [48:2:0:0:0m [48:2:16:147:245m [48:2:0:205:205m [48:2:0:205:0m [48:2:205:0:205m [48:2:205:0:0m [48:2:250:235:215m [48:2:205:205:0m [48:2:64:64:64m [48:2:17:181:246m [48:2:0:255:255m [48:2:0:255:0m [48:2:255:0:255m [48:2:255:0:0m [48:2:255:255:255m [48:2:255:255:0m [48:2:238:238:236m [48:2:187:187:187m  +[48:2:4:4:4m[38:2:254:255:255mAdventure [48:2:4:4:4m [48:2:65:122:179m [48:2:189:207:229m [48:2:93:166:2m [48:2:229:196:153m [48:2:216:74:51m [48:2:219:222:216m [48:2:238:187:110m [48:2:104:86:86m [48:2:151:215:239m [48:2:189:207:229m [48:2:153:181:44m [48:2:170:121:0m [48:2:215:107:66m [48:2:228:213:199m [48:2:255:182:112m [48:2:96:96:96m [48:2:254:255:255m  +[48:2:31:29:69m[38:2:248:220:192mAdventureTime [48:2:5:4:4m [48:2:15:74:198m [48:2:112:165:152m [48:2:74:177:24m [48:2:102:89:147m [48:2:189:0:19m [48:2:248:220:192m [48:2:231:116:30m [48:2:78:124:191m [48:2:25:151:198m [48:2:200:250:244m [48:2:158:255:110m [48:2:155:89:83m [48:2:252:95:90m [48:2:246:245:251m [48:2:239:193:26m [48:2:112:107:78m [48:2:239:191:56m  +[48:2:33:33:33m[38:2:208:208:208mAfterglow [48:2:21:21:21m [48:2:108:153:187m [48:2:125:214:207m [48:2:126:142:80m [48:2:159:78:133m [48:2:172:65:66m [48:2:208:208:208m [48:2:229:181:103m [48:2:80:80:80m [48:2:108:153:187m [48:2:125:214:207m [48:2:126:142:80m [48:2:159:78:133m [48:2:172:65:66m [48:2:245:245:245m [48:2:229:181:103m [48:2:48:48:48m [48:2:208:208:208m  +[48:2:247:247:247m[38:2:0:0:0mAlabaster [48:2:0:0:0m [48:2:50:92:192m [48:2:0:131:178m [48:2:68:140:39m [48:2:122:62:157m [48:2:170:55:49m [48:2:247:247:247m [48:2:203:144:0m [48:2:119:119:119m [48:2:0:122:204m [48:2:0:170:203m [48:2:96:203:0m [48:2:230:76:230m [48:2:240:80:80m [48:2:247:247:247m [48:2:255:188:93m [48:2:191:219:254m [48:2:0:122:204m  +[48:2:15:22:16m[38:2:99:125:117mAlienBlood [48:2:17:38:22m [48:2:47:106:127m [48:2:50:127:119m [48:2:47:126:37m [48:2:71:88:127m [48:2:127:43:39m [48:2:100:125:117m [48:2:113:127:36m [48:2:60:72:18m [48:2:0:170:224m [48:2:0:224:196m [48:2:24:224:0m [48:2:0:88:224m [48:2:224:128:9m [48:2:115:250:145m [48:2:189:224:0m [48:2:29:65:37m [48:2:115:250:145m  +[48:2:38:42:51m[38:2:229:229:229mAndromeda [48:2:0:0:0m [48:2:36:114:200m [48:2:15:168:205m [48:2:5:188:121m [48:2:188:63:188m [48:2:205:49:49m [48:2:229:229:229m [48:2:229:229:18m [48:2:102:102:102m [48:2:36:114:200m [48:2:15:168:205m [48:2:5:188:121m [48:2:188:63:188m [48:2:205:49:49m [48:2:229:229:229m [48:2:229:229:18m [48:2:90:92:98m [48:2:248:248:240m  +[48:2:44:43:43m[38:2:213:162:0mApple Classic [48:2:0:0:0m [48:2:2:37:199m [48:2:0:197:199m [48:2:0:194:0m [48:2:202:48:199m [48:2:201:27:0m [48:2:199:199:199m [48:2:199:196:0m [48:2:104:104:104m [48:2:104:113:255m [48:2:96:253:255m [48:2:95:250:104m [48:2:255:119:255m [48:2:255:110:103m [48:2:255:255:255m [48:2:255:252:103m [48:2:107:91:2m [48:2:199:199:199m  +[48:2:30:30:30m[38:2:255:255:255mApple System Colors [48:2:26:26:26m [48:2:8:105:203m [48:2:71:158:194m [48:2:38:164:57m [48:2:150:71:191m [48:2:204:55:46m [48:2:152:152:157m [48:2:205:172:8m [48:2:70:70:70m [48:2:10:132:255m [48:2:118:214:255m [48:2:50:215:75m [48:2:191:90:242m [48:2:255:69:58m [48:2:255:255:255m [48:2:255:214:10m [48:2:63:99:139m [48:2:152:152:157m  +[48:2:14:16:25m[38:2:255:250:244mArgonaut [48:2:35:35:35m [48:2:0:141:248m [48:2:0:216:235m [48:2:140:225:11m [48:2:109:67:166m [48:2:255:0:15m [48:2:255:255:255m [48:2:255:185:0m [48:2:68:68:68m [48:2:0:146:255m [48:2:103:255:240m [48:2:171:225:91m [48:2:154:95:235m [48:2:255:39:64m [48:2:255:255:255m [48:2:255:210:66m [48:2:0:42:59m [48:2:255:0:24m  +[48:2:28:28:28m[38:2:221:238:221mArthur [48:2:61:53:42m [48:2:100:149:237m [48:2:176:196:222m [48:2:134:175:128m [48:2:222:184:135m [48:2:205:92:92m [48:2:187:170:153m [48:2:232:174:91m [48:2:85:68:68m [48:2:135:206:235m [48:2:176:196:222m [48:2:136:170:34m [48:2:153:102:0m [48:2:204:85:51m [48:2:221:204:187m [48:2:255:167:93m [48:2:77:77:77m [48:2:226:187:239m  +[48:2:32:39:70m[38:2:151:157:180mAtelierSulphurpool [48:2:32:39:70m [48:2:61:143:209m [48:2:34:162:201m [48:2:172:151:57m [48:2:102:121:204m [48:2:201:73:34m [48:2:151:157:180m [48:2:192:139:48m [48:2:107:115:148m [48:2:137:142:164m [48:2:156:99:122m [48:2:41:50:86m [48:2:223:226:241m [48:2:199:107:41m [48:2:245:247:255m [48:2:94:102:135m [48:2:94:102:135m [48:2:151:157:180m  diff --git a/cli/testdata/margintest_nogridmode.args b/cli/testdata/margintest_nogridmode.args new file mode 100644 index 0000000..06994e8 --- /dev/null +++ b/cli/testdata/margintest_nogridmode.args @@ -0,0 +1 @@ +--marginsize 1.2x0.6 diff --git a/cli/testdata/margintest_nogridmode.svg b/cli/testdata/margintest_nogridmode.svg new file mode 100644 index 0000000..03e856d --- /dev/null +++ b/cli/testdata/margintest_nogridmode.svg @@ -0,0 +1,553 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +3024 Day +3024 Night +Aardvark Blue +Abernathy +Adventure +AdventureTime +Afterglow +Alabaster +AlienBlood +Andromeda +Apple Classic +Apple System Colors +Argonaut +Arthur +AtelierSulphurpool + diff --git a/cli/testdata/nonewline.svg b/cli/testdata/nonewline.svg index 90e8906..32cefec 100644 --- a/cli/testdata/nonewline.svg +++ b/cli/testdata/nonewline.svg @@ -15,7 +15,5 @@ } - -nonewline - +nonewline diff --git a/cli/testdata/onechar.svg b/cli/testdata/onechar.svg index 32265e5..e10ac8e 100644 --- a/cli/testdata/onechar.svg +++ b/cli/testdata/onechar.svg @@ -15,7 +15,5 @@ } - -a - +a diff --git a/cli/testdata/onecharnewline.svg b/cli/testdata/onecharnewline.svg index 32265e5..e10ac8e 100644 --- a/cli/testdata/onecharnewline.svg +++ b/cli/testdata/onecharnewline.svg @@ -15,7 +15,5 @@ } - -a - +a diff --git a/cli/testdata/oneline.svg b/cli/testdata/oneline.svg index 26517bb..3db88bb 100644 --- a/cli/testdata/oneline.svg +++ b/cli/testdata/oneline.svg @@ -15,7 +15,5 @@ } - -oneline - +oneline diff --git a/cli/testdata/params-colon-semicolon.svg b/cli/testdata/params-colon-semicolon.svg index db2c995..e4c3b01 100644 --- a/cli/testdata/params-colon-semicolon.svg +++ b/cli/testdata/params-colon-semicolon.svg @@ -22,7 +22,5 @@ - - params with mix colon semicolon red bg - + params with mix colon semicolon red bg diff --git a/cli/testdata/powerline.svg b/cli/testdata/powerline.svg index 905352b..fc4c854 100644 --- a/cli/testdata/powerline.svg +++ b/cli/testdata/powerline.svg @@ -63,10 +63,8 @@ - - patrick@zenbook ~/src/ansisvg svgscreen-rewrite ± - patrick@zenbook ~/src/ansisvg svgscreen-rewrite - patrick@zenbook ~/src/ansisvg svgscreen-rewrite - 0 9h 52m 1 zsh 2 zsh - + patrick@zenbook ~/src/ansisvg svgscreen-rewrite ± + patrick@zenbook ~/src/ansisvg svgscreen-rewrite + patrick@zenbook ~/src/ansisvg svgscreen-rewrite + 0 9h 52m 1 zsh 2 zsh diff --git a/cli/testdata/tabs.svg b/cli/testdata/tabs.svg index 2ea3ac9..fcf770d 100644 --- a/cli/testdata/tabs.svg +++ b/cli/testdata/tabs.svg @@ -15,15 +15,13 @@ } - -0 0 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6 -7 7 -8 8 - +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 diff --git a/cli/testdata/terminal-colors-n.svg b/cli/testdata/terminal-colors-n.svg index 6f3f8e1..6b07de0 100644 --- a/cli/testdata/terminal-colors-n.svg +++ b/cli/testdata/terminal-colors-n.svg @@ -532,24 +532,22 @@ - -System colors: - 0 1 2 3 4 5 6 7 - 8 9 10 11 12 13 14 15 -6x6x6 color cube and greyscale: - 16 22 28 34 40 46 52 58 64 70 76 82 88 94 100 106 112 118 - 17 23 29 35 41 47 53 59 65 71 77 83 89 95 101 107 113 119 - 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 120 - 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 - 20 26 32 38 44 50 56 62 68 74 80 86 92 98 104 110 116 122 - 21 27 33 39 45 51 57 63 69 75 81 87 93 99 105 111 117 123 -124 130 136 142 148 154 160 166 172 178 184 190 196 202 208 214 220 226 -125 131 137 143 149 155 161 167 173 179 185 191 197 203 209 215 221 227 -126 132 138 144 150 156 162 168 174 180 186 192 198 204 210 216 222 228 -127 133 139 145 151 157 163 169 175 181 187 193 199 205 211 217 223 229 -128 134 140 146 152 158 164 170 176 182 188 194 200 206 212 218 224 230 -129 135 141 147 153 159 165 171 177 183 189 195 201 207 213 219 225 231 -232 233 234 235 236 237 238 239 240 241 242 243 -244 245 246 247 248 249 250 251 252 253 254 255 - +System colors: + 0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 +6x6x6 color cube and greyscale: + 16 22 28 34 40 46 52 58 64 70 76 82 88 94 100 106 112 118 + 17 23 29 35 41 47 53 59 65 71 77 83 89 95 101 107 113 119 + 18 24 30 36 42 48 54 60 66 72 78 84 90 96 102 108 114 120 + 19 25 31 37 43 49 55 61 67 73 79 85 91 97 103 109 115 121 + 20 26 32 38 44 50 56 62 68 74 80 86 92 98 104 110 116 122 + 21 27 33 39 45 51 57 63 69 75 81 87 93 99 105 111 117 123 +124 130 136 142 148 154 160 166 172 178 184 190 196 202 208 214 220 226 +125 131 137 143 149 155 161 167 173 179 185 191 197 203 209 215 221 227 +126 132 138 144 150 156 162 168 174 180 186 192 198 204 210 216 222 228 +127 133 139 145 151 157 163 169 175 181 187 193 199 205 211 217 223 229 +128 134 140 146 152 158 164 170 176 182 188 194 200 206 212 218 224 230 +129 135 141 147 153 159 165 171 177 183 189 195 201 207 213 219 225 231 +232 233 234 235 236 237 238 239 240 241 242 243 +244 245 246 247 248 249 250 251 252 253 254 255 diff --git a/cli/testdata/terminalwidth4.svg b/cli/testdata/terminalwidth4.svg index d097d32..4181cb6 100644 --- a/cli/testdata/terminalwidth4.svg +++ b/cli/testdata/terminalwidth4.svg @@ -15,7 +15,5 @@ } - -012345689 - +012345689 diff --git a/cli/testdata/underlinedefault.svg b/cli/testdata/underlinedefault.svg index e73d9d2..f93d127 100644 --- a/cli/testdata/underlinedefault.svg +++ b/cli/testdata/underlinedefault.svg @@ -18,8 +18,6 @@ } - -under -line - +under +line diff --git a/cli/testdata/underlinenewline.svg b/cli/testdata/underlinenewline.svg index e73d9d2..f93d127 100644 --- a/cli/testdata/underlinenewline.svg +++ b/cli/testdata/underlinenewline.svg @@ -18,8 +18,6 @@ } - -under -line - +under +line diff --git a/cli/testdata/underlinetabs.svg b/cli/testdata/underlinetabs.svg index c954895..ffc26ee 100644 --- a/cli/testdata/underlinetabs.svg +++ b/cli/testdata/underlinetabs.svg @@ -25,15 +25,13 @@ - -0 0 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6 -7 7 -8 8 - +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 diff --git a/cli/testdata/underlinetabs_backgroundcolor.svg b/cli/testdata/underlinetabs_backgroundcolor.svg index 43491bf..8f1f3bc 100644 --- a/cli/testdata/underlinetabs_backgroundcolor.svg +++ b/cli/testdata/underlinetabs_backgroundcolor.svg @@ -25,15 +25,13 @@ - -0 0 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6 -7 7 -8 8 - +0 0 +1 1 +2 2 +3 3 +4 4 +5 5 +6 6 +7 7 +8 8 From 84f62e19a16b0c95e7e291c0db110133327537ba Mon Sep 17 00:00:00 2001 From: Patrick Huesmann Date: Mon, 11 Mar 2024 19:01:47 +0100 Subject: [PATCH 6/6] doc: update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7c5cff4..e5026eb 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Example usage: --grid Grid mode (sets position for each character) --help, -h Show help --listcolorschemes List color schemes +--marginsize WxH Margin size (in either pixel or font units) --transparent Transparent background --version, -v Show version --width, -w NUMBER Terminal width (auto if not set) @@ -75,6 +76,11 @@ By default, `ansisvg` uses font-relative `ch`/`em` coordinates. This should make Inkscape currently [cannot deal with SVG size expressed in font-relative units](https://gitlab.com/inkscape/inkscape/-/issues/4737), a quick workaround is Ctrl-Shift-R (resize page to content). +## Margin size + +With `--marginsize` a margin can be defined, so there is a bit of empty space (or "border") around the image. Default is zero margin size, i.e. the terminal characters are touching the edge of the image. +`--marginsize` is interpreted as X/Y in the currently selected units, i.e. `ch`/`em` by default, and `px` if `--charboxsize` is used. + ## Consolidated text vs. grid mode By default, `ansisvg` consolidates text to `` chunks, leaving the X positioning of characters to the SVG renderer. This usually works well for monospace fonts. However if not all glyphs involved are monospace (e.g. when exotic characters are used, making the SVG renderer fall back to a different font for those characters) then the alignment will be off; this can be worked around with `-grid` mode which will make `ansisvg` put each character to explicit positions, making the SVG bigger and less readable but ensuring proper positioning/alignment for all characters.