FLTK logo

STR #3452

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | SVN ⇄ GIT ]

STR #3452

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:fribidi support
Version:1.4-feature
Created By:djcj
Assigned To:manolo
Fix Version:1.4-current
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 djcj
11:14 May 27, 2018
fribidi.patch
4k
 
 
#2 djcj
03:34 May 29, 2018
fribidi2.patch
3k
 
 
#3 djcj
03:34 May 29, 2018
fribidi.png
11k
 
 
#4 djcj
03:34 May 29, 2018
fribidi_test.cpp
1k
 
 
#5 djcj
04:34 May 29, 2018
fribidi_dlopen.patch
6k
 
 
#6 AlbrechtS
03:26 Feb 04, 2019
pango.png
50k
 
 
#7 AlbrechtS
03:34 Feb 04, 2019
hello_rtl.cxx
1k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 djcj
09:04 Feb 14, 2018
It would be great if FLTK could optionally be built against libfribi, so that handling right-to-left alphabets like Hebrew or Arabic would all be handled by FLTK. Right now you need to use libfribidi to change the string to the correct visual version.  
 
#2 djcj
11:17 May 27, 2018
I have attached a patch with an example how to implement fribidi in FLTK.
In this case you can enable it with Fl_Widget::fribidi(1) and disable it with Fl_Widget::fribidi(0). Labels with right-to-left characters will now automatically be shown the correct way.
 
 
#3 AlbrechtS
05:39 May 28, 2018
Thanks for the patch.

For an easy evaluation we might need as well:

(1) a working test/demo program with one or more appropriate strings

(2) a screenshot of the properly working patch, because I believe that no one of our developers RTL-scripts.

(3) a reference where to download libfribidi and, if not trivial, how to build it to work with FLTK.

Can you please post these informations? TIA.

Does libfribidi introduce additional dependencies? If yes, which dependencies?

Is libfribidi available on all major platforms supported by FLTK (Unix/Linux, Windows, MacOS)?
 
 
#4 djcj
03:33 May 29, 2018
Website: https://github.com/fribidi/fribidi/ or www.gnu.org/software/fribidi

It's available by default on all Linux distros. It's easy to build, usable on Windows too and has no other dependencies. License is LGPL 2.1+.
 
 
#5 djcj
04:35 May 29, 2018
I've added another patch with an example hown to dlopen fribidi instead of linking permanently against it (it's a bit messy though).  
 
#6 djcj
15:12 May 31, 2018
You could also take a look at FFmpeg's shape_text() function from libavfilter_vf_drawtext.c which allocates the strings and doesn't use the deprecated fribidi_log2vis() function.  
 
#7 matt
16:28 Feb 03, 2019
This is for widget labels only, not for any other text, or text input, or the help view, etc. , right?  
 
#8 AlbrechtS
03:26 Feb 04, 2019
I read that pango uses libfribidi, so I wondered if using pango wouldn't be superior because it would affect all string drawing, and indeed I could see that the string given in fribidi_test.cpp is rendered correctly when using FLTK with pango w/o any patches and w/o enabling pango per widget (label).

See attached file pango.png for a comparison with and w/o pango.

Pro pango: seamless integration w/o code changes

Contra pango: IIRC we support pango only on Linux and likely also macOS, but not on Windows but I'm not sure about this.

Question: isn't using pango the better option?
 
 
#10 AlbrechtS
03:34 Feb 04, 2019
The attached file hello_rtl.cxx (modified test/hello.cxx) was used to create the image 'pango.png', built with and w/o pango under Linux.  
 
#11 AlbrechtS
09:47 Feb 05, 2019
@OP (djcj): would using pango solve your issue? I think it's the better way to go.

Can we close this STR with this solution?
 
 
#12 manolo
02:02 Feb 06, 2019
FLTK 1.4 can be optionally built with pango support on
X11 platforms. To get that, activate OPTION_USE_PANGO
under CMake or use
   configure --enable-pango
In this condition, FLTK draws correctly all UTF8 text
whether right-to-left or left-to-right or mixed, provided
pango and the adequate fonts are present at run-time in the system.

The same result is obtained (already in FLTK 1.3)
under MacOS and Windows (7 and 10 for sure)
and there's no need to install pango or anything,
because FLTK uses the system's text drawing procedures
that natively support right-to-left text.

In short, drawing right-to-left text is OK with FLTK 1.4.

But, other text-related operations such as input
and selection are not well supported by FLTK for
right-to-left text.

Therefore, this STR can be closed.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.