octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #31468] Printing of multi-line text objects (O


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #31468] Printing of multi-line text objects (OpenGL)
Date: Sat, 26 Sep 2015 11:06:13 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0

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

I have worked out a series of patches in order to have multi line support in
printed images also. The 3 attached patches still have to be polished and the
change log is still missing, but it works as follows:
* txt-eng-ft: 
When parsing the string using freetype (text_to_pixels), the position and
other font style informations are stored in a list of ftstring class objects.
Those objects represent a string segment with homogeneous font properties, e.g
parsing "This_{string}" will result in a list of 2 ftstrings, one for "This"
and one for "string". When tex symbols are present, their utf8 code is also
stored.
The list of parsed strings can be retrieved using a new method
"text_to_strlist" that has the same interface as "text_to_pixels" but retruns
the list instead of a pixel array.
Note: The ftstring class capabilities currently overlap with ft_face class so
I should polish that and make one overload the other.

* gl-render: 
Add "text_to_strlist" method (see above).
Add a method "fix_strlist_position" to align the ftstring list using the
current graphics_tranform (Note: this could be a gl2ps-renderer only method).

* gl2ps-renderer: 
Retrieve the ftstring list and decide what to do with it: 
-if the list has only one element and no tex symbol, let gl2ps align the
string (this what we currently do)
-else: each string segment is translated/rotated as necessary and then printed
using gl2ps. Tex symbols are replaced by their counterpart in the "Symbol"
font except when printing to svg which has built-in utf8 support.

I ran dump_plot_demos.m with fltk and compared the figures using those patches
or 4.0 and I didn't see any obvious regression.

As symbols in the "Symbol" font don't have the exact same size as the original
ones, the alignment is often not righ. 
As fontconfig (in Octave) doesn't generally pick the same replacement font for
Times and Helvetica as pdf renderers (I tried Okular and Evince), there are
also some sligh alignement issues. This could be solved in the future by
replacing Times/Helvetica font, in gl2ps output, by the one fontconfig has
picked and then embeding the font using ghostscript (see e.g. in R [1]).

Well now I'd like to have comments on the approach before I start polishing.
Can some of you test the patches please? See file names for the order in which
you have to apply the patches.

[1]
http://stat.ethz.ch/R-manual/R-patched/library/grDevices/html/embedFonts.html

(file #34984, file #34985, file #34986)
    _______________________________________________________

Additional Item Attachment:

File name: 1-txtengmods.patch             Size:7 KB
File name: 2-glrendermods.patch           Size:4 KB
File name: 3-gl2psmods.patch              Size:11 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?31468>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

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