diff --git a/HACKING b/HACKING index 7c8aa06..483c155 100644 --- a/HACKING +++ b/HACKING @@ -1,10 +1,10 @@ # -*- mode: org; coding: utf-8; -*- -#+TITLE: Hacking guile-gaart +#+TITLE: Hacking guile-guart * Contributing -By far the easiest way to hack on guile-gaart is to develop using Guix: +By far the easiest way to hack on guile-guart is to develop using Guix: #+BEGIN_SRC bash # Obtain the source code diff --git a/Makefile.am b/Makefile.am index c52215f..5e339cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,9 +23,9 @@ SUFFIXES = .scm .go .scm.go: $(AM_V_GEN)$(top_builddir)/pre-inst-env $(GUILE_TOOLS) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<" -SOURCES = gaart.scm \ - gaart/draw.scm \ - gaart/buffer.scm +SOURCES = guart.scm \ + guart/draw.scm \ + guart/buffer.scm TESTS = @@ -43,7 +43,7 @@ AM_SCM_LOG_FLAGS = --no-auto-compile -L "$(top_srcdir)" AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" -info_TEXINFOS = doc/guile-gaart.texi +info_TEXINFOS = doc/guile-guart.texi EXTRA_DIST = README.org \ HACKING \ diff --git a/README.org b/README.org index f88a4e5..868a47e 100644 --- a/README.org +++ b/README.org @@ -1,8 +1,8 @@ # -*- mode: org; coding: utf-8; -*- -#+TITLE: README for Guile Gaart +#+TITLE: README for Guile Guart -~guile-gaart~ is a library for making art with ascii (and unicode!) characters +~guile-guart~ is a library for making art with unicode characters. This library is heavily inspired by the Racket library ~raart~. However, some aspects have been modernized and made to support Unicode better. The library is also more designed around making rich text interfaces than the original, so styles will be defined in a different way. diff --git a/configure.ac b/configure.ac index ffe61d4..130a0bd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ dnl -*- Autoconf -*- -AC_INIT(guile-gaart, 0.1) +AC_INIT(guile-guart, 0.1) AC_SUBST(HVERSION, "\"0.1\"") AC_SUBST(AUTHOR, "\"Vivanne Langdon\"") AC_SUBST(COPYRIGHT, "'(2024)") AC_SUBST(LICENSE, gpl3+) -AC_CONFIG_SRCDIR(gaart.scm) +AC_CONFIG_SRCDIR(guart.scm) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.12 foreign silent-rules subdir-objects color-tests parallel-tests -Woverride -Wno-portability]) AM_SILENT_RULES([yes]) diff --git a/doc/guile-gaart.texi b/doc/guie-guart.texi similarity index 83% rename from doc/guile-gaart.texi rename to doc/guie-guart.texi index 81dc7b9..b1ffcb1 100644 --- a/doc/guile-gaart.texi +++ b/doc/guie-guart.texi @@ -2,9 +2,9 @@ @c -*-texinfo-*- @c %**start of header -@setfilename gaart.info +@setfilename guart.info @documentencoding UTF-8 -@settitle Gaart Reference Manual +@settitle Guart Reference Manual @c %**end of header @include version.texi @@ -22,11 +22,11 @@ Documentation License''. @dircategory The Algorithmic Language Scheme @direntry -* Gaart: (gaart). +* Guart: (guart). @end direntry @titlepage -@title The Gaart Manual +@title The Guart Manual @author Vivianne Langdon @page @@ -41,12 +41,12 @@ Edition @value{EDITION} @* @c ********************************************************************* @node Top -@top Gaart +@top Guart -This document describes Gaart version @value{VERSION}. +This document describes Guart version @value{VERSION}. @menu -* Introduction:: Why Gaart? +* Introduction:: Why Guart? @end menu @c ********************************************************************* diff --git a/gaart.scm b/guart.scm similarity index 85% rename from gaart.scm rename to guart.scm index b58b3d3..4a457f4 100644 --- a/gaart.scm +++ b/guart.scm @@ -1,4 +1,4 @@ -(define-module (gaart) +(define-module (guart) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-1) #:use-module (ice-9 match) @@ -7,11 +7,11 @@ #:use-module (uniseg graphemes) #:use-module (uniseg graphemes stream) #:use-module (uniseg graphemes iterator) - #:export ( - gaart? - gaart-w - gaart-h - gaart-draw + #:export ( + guart? + guart-w + guart-h + guart-draw blank char text @@ -43,23 +43,23 @@ (< a-y1 b-y2) (> a-y2 b-y1))) -(define-immutable-record-type - (gaart w h draw) - gaart? - (w gaart-w) - (h gaart-h) - (draw gaart-draw)) +(define-immutable-record-type + (guart w h draw) + guart? + (w guart-w) + (h guart-h) + (draw guart-draw)) (define* (blank #:optional (w 0) (h 1)) - (gaart w h (λ (okay? blit! rpos cpos) #f))) + (guart w h (λ (okay? blit! rpos cpos) #f))) (define (char ch) (define grapheme (char->grapheme ch)) (unless grapheme (scm-error 'convert-failure "char" "Unable to convert ~s to a valid unicode grapheme" (list ch) (list ch))) - (gaart + (guart 1 1 (λ (okay? blit! rpos cpos) (blit! rpos cpos grapheme) @@ -73,7 +73,7 @@ (if halign (vappend* (map text (string-split str #\newline)) #:halign halign) (scm-error 'keyword-argument-error "text" "String contained newlines but no halign argument was set" '() (list halign))) - (gaart + (guart (string-width str) 1 (λ (okay? blit! rpos cpos) ;; Go through each grapheme, print it and advance the position @@ -87,24 +87,24 @@ #f)))) (define (place-at back row-offset col-offset front) - (match-let ((($ bw bh draw-b) back) - (($ fw fh draw-f) front)) - (gaart bw bh + (match-let ((($ bw bh draw-b) back) + (($ fw fh draw-f) front)) + (guart bw bh (λ (okay? blit! rpos cpos) (or (draw-b okay? blit! rpos cpos) (draw-f okay? blit! (+ rpos row-offset) (+ cpos col-offset))))))) (define (matte-at matte-width matte-height cpos rpos x) - (match-let ((($ xw xh _) x)) + (match-let ((($ xw xh _) x)) (unless (and (<= (+ xw cpos) matte-width) (<= (+ xh rpos) matte-height)) (scm-error 'matte-error "matte-at" "Original (~ax~a@~a,~a) must fit inside matte (~ax~a)" (list xw xh cpos rpos matte-width matte-height) (list x))) (place-at (blank matte-width matte-height) rpos cpos x))) (define* (matte matte-width matte-height x #:key (halign 'center) (valign 'center)) - (define width (or matte-width (gaart-w x))) - (define height (or matte-height (gaart-h x))) - (match-let ((($ xw xh draw-x) x)) + (define width (or matte-width (guart-w x))) + (define height (or matte-height (guart-h x))) + (match-let ((($ xw xh draw-x) x)) (unless (and (<= xw width) (<= xh height)) (scm-error 'matte-error "matte" "Original (~ax~a) must fit inside matte (~ax~a)" (list xw xh width height) (list x))) @@ -121,20 +121,20 @@ x))) (define (inset width-offset height-offset x) - (match-let ((($ xw xh _) x)) + (match-let ((($ xw xh _) x)) (matte (+ width-offset xw width-offset) (+ height-offset xh height-offset) x #:halign 'center #:valign 'center))) (define (translate row-offset col-offset x) - (match-let ((($ xw xh _) x)) + (match-let ((($ xw xh _) x)) (matte-at (+ xw col-offset) (+ xh row-offset) col-offset row-offset x))) (define (mask mask-cpos mask-width mask-rpos mask-height x) - (match-let ((($ xw xh draw-x) x)) - (gaart xw xh + (match-let ((($ xw xh draw-x) x)) + (guart xw xh (λ (okay? blit! rpos cpos) (draw-x ;; okay? function definition for this art @@ -150,8 +150,8 @@ (define (crop crop-cpos crop-width crop-rpos crop-height x) (define mask-x (mask crop-cpos crop-width crop-rpos crop-height x)) - (match-let ((($ _ _ draw-m) mask-x)) - (gaart + (match-let ((($ _ _ draw-m) mask-x)) + (guart crop-width crop-height (λ (okay? blit! rpos cpos) @@ -165,16 +165,16 @@ rpos cpos))))) (define (if-drawn func x) - (match-let ((($ xw xh draw-x) x)) - (gaart xw xh + (match-let ((($ xw xh draw-x) x)) + (guart xw xh (λ (okay? blit! rpos cpos) (define ? (draw-x okay? blit! rpos cpos)) (when ? (func rpos cpos )) ?)))) (define (place-cursor-after x cursor-rpos cursor-cpos) - (match-let ((($ xw xh draw-x) x)) - (gaart xw xh + (match-let ((($ xw xh draw-x) x)) + (guart xw xh (λ (okay? blit! rpos cpos) (or (draw-x okay? blit! rpos cpos) (blit! cursor-rpos cursor-cpos #f)))))) @@ -186,11 +186,11 @@ (item item))) (define* (*vappend2 y x #:key (reverse? #f)) - (match-let ((($ xw xh draw-x) x) - (($ yw yh draw-y) y)) + (match-let ((($ xw xh draw-x) x) + (($ yw yh draw-y) y)) (unless (= xw yw) (scm-error 'append-error "vappend2" "Widths must be equal: ~a vs ~a" (list xw yw) (list xw yw))) - (gaart + (guart xw (+ xh yh) (λ (okay? blit! rpos cpos) (define (dx) (draw-x okay? blit! rpos cpos)) @@ -203,8 +203,8 @@ (cond ((not halign) (*vappend2 y x #:reverse? reverse?)) (else - (match-let ((($ xw xh draw-x) x) - (($ yw yh draw-y) y)) + (match-let ((($ xw xh draw-x) x) + (($ yw yh draw-y) y)) (define new-width (max xw yw)) (define x-paint (matte new-width xh x #:halign halign)) (define y-paint (matte new-width yh y #:halign halign)) @@ -217,11 +217,11 @@ (apply vappend (car rs) #:halign halign #:reverse? reverse? (cdr rs))) (define* (*happend2 y x #:key (reverse? #f)) - (match-let ((($ xw xh draw-x) x) - (($ yw yh draw-y) y)) + (match-let ((($ xw xh draw-x) x) + (($ yw yh draw-y) y)) (unless (= xh yh) (scm-error 'append-error "happend2" "Heights must be equal: ~a vs ~a" (list xh yh) (list xh yh))) - (gaart + (guart (+ xw yw) xh (λ (okay? blit! rpos cpos) (define (dx) (draw-x okay? blit! rpos cpos)) @@ -235,8 +235,8 @@ (cond ((not valign) (*happend2 y x #:reverse? reverse?)) (else - (match-let ((($ xw xh draw-x) x) - (($ yw yh draw-y) y)) + (match-let ((($ xw xh draw-x) x) + (($ yw yh draw-y) y)) (define new-height (max xh yh)) (define x-paint (matte xw new-height x #:valign valign)) (define y-paint (matte yw new-height y #:valign valign)) @@ -262,7 +262,7 @@ (bottom-right #\┘) (horiz-line #\─) (vert-line #\│)) - (match-let* ((($ width height _) x) + (match-let* ((($ width height _) x) (hl (hline width #:ch horiz-line)) (vl (vline height #:ch vert-line)) (bl (blank width height))) diff --git a/gaart/buffer.scm b/guart/buffer.scm similarity index 99% rename from gaart/buffer.scm rename to guart/buffer.scm index ff988da..b0e9b5c 100644 --- a/gaart/buffer.scm +++ b/guart/buffer.scm @@ -1,4 +1,4 @@ -(define-module (gaart buffer) +(define-module (guart buffer) #:use-module (uniseg graphemes) #:use-module (srfi srfi-43) #:export (make-buffer diff --git a/gaart/draw.scm b/guart/draw.scm similarity index 77% rename from gaart/draw.scm rename to guart/draw.scm index 845de19..bfaede1 100644 --- a/gaart/draw.scm +++ b/guart/draw.scm @@ -1,6 +1,6 @@ -(define-module (gaart draw) - #:use-module (gaart) - #:use-module (gaart buffer) +(define-module (guart draw) + #:use-module (guart) + #:use-module (guart buffer) #:use-module (ice-9 match) #:export (draw-here)) @@ -8,7 +8,7 @@ (unless port (set! port (current-output-port))) - (match-let* ((($ w h draw) ga) + (match-let* ((($ w h draw) ga) (buf (make-buffer w h)) (okay? (λ (width height rpos cpos) #t)) (blit! (λ (rpos cpos grapheme) diff --git a/guix.scm b/guix.scm index 5c39d4b..8c42fe4 100644 --- a/guix.scm +++ b/guix.scm @@ -14,7 +14,7 @@ (srfi srfi-1)) (package - (name "guile-gaart") + (name "guile-guart") (version "0.1") (source (local-file @@ -36,5 +36,5 @@ (description "A library for drawing visual elements to the terminal in a composable way.") (home-page - "https://git.solarpunk.moe/solarpunk-guile/guile-gaart") + "https://git.solarpunk.moe/solarpunk-guile/guile-guart") (license license:gpl3+))