Yes, you are close. The biggest problem in what you have so far is with the line:
(gimp-context-push);; keep-settings in variables
because it is a procedure and it should not be in the binding block of your let*
statement. Your code is, in effect, defining a new variable named 'gimp-context-push' which replaces the procedure (for the duration of the let*
The following line:
(new-fg (gimp-context-set-foreground '(0 0 0)))
is also somewhat unorthodox (though it is functionally OK). The 'gimp-context-set-foreground' procedure doesn't really return any useful value and there is no reason to keep it in a variable. You should just call the procedure after you've declared all of your variables (and after you've pushed the context).
The rest of your non-commented code is mostly satisfactory, however, the names of 'image-x', 'image-y', 'image-width', and 'image-height' seem a little confusing because they are actually the offsets and dimensions of the text layer
(not the image). I am guessing that you eventually wish to resize your image to fit whatever text is created (for a particular font and size) -- so perhaps your choice of names is not so bad.
Also, it is unclear what the value of 'drawable' is when you call the procedure 'gimp-layer-new-from-drawable' to create your bottom, bump, and shadow layers, but I'd guess you intend the original to be your 'text-layer'. It should be noted that after creating each of these layers, it is necessary to add them to the image using 'gimp-image-add-layer'.
Also, you most likely should use 'gimp-drawable-fill' or 'gimp-edit-fill', rather than 'gimp-edit-bucket-fill' (especially since you don't appear to have a selection present).
Here is some sample code which may be useful.
Edited to correct misspelling of Graechan's name.
(define (script-fu-graechan-text text color font font-size pattern)
(let* ((image (car (gimp-image-new 256 256 RGB)))
(text-layer (car (gimp-text-fontname image
(text-width (car (gimp-drawable-width text-layer)))
(text-height (car (gimp-drawable-height text-layer)))
(set! pattern-layer (car (gimp-layer-new image
(gimp-drawable-fill pattern-layer PATTERN-FILL)
(gimp-image-add-layer image pattern-layer 1)
"Graechan Pattern Text..."
"Create an image with a text layer over a pattern layer"
SF-STRING "Text" "Hello world!"
SF-COLOR "Text color" '(0 0 0)
SF-FONT "Font" "Sans Bold"
SF-ADJUSTMENT "Font size (pixels)" '(22 6 200 1 1 0 1)
SF-PATTERN "Pattern" "Pine"