[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #31468] multi-line text objects

From: Vanya Sergeev
Subject: [Octave-bug-tracker] [bug #31468] multi-line text objects
Date: Fri, 12 Aug 2011 00:05:41 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1

Follow-up Comment #14, bug #31468 (project octave):

Philip, for attribution purposes the fix was really David's, I just made a
slight modification. Throwing it in title.m does fix things for me though, as
far as the title goes.

Ben, I understand, you'd like the strings of text objects to take arbitrary
form (string, char matrix, cell matrix) in the backend itself.

I worked with your string_property -> any_property modification a bit. This
means that the "string member" of text::properties is stored as an
any_property which wraps the very generic octave_value, instead of a
string_property which wraps a std::string, and leads to a number of changes in
other source files.

    "string_property string u" -> "any_property string u"

gl-render.cc / gl2ps-renderer.cc / graphics.cc:
    empty() for std::string -> is_empty() for octave_value

    glps_renderer::draw_text(): in the patch I have it pass the c-string to
gl2psTextOpt() if the "string member" is actually a string, otherwise it just
passes along "". I'm not sure how gl2psTextOpt() is supposed to handle
multi-lines, so I left it like this for now.

    if "string member" is a string, it passes along the std::string to
    if "string member" is a char matrix or cell string, it pulls out the
strings with all_strings(), appends "n" between them and sends the total
string to text_to_pixels().

The attached experimental patch builds for me. 

Now, instead of:

octave:1> plot([1,2,3,4,5])
octave:2> set(get(gca(), "title"), "string", {})
error: set: invalid string property value for "string"
octave:2> set(get(gca(), "title"), "string", {"abc","def"})
error: set: invalid string property value for "string"

I get this far:

octave:1> plot([1,2,3,4,5])
octave:2> set(get(gca(), "title"), "string", "test title") % Sets the title
octave:3> set(get(gca(), "title"), "string", {}) % Clears the title
octave:4> set(get(gca(), "title"), "string", {"abc","def"}) % Doesn't work
warning: ft_render: skipping missing glyph for character `
warning: ft_render: skipping missing glyph for character `
error: undo_string_escapes: S argument must be a string
error: evaluating argument list element number 3
error: called from:
error:   octave-3.4.2-mod/scripts/plot/__go_draw_axes__.m at line 154, column
error:   octave-3.4.2-mod/scripts/plot/__go_draw_figure__.m at line 167,
column 19
error:   octave-3.4.2-mod/scripts/plot/__gnuplot_drawnow__.m at line 86,
column 5

with Ben's __go_draw_axes__.m patch applied.

I figured maybe I'd get some pointers here in case I'm working in the wrong
direction. I hadn't delved into the octave source before, so I ran into a few
  - Is is_empty() the analogous empty-checking method for octave_value?
  - I read the top of genprops.awk, but I'm not exactly sure about the 'u'
versus 'm' versus 'mu' properties. The 'm' modifier on the "string member"
seems to require the method string_setmode() that doesn't exist / isn't
generated during the build.

I attached the purely experimental patch, really just for bumping the bugfix.


(file #23789)

Additional Item Attachment:

File name: experimental_any_property_string_octave-3.4.2.patch Size:4 KB


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]