From cf3b6be1e61a5859ca125505918f422d09ea9f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phaneDucasse?= Date: Thu, 8 Aug 2024 11:13:59 +0200 Subject: [PATCH] strange how instable the results of asciiart are --- Chapters/BasicsOnExecution/figures/Makefile | 25 ++++++++++++ Chapters/BasicsOnExecution/figures/README.md | 36 ++++++++++++++++++ .../figures/width_0-ascii.txt | 10 +++++ .../BasicsOnExecution/figures/width_0.pdf | Bin 0 -> 12622 bytes 4 files changed, 71 insertions(+) create mode 100644 Chapters/BasicsOnExecution/figures/Makefile create mode 100644 Chapters/BasicsOnExecution/figures/README.md create mode 100644 Chapters/BasicsOnExecution/figures/width_0-ascii.txt create mode 100644 Chapters/BasicsOnExecution/figures/width_0.pdf diff --git a/Chapters/BasicsOnExecution/figures/Makefile b/Chapters/BasicsOnExecution/figures/Makefile new file mode 100644 index 0000000..f440aeb --- /dev/null +++ b/Chapters/BasicsOnExecution/figures/Makefile @@ -0,0 +1,25 @@ +# https://www.gnu.org/software/make/manual/html_node/ +# https://crates.io/crates/svgbob_cli +# https://github.com/ivanceras/svgbob?tab=readme-ov-file + +# Find all the -ascii.txt files we want to compile +# Note the single quotes around the * expressions. The shell will incorrectly expand these otherwise, but we want to send the * directly to the find command. +SRC_DIRS := . +BUILD_DIR := . +SRCS := $(shell find $(SRC_DIRS) -name '*-ascii.txt') +PDFs := $(SRCS:-ascii.txt=.pdf) + +.PHONY: default +default: all + +all: $(PDFs) + +%.svg : %-ascii.txt + svgbob_cli $< -o $@ + +%.pdf : %.svg + rsvg-convert -f pdf -o $@ $< + +.PHONY: clean +clean: + rm -rf *.svg $(PDFs) \ No newline at end of file diff --git a/Chapters/BasicsOnExecution/figures/README.md b/Chapters/BasicsOnExecution/figures/README.md new file mode 100644 index 0000000..6df081e --- /dev/null +++ b/Chapters/BasicsOnExecution/figures/README.md @@ -0,0 +1,36 @@ +# About the figures + +## Old figures: omnigraffle + +Old figures are made with omnigraffle and exported to pdf and png. +Latex output uses pdf. + +The problem with these is that keeping the same look and feel over all of these is very complicated. + +## New figures: asciiart -> svg -> pdf + +Using asciiart allows me (Guille) to keep the same look and feel in the figures. +Converting ascii art to pdf requires two command line tools: `aasvg` and `rsvg-convert` which I installed as follows in Mac: + +```bash +npm install -g aasvg +sudo apt-get install librsvg2-bin + +``` +If the previous apt-get does not work + +Notice that you should also install svgbob +``` +brew install librsvg +brew install svgbob +``` + +Figure source code is asciiart and named `*-ascii.txt`. +We then convert them to svg using the following commands. + +**TIP: Use the makefile ;)** + +``` +aasvg < x.txt > x.svg +rsvg-convert -f pdf -o x.pdf x.svg +``` \ No newline at end of file diff --git a/Chapters/BasicsOnExecution/figures/width_0-ascii.txt b/Chapters/BasicsOnExecution/figures/width_0-ascii.txt new file mode 100644 index 0000000..942d6c3 --- /dev/null +++ b/Chapters/BasicsOnExecution/figures/width_0-ascii.txt @@ -0,0 +1,10 @@ +Rectangle / #width +<01> pushRcvr: 1 --- push the value of the receiver's second instance variable (corner ) onto the stack +<7E> send: x --- send the unary message x +<00> pushRcvr: 0 --- push the value of the receiver's first instance variable (origin ) onto the stack +<7E> send: x --- send the unary message x +<61> send: - --- send the binary message - +<5C> returnTop - return the object on top of the stack as the value of the message (width ) + + + diff --git a/Chapters/BasicsOnExecution/figures/width_0.pdf b/Chapters/BasicsOnExecution/figures/width_0.pdf new file mode 100644 index 0000000000000000000000000000000000000000..65d203b988e2e61e342453e96aa6da13e3f78b7e GIT binary patch literal 12622 zcmbW81yodB8}C6n1O%mH=!O|!h@m^ByQI6MI~0(TlvY3xq#LADxp|h!&sjdrQ95k97y!Qzej&2V9UnU?ht zK%*eMbaqYDZ#I4jACHZwO0L-(LTa-#3)JqVS|HeO<>kU>N|_gpgrmMm>@X{NBX>D& zg^S!fkb;Pp@djhNn^E#}Pv3g&&jZ`{VX9b`UyPBLoZcgk_(o;wQ(T?FQCvGJ-Ie-R zdyFwn{1Ax!_7N>s(Td`@OlYlA$RtJRJx>64DgzeYo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