Post Reply 

gimp-text-get-extents-fontname -- pass literal '\'

Mar 11, 2012, 11:51
Post: #1
gimp-text-get-extents-fontname -- pass literal '\'
Hello I've developed a GNU I/O FIFOed interface toward Gimp's functionalities; one of the interface function passes a text string to the plugin gimp-text-get-extents-fontname and receives the extents elaborated by Gimp.
I noticed that in this plugin escape characters do exist and are attributed to '\'; for eg. newline is \n. But a literal '\' doesn't seem possible to be passed, even prefixing it with another '\'.
How can '\' pass thru, or better, is there a table with all the recognized escapes?
Thank you.
Find all posts by this user
Quote this message in a reply
Mar 11, 2012, 12:59 (This post was last modified: Mar 11, 2012 13:01 by ofnuts.)
Post: #2
RE: gimp-text-get-extents-fontname -- pass literal '\'
Hmm... I've unraveled the call chain in the source code, and I don't see any place where the text is un-escaped before being passed to pango_layout_set_text() in the pango library, and I can't find any documented evidence that this library is supposed to unescape the text.

Are you really seeing escapes at the interpreter string literal level ("\n") or at the plugin text contents level ("\\n")?

PS: By the way, are you Scheming or Pythoning? Can you post a code extract?

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
Mar 11, 2012, 14:03
Post: #3
RE: gimp-text-get-extents-fontname -- pass literal '\'
My interface is literally attached to the standard input/output of the 'gimp-console' program; that is, by redirection.
Find all posts by this user
Quote this message in a reply
Mar 11, 2012, 15:10 (This post was last modified: Mar 11, 2012 15:29 by ofnuts.)
Post: #4
RE: gimp-text-get-extents-fontname -- pass literal '\'
OK, so one can still wonder if the escaping is done in gimp-console or by whatever reads in the text. But since you didn't answer if this is Python or Scheme. Can you show you typical input?

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
Mar 11, 2012, 15:57 (This post was last modified: Mar 11, 2012 16:11 by Davide.)
Post: #5
RE: gimp-text-get-extents-fontname -- pass literal '\'
Sorry if I wasn't clear. The language is neither Scheme or Python. It's a Bash script connected to the I/O of gimp-console, writing and reading text directly into the terminal, like if it was a user typing into and reading, so any text processing/pre-processing is performed in the same way as it is for a human interactively using gimp-console, or gimp --no-interface.

EDIT: gimp-console (or gimp --no-interface) can run only Scheme (at least it seems).
Find all posts by this user
Quote this message in a reply
Mar 11, 2012, 16:11
Post: #6
RE: gimp-text-get-extents-fontname -- pass literal '\'
gimp --no-interface isn't for entering commands... it's typically used for batch scripts. As far as I know (and as far as I can test on my Linux system) Gimp doesn't even read standard input when used that way. Where did you find this thing documented? And can you post the kind of commands you are entering in such a mode?

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
Mar 11, 2012, 17:04
Post: #7
RE: gimp-text-get-extents-fontname -- pass literal '\'
(Mar 11, 2012 16:11)ofnuts Wrote:  As far as I know (and as far as I can test on my Linux system) Gimp doesn't even read standard input when used that way.
Of course it does.

(Mar 11, 2012 16:11)ofnuts Wrote:  Where did you find this thing documented?
I'm afraid nowhere at all.

(Mar 11, 2012 16:11)ofnuts Wrote:  And can you post the kind of commands you are entering in such a mode?
Exactly the same Scheme interpreted by the script-foo Gimp's window, but for the sake of clarity:
[Image: 13314852683897-Screenshot-031112-17:38:08.png]

I forgot to mention that among the command-line options there is '-b -'.
Also, gimp --version GNU Image Manipulation Program version 2.6.10
Find all posts by this user
Quote this message in a reply
Mar 11, 2012, 18:24
Post: #8
RE: gimp-text-get-extents-fontname -- pass literal '\'
(Mar 11, 2012 17:04)Davide Wrote:  I forgot to mention that among the command-line options there is '-b -'.
Oops, you just forgot to mention you were on another planet Smile

OK , so
1) --no-interface has nothing to do with the problem
2) You are just telling Gimp to run a batch file that happens to be stdin (-b -)
3) You are indeed using Scheme (there is another parameter to specify a different interpreter (such as Python) for the batch).

So, yes, it's the Scheme interpreter handling of strings which seems to be the problem. The actual syntax for arbitrary character is a bit more complicated in Scheme than you thing (even if "\\" ought to work it seems).

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
Mar 11, 2012, 18:48
Post: #9
RE: gimp-text-get-extents-fontname -- pass literal '\'
Thank you; Scheme's escapes are as simple as http://sisc-scheme.org/manual/html/ch03.html#Strings , among those there is '\\'.

Who is in charge for this? and bug report board?
Find all posts by this user
Quote this message in a reply
Mar 11, 2012, 20:07
Post: #10
RE: gimp-text-get-extents-fontname -- pass literal '\'
Quote:Thank you; Scheme's escapes are as simple as http://sisc-scheme.org/manual/html/ch03.html#Strings , among those there is '\\'.
Well, then it works:
Code:
> (display "abc\\d\n")
abc\d

Quote:Who is in charge for this?
The Gimp developers. They are available on IRC around 10PM European time, and there is also a gimp-developer mailing list.

Quote:and bug report board?
bugzilla.gnome.org

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
Mar 11, 2012, 21:11
Post: #11
RE: gimp-text-get-extents-fontname -- pass literal '\'
It was rater hard but finally after seek-and-debug hunting I discovered that passing backslashes to gimp thru my interface, 1 \ every \\ was cut away by the interface itself. No problem in Gimp.
Find all posts by this user
Quote this message in a reply
Mar 11, 2012, 22:44
Post: #12
RE: gimp-text-get-extents-fontname -- pass literal '\'
(Mar 11, 2012 21:11)Davide Wrote:  No problem in Gimp.
OK,so you owe a virtual round of beers to the development team...

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
Mar 12, 2012, 01:54 (This post was last modified: Mar 12, 2012 02:00 by Davide.)
Post: #13
RE: gimp-text-get-extents-fontname -- pass literal '\'
You missed a couple of points, too. But there's no reason to bother making mistakes the center of topic, right?
- just a syntactical question mark.
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 181 Aug 31, 2017 14:32
Last Post: Bertholomäus
  Late binding / COM for opening an image into GIMP? i73 2 155 Aug 4, 2017 17:39
Last Post: i73
  Loading PythonFu Plugin: ImportError for .../python/gimp.so (GIMP 2.8.22/OSX/Py2.7.9) joroek 1 255 Jul 11, 2017 07:26
Last Post: ythgilb
  How to close gimp with batch command? flixe 1 245 Jun 19, 2017 12:29
Last Post: ythgilb
  script-fu ok in gimp, not in commad line dominique 1 366 Sep 28, 2014 03:18
Last Post: dominique

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS