;after processing, maps are created in the output file, but you still have ;to mapipulate the final 4 lines into 2 halves and place each in each map, ;and add the urls you have in mind into them. ;Caolan McNamara (1998) caolan@skynet.ie ; Define the function: (define (script-fu-text-test inFile inFile2 inFont inFontSize inTextColor inFont2 inFontSize2 inTextColor2 inIndent inTitle inFont3 inFontSize3 inTextColor3 inTextColor4 inMaxHeight) (let* ( ; define our local vars ; create a new image: (seg (cons-array 4 'double)) (theImageWidth 10) (theImageHeight 10) (theImageWidth2 10) (theImageHeight2 10) (theImage (list (car (gimp-image-new theImageWidth theImageHeight RGB) ) (car (gimp-image-new theImageWidth theImageHeight RGB) ) (car (gimp-image-new theImageWidth theImageHeight RGB) ) )) (theImage2) (theText) (theFile) (theFile2) (theLine) (theChar) (linewidth) (lineheight) (linewidth2) (lineheight2) (linewidth3) (lineheight3) (anindent 10) (anotherindent (list 10)) (anotherindent2) (anotherindent3) (theTextList) (thetextindent) (tempindent1) (temptextlist) (value) (value2) (theextra "1") (alist) (blist) (clist) (dlist) (elist) (offsets) ; create a new layer for the image: (theLayer (list (car (gimp-layer-new (car theImage) theImageWidth theImageHeight RGB_IMAGE "layer 1" 100 NORMAL)) (car (gimp-layer-new (car (cdr theImage)) theImageWidth theImageHeight RGB_IMAGE "layer 1" 100 NORMAL)) (car (gimp-layer-new (car (cdr theImage)) theImageWidth theImageHeight RGB_IMAGE "layer 1" 100 NORMAL) ))) (theLayer2) ) ; add the new layer to the image: (set! theImage2 theImage) (set! theLayer2 theLayer) (gimp-image-add-layer (car theImage) (car theLayer) 0) ; now, set the background and foreground colors: (gimp-palette-set-background '(255 255 255) ) (gimp-palette-set-foreground inTextColor) ; clear the canvas: (gimp-selection-all (car theImage)) (gimp-edit-clear (car theImage) (car theLayer)) (gimp-selection-none (car theImage)) (set! theImageWidth 0) (set! theImageHeight 0) (set! theChar "X") (set! theLine "") (set! theFile2 (fopen inFile2 "w")) (fwrite "\n" theFile2) (set! theFile (fopen inFile)) (while (begin (set! theChar (fread 1 theFile)) (not (equal? () theChar) ) ) (if (equal? "" theLine) (if (equal? "+" theChar) (set! clist (append clist (list inFont2))) (set! clist (append clist (list inFont))) ) () ) (if (equal? "" theLine) (if (equal? "+" theChar) (set! dlist (append dlist (list 0))) (set! dlist (append dlist (list inIndent))) ) () ) (if (equal? "" theLine) (if (equal? "+" theChar) (begin (set! blist (append blist (list inFontSize2))) (set! elist (append elist (list inTextColor2))) ) (begin (set! blist (append blist (list inFontSize))) (set! elist (append elist (list inTextColor))) ) ) () ) (if (and (equal? "" theLine) (equal? "+" theChar)) (set! theChar " ") () ) (set! theLine (string-append theLine theChar)) (if (equal? "\n" theChar) (set! alist (append alist (list theLine))) () ) (if (equal? "\n" theChar) (set! theLine "") () ) ) (fclose theFile) (set! alist (append alist (list "arse"))) (set! blist (append blist (list inFontSize))) (set! clist (append clist (list inFont))) (set! dlist (append dlist (list 0))) (set! elist (append elist (list inTextColor))) (set! theImageHeight (+ 3 theImageHeight)) (if (< theImageHeight2 theImageHeight) (set! theImageHeight2 theImageHeight) () ) (set! theText (car (gimp-text (car theImage) (car theLayer) 3 theImageHeight (string-append inTitle theextra) 0 TRUE inFontSize3 PIXELS "*" inFont3 "*" "*" "*" "*"))) (set! theTextList (list (string-append inTitle theextra))) (set! thetextindent (list 3)) (if (equal? theextra "1") (set! theextra "2") () ) (if (< theImageWidth (+ 3 (car (gimp-drawable-width theText)) ) ) (begin (set! theImageWidth (+ 3 (car (gimp-drawable-width theText) ) ) ) (if (< theImageWidth2 theImageWidth) (set! theImageWidth2 theImageWidth) () ) ) () ) (set! theImageHeight (+ 6 (+ theImageHeight (car (gimp-drawable-height theText) ) ) ) ) (if (< theImageHeight2 theImageHeight) (set! theImageHeight2 theImageHeight) () ) (set! lineheight (list (- theImageHeight 3) (- theImageHeight 3))) (set! linewidth (list theImageWidth)) ; resize our image and layer: (gimp-image-resize (car theImage) theImageWidth theImageHeight 0 0) (gimp-layer-resize (car theLayer) theImageWidth theImageHeight 0 0) (while (not (= (cdr alist) ())) ; now create the text: (gimp-palette-set-foreground (car elist)) (set! theText (car (gimp-text (car theImage) (car theLayer) (car dlist) theImageHeight (car alist) 0 TRUE (car blist) PIXELS "*" (car clist) "*" "*" "*" "*"))) (set! alist (cdr alist)) (set! blist (cdr blist)) (set! clist (cdr clist)) ; get the image's new width and height (if (= (car elist) inTextColor) (begin (set! offsets (gimp-drawable-offsets theText)) (fwrite "string (+ 10 (car offsets))) theFile2) (fwrite "," theFile2) (fwrite (number->string (cadr offsets)) theFile2) (fwrite "," theFile2) (fwrite (number->string (+ 10 (+ (car (gimp-drawable-width theText)) (car offsets)))) theFile2) (fwrite "," theFile2) (fwrite (number->string (+ (car (gimp-drawable-height theText)) (cadr offsets))) theFile2) (fwrite "\" href=\"CHANGEME\">\n" theFile2) ) () ) (set! elist (cdr elist)) (if (< theImageWidth (+ (car dlist) (car (gimp-drawable-width theText)) ) ) (begin (set! theImageWidth (+ (car dlist) (car (gimp-drawable-width theText) ) ) ) (if (< theImageWidth2 theImageWidth) (set! theImageWidth2 theImageWidth) () ) ) () ) (set! dlist (cdr dlist)) (set! theImageHeight (+ 2 (+ theImageHeight (car (gimp-drawable-height theText) ) ) ) ) (if (< theImageHeight2 theImageHeight) (set! theImageHeight2 theImageHeight) () ) ; resize our image and layer: (gimp-image-resize (car theImage) theImageWidth theImageHeight 0 0) (gimp-layer-resize (car theLayer) theImageWidth theImageHeight 0 0) (if (> theImageHeight inMaxHeight) (begin (set! anotherindent (list anindent)) (gimp-display-new (car theImage)) (gimp-image-clean-all (car theImage)) (fwrite "\n\n" theFile2) (fwrite "\n" theFile2) (set! theImage (cdr theImage)) (set! theLayer (cdr theLayer)) (gimp-image-add-layer (car theImage) (car theLayer) 0) (gimp-palette-set-background '(255 255 255) ) (gimp-palette-set-foreground inTextColor) ; clear the canvas: (gimp-selection-all (car theImage)) (gimp-edit-clear (car theImage) (car theLayer)) (gimp-selection-none (car theImage)) (set! theImageHeight 0) (set! theImageWidth 0) (set! theImageHeight (+ 3 theImageHeight)) (if (< theImageHeight2 theImageHeight) (set! theImageHeight2 theImageHeight) () ) (set! anindent (+ (+ 9 anindent) (car linewidth))) (set! anotherindent (append anotherindent (list anindent))) (set! theText (car (gimp-text (car theImage) (car theLayer) (+ 12 (car linewidth)) theImageHeight (string-append inTitle theextra) 0 TRUE inFontSize3 PIXELS "*" inFont3 "*" "*" "*" "*"))) (set! theTextList (append theTextList (list (string-append inTitle theextra)))) (set! thetextindent (append thetextindent (list (+ 12 (car linewidth)) ))) (if (equal? theextra "1") (set! theextra "2") () ) (if (< theImageWidth (+ (+ 12 (car linewidth)) (car (gimp-drawable-width theText)) ) ) (set! theImageWidth (+ (+ 12 (car linewidth)) (car (gimp-drawable-width theText) ) ) ) () ) (set! theImageHeight (+ 6 (+ theImageHeight (car (gimp-drawable-height theText) ) ) ) ) (if (< theImageHeight2 theImageHeight) (set! theImageHeight2 theImageHeight) () ) (set! linewidth (append linewidth (list (- (- theImageWidth (car linewidth)) 9)))) ) () ) (gimp-image-resize (car theImage) theImageWidth theImageHeight 0 0) (gimp-layer-resize (car theLayer) theImageWidth theImageHeight 0 0) ) (fwrite "" theFile2) ; display our image: (gimp-display-new (car theImage)) ; reset the dirty flag: (gimp-image-clean-all (car theImage)) (set! linewidth (append linewidth (list 0))) (set! lineheight (append lineheight (list 0))) (set! anotherindent (append anotherindent (list 10 50 10))) (set! lineheight2 lineheight) (set! linewidth2 linewidth) (set! anotherindent2 anotherindent) (set! value2 0) (set! theTextList (append theTextList (list "arse" ))) (while (not (= (cdr theImage2) ())) (gimp-image-resize (car theImage2) (+ 20 theImageWidth2) theImageHeight2 10 0) (gimp-layer-resize (car theLayer2) (+ 20 theImageWidth2) theImageHeight2 10 0) (script-fu-border (car anotherindent) (car theImage2) (car theLayer2) theImageWidth2 theImageHeight2 (car lineheight) (car linewidth) seg) (set! lineheight3 lineheight2) (set! linewidth3 linewidth2) (set! anotherindent3 anotherindent2) (set! tempindent1 thetextindent) (set! temptextlist theTextList) (set! value 0) (while (not (= (cdr lineheight3) ())) (script-fu-box (car anotherindent3) (car theImage2) (car theLayer2) (car lineheight3) (car linewidth3) seg) (if (= value value2) (gimp-palette-set-foreground inTextColor3) (gimp-palette-set-foreground inTextColor4) ) (set! theText (car (gimp-text (car theImage2) (car theLayer2) (+ 10 (car tempindent1)) 3 (car temptextlist) 0 TRUE inFontSize3 PIXELS "*" inFont3 "*" "*" "*" "*"))) (set! offsets (gimp-drawable-offsets theText)) (fwrite "string (+ 10 (car offsets))) theFile2) (fwrite "," theFile2) (fwrite (number->string (cadr offsets)) theFile2) (fwrite "," theFile2) (fwrite (number->string (+ 10 (+ (car (gimp-drawable-width theText)) (car offsets)))) theFile2) (fwrite "," theFile2) (fwrite (number->string (+ (car (gimp-drawable-height theText)) (cadr offsets))) theFile2) (fwrite "\" href=\"CHANGEME\">\n" theFile2) (set! tempindent1 (cdr tempindent1)) (set! lineheight3 (cdr lineheight3)) (set! linewidth3 (cdr linewidth3)) (set! anotherindent3 (cdr anotherindent3)) (set! temptextlist (cdr temptextlist)) (set! value (+ 1 value)) ) (set! theImage2 (cdr theImage2)) (set! theLayer2 (cdr theLayer2)) (set! linewidth (cdr linewidth)) (set! lineheight (cdr lineheight)) (set! anotherindent (cdr anotherindent)) (set! value2 (+ 1 value2)) ) (fclose theFile2) )) ; Register the function with the GIMP: (define (script-fu-border indent inImage inLayer inWidth inHeight linex liney segment) (set! inWidth (+ inWidth 20)) (gimp-palette-set-foreground '(0 0 0)) (gimp-brushes-set-brush "Circle (01)") (aset segment 0 0.0) (aset segment 1 linex) (aset segment 2 0.0) (aset segment 3 liney) (gimp-pencil inImage inLayer 4 segment) (aset segment 0 0) (aset segment 1 linex) (aset segment 2 0) (aset segment 3 inHeight) (gimp-pencil inImage inLayer 4 segment) (aset segment 0 0.0) (aset segment 1 linex) (aset segment 2 indent ) (aset segment 3 linex) (gimp-pencil inImage inLayer 4 segment) (aset segment 0 (+ 3 (+ indent liney))) (aset segment 1 linex) (aset segment 2 inWidth) (aset segment 3 linex) (gimp-pencil inImage inLayer 4 segment) (aset segment 0 (- inWidth 1)) (aset segment 1 linex) (aset segment 2 (- inWidth 1)) (aset segment 3 inHeight) (gimp-pencil inImage inLayer 4 segment) ) (define (script-fu-box indent inImage inLayer linex liney segment) (aset segment 0 indent) (aset segment 1 0.0) (aset segment 2 indent) (aset segment 3 linex) (gimp-pencil inImage inLayer 4 segment) (aset segment 0 (+ 3 (+ indent liney))) (aset segment 1 0.0) (aset segment 2 (+ 3 (+ indent liney)) ) (aset segment 3 linex) (gimp-pencil inImage inLayer 4 segment) (aset segment 0 indent) (aset segment 1 0.0) (aset segment 2 (+ 3 (+ indent liney)) ) (aset segment 3 0.0) (gimp-pencil inImage inLayer 4 segment) ) (script-fu-register "script-fu-text-test" "/Xtns/Script-Fu/Text/homelist" "Creates superduper list for my home page http://www.csn.ul.ie/~caolan" "Caolan McNamara" "1998, Caolan McNamara" "August 25, 1998" "" SF-VALUE "In File Name:" "\"/home/caolan/gimplist\"" SF-VALUE "Out File Name:" "\"/home/caolan/gimplist.html\"" SF-VALUE "Font:" "\"urw palladio l\"" SF-VALUE "Font size:" "12" SF-COLOR "Color:" '(51 102 102) SF-VALUE "Font2:" "\"dragonwick\"" SF-VALUE "Font size2:" "13" SF-COLOR "Color2:" '(102 102 102) SF-VALUE "Indent:" "35" SF-VALUE "Title:" "\"List \"" SF-VALUE "Font3:" "\"urw chancery l\"" SF-VALUE "Font size3:" "18" SF-COLOR "Color3:" '(102 102 102) SF-COLOR "Color4:" '(153 153 153) SF-VALUE "Max Height:" "350" )