; LCD Text ; ; Matthias Cramer ; (define (my-fontbox inLen inChar) (let* ( (theBGText "") (theLoop 0) ) (while (< theLoop inLen) (set! theBGText (string-append theBGText inChar)) (set! theLoop (+ theLoop 1)) ) (set! theBGText theBGText) ) ) (define (script-fu-lcd-text inText inFontSize inOffset) (let* ( ;local variables ;create a new image: (theImageWidth 10) (theImageHeight 10) (theImage (car (gimp-image-new theImageWidth theImageHeight RGB) ) ) ; theText is a declaration for the text we create later (theText) (theTextLength) ; create a new layer for the image: (theBackground (car (gimp-layer-new theImage theImageWidth theImageHeight RGB_IMAGE "Background" 100 NORMAL) )) (theBoxes (car (gimp-layer-new theImage theImageWidth theImageHeight RGB_IMAGE "Boxes" 100 NORMAL) )) (theTextLayer (car (gimp-layer-new theImage theImageWidth theImageHeight RGB_IMAGE "Text" 100 NORMAL) )) ; end of our local variables ) (gimp-image-add-layer theImage theBackground 0) (gimp-image-add-layer theImage theBoxes 0) (gimp-image-add-layer theImage theTextLayer 0) (gimp-palette-set-background '(100 241 35) ) (gimp-layer-add-alpha theBoxes) (gimp-layer-add-alpha theTextLayer) (gimp-palette-set-foreground '(0 0 0) ) (gimp-selection-all theImage) (gimp-edit-clear theImage theBackground) (gimp-edit-clear theImage theBoxes) (gimp-edit-clear theImage theTextLayer) (gimp-selection-none theImage) (set! theText (car (gimp-text-ext theImage theTextLayer inOffset inOffset inText 0 FALSE inFontSize PIXELS "misc" "fixed" "medium" "r" "semicondensed" "c" "*" "8"))) (set! theImageWidth (+ (car (gimp-drawable-width theText) ) (* inOffset 2) ) ) (set! theImageHeight (+ (car (gimp-drawable-height theText) ) (* inOffset 2) ) ) (gimp-image-resize theImage theImageWidth theImageHeight 0 0) (gimp-layer-resize theBackground theImageWidth theImageHeight 0 0) (gimp-layer-resize theBoxes theImageWidth theImageHeight 0 0) (gimp-layer-resize theTextLayer theImageWidth theImageHeight 0 0) (gimp-floating-sel-anchor theText) (set! theTextLength (length inText)) (gimp-palette-set-foreground '(100 211 35) ) (set! theText (car (gimp-text-ext theImage theBoxes inOffset inOffset (my-fontbox theTextLength "O") 0 FALSE inFontSize PIXELS "misc" "fixed" "medium" "r" "semicondensed" "c" "*" "8"))) (gimp-floating-sel-anchor theText) (set! theText (car (gimp-text-ext theImage theBoxes inOffset inOffset (my-fontbox theTextLength "N") 0 FALSE inFontSize PIXELS "misc" "fixed" "medium" "r" "semicondensed" "c" "*" "8"))) (gimp-floating-sel-anchor theText) (set! theText (car (gimp-text-ext theImage theBoxes inOffset inOffset (my-fontbox theTextLength "T") 0 FALSE inFontSize PIXELS "misc" "fixed" "medium" "r" "semicondensed" "c" "*" "8"))) (gimp-floating-sel-anchor theText) (set! theText (car (gimp-text-ext theImage theBoxes inOffset inOffset (my-fontbox theTextLength "I") 0 FALSE inFontSize PIXELS "misc" "fixed" "medium" "r" "semicondensed" "c" "*" "8"))) (gimp-floating-sel-anchor theText) (set! theText (car (gimp-text-ext theImage theBoxes inOffset inOffset (my-fontbox theTextLength "J") 0 FALSE inFontSize PIXELS "misc" "fixed" "medium" "r" "semicondensed" "c" "*" "8"))) (gimp-floating-sel-anchor theText) (gimp-display-new theImage) ; Clear dirty Flag (gimp-image-clean-all theImage) ) ) ; Register the function with the GIMP: (script-fu-register "script-fu-lcd-text" "/Xtns/Script-Fu/Logos/LCD" "Creates a line of Text that looks like a LC Display (Recommended Font sizes are 12 24 40 80)" "Matthias Cramer" "Copyright 1998, Matthias Cramer" "November 30, 1998" "" SF-VALUE "Text:" "\"LCD 123\"" SF-VALUE "Font size:" "40" SF-VALUE "Border Size (Pixels):" "5" )