Render the specified text by default, added optional font labels.
2003-09-04 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/scripts/font-map.scm (script-fu-font-map): Render the specified text by default, added optional font labels.
This commit is contained in:

committed by
Sven Neumann

parent
e2e049080b
commit
5ada4dfab8
@ -1,3 +1,8 @@
|
|||||||
|
2003-09-04 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/script-fu/scripts/font-map.scm (script-fu-font-map):
|
||||||
|
Render the specified text by default, added optional font labels.
|
||||||
|
|
||||||
2003-09-04 Michael Natterer <mitch@gimp.org>
|
2003-09-04 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/core/gimpchannel.[ch]: removed gimp_channel_load().
|
* app/core/gimpchannel.[ch]: removed gimp_channel_load().
|
||||||
|
@ -41,33 +41,63 @@
|
|||||||
maxheight))
|
maxheight))
|
||||||
|
|
||||||
|
|
||||||
(define (script-fu-font-map text use-name font-filter font-size border)
|
(define (script-fu-font-map text use-name labels font-filter font-size border)
|
||||||
(let* ((font "")
|
(let* ((font "")
|
||||||
(count 0)
|
(count 0)
|
||||||
(font-list (cadr (gimp-fonts-get-list font-filter)))
|
(font-list (cadr (gimp-fonts-get-list font-filter)))
|
||||||
(num-fonts (length font-list))
|
(num-fonts (length font-list))
|
||||||
(maxheight (max-font-height text use-name font-list font-size))
|
(label-size (/ font-size 2))
|
||||||
(maxwidth (max-font-width text use-name font-list font-size))
|
(border (+ border (* labels (/ label-size 2))))
|
||||||
(width (+ maxwidth (* 2 border)))
|
(y border)
|
||||||
(height (+ (* maxheight num-fonts) (* 2 border)))
|
(maxheight (max-font-height text use-name font-list font-size))
|
||||||
(img (car (gimp-image-new width height GRAY)))
|
(maxwidth (max-font-width text use-name font-list font-size))
|
||||||
(drawable (car (gimp-layer-new img width height GRAY_IMAGE
|
(width (+ maxwidth (* 2 border)))
|
||||||
"Background" 100 NORMAL))))
|
(height (+ (+ (* maxheight num-fonts) (* 2 border))
|
||||||
|
(* labels (* label-size num-fonts))))
|
||||||
|
(img (car (gimp-image-new width height GRAY)))
|
||||||
|
(drawable (car (gimp-layer-new img width height GRAY-IMAGE
|
||||||
|
"Background" 100 NORMAL-MODE))))
|
||||||
(gimp-image-undo-disable img)
|
(gimp-image-undo-disable img)
|
||||||
|
(gimp-edit-clear drawable)
|
||||||
(gimp-image-add-layer img drawable 0)
|
(gimp-image-add-layer img drawable 0)
|
||||||
(gimp-edit-fill drawable BG-IMAGE-FILL)
|
|
||||||
|
(if (= labels TRUE)
|
||||||
|
(begin
|
||||||
|
(set! drawable (car (gimp-layer-new img width height GRAYA-IMAGE
|
||||||
|
"Labels" 100 NORMAL-MODE)))
|
||||||
|
(gimp-edit-clear drawable)
|
||||||
|
(gimp-image-add-layer img drawable -1)))
|
||||||
|
|
||||||
(while font-list
|
(while font-list
|
||||||
(set! font (car font-list))
|
(set! font (car font-list))
|
||||||
(set! font-list (cdr font-list))
|
(set! font-list (cdr font-list))
|
||||||
|
|
||||||
(if (= use-name TRUE)
|
(if (= use-name TRUE)
|
||||||
(set! text font))
|
(set! text font))
|
||||||
|
|
||||||
(gimp-text-fontname img -1
|
(gimp-text-fontname img -1
|
||||||
border
|
border
|
||||||
(+ border (* count maxheight))
|
y
|
||||||
text
|
text
|
||||||
0 TRUE font-size PIXELS
|
0 TRUE font-size PIXELS
|
||||||
font)
|
font)
|
||||||
|
|
||||||
|
(set! y (+ y maxheight))
|
||||||
|
|
||||||
|
(if (= labels TRUE)
|
||||||
|
(begin
|
||||||
|
(gimp-floating-sel-anchor (car (gimp-text-fontname img drawable
|
||||||
|
(- border
|
||||||
|
(/ label-size 2))
|
||||||
|
(- y
|
||||||
|
(/ label-size 2))
|
||||||
|
font
|
||||||
|
0 TRUE
|
||||||
|
label-size PIXELS
|
||||||
|
"Sans")))
|
||||||
|
(set! y (+ y label-size))))
|
||||||
|
|
||||||
|
|
||||||
(set! count (+ count 1)))
|
(set! count (+ count 1)))
|
||||||
|
|
||||||
(gimp-image-set-active-layer img drawable)
|
(gimp-image-set-active-layer img drawable)
|
||||||
@ -82,7 +112,8 @@
|
|||||||
"1997"
|
"1997"
|
||||||
""
|
""
|
||||||
SF-STRING _"Text" "How quickly daft jumping zebras vex."
|
SF-STRING _"Text" "How quickly daft jumping zebras vex."
|
||||||
SF-TOGGLE _"Use Font Name as Text" TRUE
|
SF-TOGGLE _"Use Font Name as Text" FALSE
|
||||||
|
SF-TOGGLE _"Labels" TRUE
|
||||||
SF-STRING _"Filter (regexp)" "Sans"
|
SF-STRING _"Filter (regexp)" "Sans"
|
||||||
SF-ADJUSTMENT _"Font Size (pixels)" '(32 2 1000 1 10 0 1)
|
SF-ADJUSTMENT _"Font Size (pixels)" '(32 2 1000 1 10 0 1)
|
||||||
SF-ADJUSTMENT _"Border (pixels)" '(10 0 200 1 10 0 1))
|
SF-ADJUSTMENT _"Border (pixels)" '(10 0 200 1 10 0 1))
|
||||||
|
Reference in New Issue
Block a user