Post Reply 

newline in a text layer

Feb 12, 2012, 16:28
Post: #1
newline in a text layer
One of the button creation plugins creates a text layer using gimp_text_layer_new which takes a gchar * parameter. How do I insert a newline? I tried '\n' in the string and got a striked-through 'W'. Thank you.
Find all posts by this user
Quote this message in a reply
Feb 12, 2012, 16:43
Post: #2
RE: newline in a text layer
What language are you using? C? Never tried that one. IIRC Gimp uses UTF-8 encoded strings so maybe you \n was grouped with a previous byte?

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Feb 12, 2012, 19:41
Post: #3
RE: newline in a text layer
(Feb 12, 2012 16:43)ofnuts Wrote:  What language are you using? C? Never tried that one. IIRC Gimp uses UTF-8 encoded strings so maybe you \n was grouped with a previous byte?

The button plugin is Python-Fu. The current button text is retrieved using PF_STRING, but I was wondering whether PF_TEXT would work, but more important is what gimp_text_layer_new does with the value. Is there an escape sequence for newline.

I suppose I could download the source to gimp and figure out what the function does, but was hoping it was some bit of common knowledge I was missing. Several comments on the different button plugins asked about multi-line text, but no one had replied to them.
Find all posts by this user
Quote this message in a reply
Feb 12, 2012, 20:49
Post: #4
RE: newline in a text layer
PF_TEXT does work. But if the plugin uses PF_STRING, you can try this trick
  • Start you usual text editor (Notepad or else)
  • Enter you text on several lines
  • Select/All and Copy (Ctrl-A, Ctrl-C)
  • In the Gimp plugin dialog, paste in to the PF_STRING input field
  • Proceed with the plugin

Work OK on Linux (only LF's), on Windows (with CRLF) it has to be tested... There is also no guarantee that the plugin will behave correctly even if it generates a multi-line button.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Feb 13, 2012, 00:52
Post: #5
RE: newline in a text layer
That worked! Great. Thank you! And it was Windows 7.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 180 Aug 31, 2017 14:32
Last Post: Bertholomäus
  Setting text markup from python script Burbly 1 392 Sep 16, 2014 12:29
Last Post: Burbly
  Accented characters wihtin "text string" prevent script from loading Shadowes 1 279 Aug 28, 2014 15:37
Last Post: Shadowes
  Change menuitem text in plugin Barbie 1 301 Aug 11, 2014 03:16
Last Post: Barbie
  Getting Layer Effects on GIMP 2.8 for Mac Q A 4 984 May 28, 2014 23:58
Last Post: Esper

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS