-
Notifications
You must be signed in to change notification settings - Fork 0
/
script-fu-text-box.scm
49 lines (47 loc) · 1.46 KB
/
script-fu-text-box.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(script-fu-register
"script-fu-text-box"
"Text Box"
"Creates a simple text box, sized to fit\
around the user's choice of text, font, \
font size and color."
"Michael Terry"
"copyright 1997, Michael Terry;\
2009, the GIMP Documentation Team"
"Octuber 27, 1997"
""
SF-STRING "Texto" "Texto"
SF-FONT "Fuente" "Fuente"
SF-ADJUSTMENT "Tamaño de Fuente" '(100 1 1000 1 10 0 1)
SF-COLOR "Color" '(5 41 41))
(script-fu-menu-register "script-fu-text-box" "<Image>/File/Create/Text")
(define (script-fu-text-box inText inFont inFontSize inTextColor)
(let*
((theImageWidth 10)
(theImageHeight 10)
(theImage
(car
(gimp-image-new theImageWidth theImageHeight RGB)))
(theText)
(theLayer
(car
(gimp-layer-new
theImage theImageWidth theImageHeight RGB-IMAGE "layer 1"
80 LAYER-MODE-NORMAL-LEGACY))))
(gimp-image-add-layer theImage theLayer 0)
(gimp-context-set-background '(6 97 53))
(gimp-context-set-foreground inTextColor)
(gimp-drawable-fill theLayer FILL-BACKGROUND)
(set! theText
(car
(gimp-text-fontname theImage theLayer
0 0
inText
0
TRUE
inFontSize PIXELS
"Sans")))
(set! theImageWidth (car (gimp-drawable-width theText)))
(set! theImageHeight (car (gimp-drawable-height theText)))
(gimp-image-resize theImage theImageWidth theImageHeight 0 0)
(gimp-layer-resize theLayer theImageWidth theImageHeight 0 0)
(gimp-display-new theImage)))