I've written a python function to simulate the effect of typing on a GIF , which works except for special characters like tildes and eñes.
Function
def efecto_escritura(x, y, color,texto):
texto_completo = texto
ultimo_texto=''
imagen_inicial = gimp.image_list()[0]
#Color del texto
gimp.set_foreground(color)
# Parámetros Fuente
fontname= 'Sans' #Tipo de letra
size_type=PIXELS
size= 30 #Tamaño
antialias = True
border = 0
#y = 0
#x = 0
drawable = None
image = imagen_inicial
for i in texto_completo:
ultimo_texto=ultimo_texto+i
layer = pdb.gimp_text_fontname(image, drawable, x, y, ultimo_texto, border, antialias, size, size_type, fontname)
print(ultimo_texto)
Use
Run in GIMP's "Python Console"
efecto_escritura(58,209,(255, 255, 255), 'Stackoverflow en español')
Error message
Calling error for procedure 'gimp-text-fontname': Procedure 'gimp-text-fontname' has been called with value 'Stackoverflow en espaÃ' for argument 'text' (#5, type gchararray). This value is out of range.
Ambient
OS: Windows 10
Python-GIMP:
print(sys.version)
2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
If the GIMP console handles UTF-8 characters well, using the Unicode literal will suffice . That is, instead of doing this:
Simply change it to this:
The difference is in the
u
front of the quotes.1) Encode:
2) Decode
Reference: https://docs.python.org/2/howto/unicode.html