Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#6004 closed defect (duplicate)

OSD RTL Languages general fix

Reported by: Tony Arie Kolev <kolevtony@…> Owned by: Isaac Richards
Priority: major Milestone: 0.21.1
Component: mythtv Version: 0.21-fixes
Severity: medium Keywords: OSD RTL
Cc: Ticket locked: yes

Description

OSD in current version has some bugs in Right-To-Left languages: 1) In TV Program Info pop-up window lines the text going from botton to top 2) In TV Program Info pop-up window text is Left aligned 3) In LiveTV mode OSD menu text is going Left-To-Right 4) In LiveTV mode OSD menu text is Left aligned 5) In View Recordings mode OSD menu text is going Left-To-Right 6) In View Recordings mode OSD menu text is Left aligned In this patch all mentioned problems are fixed RTL conversion taken from previously implemented patches:

  • used stable release 0.21-192.89
  • #4885: patch: multi line BiDi? support in OSD

Some corrections made to fix double conversion when fribidi-devel is installed New RTL class introduced to integrate unsuccessful attempts

to make RTL conversion in osdtypes.cpp and later in ttfont.cpp now it may be used everywhere when needed

Patch is affecting files: libs/libmythtv/libmythtv.pro libs/libmythtv/osdtypes.h libs/libmythtv/osdtypes.cpp (general messages,TV program info) libs/libmythtv/osdlistbtntype.h libs/libmythtv/osdlistbtntype.cpp (OSD menus for LiveTV,View Recording) libs/libmythtv/rtl.h (new) libs/libmythtv/rtl.cpp (new)

Attachments (5)

osd_rtl.patch (12.0 KB) - added by Tony Arie Kolev <kolevtony@…> 11 years ago.
patch file to applay to mythtv-0-21-fixes (rev. 192.89)
osd.xml.rtl.patch (7.8 KB) - added by Tony Arie Kolev <kolevtony@…> 11 years ago.
OSD text of RTL languages fix for text falling out of pop-up box background (applied to ver.193.63)
osd.xml.rtl.v2.patch (20.0 KB) - added by Tony Arie Kolev <kolevtony@…> 11 years ago.
Combined two prev. patches + mem. leak. fix. This is the only patch to applay
osd.xml.rtl.v3.patch (22.6 KB) - added by kolevtony@… 11 years ago.
More fixes of rtl texts falling out of right side of buttons in main menu
osd.xml.rtl.v4.patch (26.6 KB) - added by Tony Arie Kolev <kolevtony@…> 11 years ago.
Yet More fixes of rtl texts falling out of right side

Download all attachments as: .zip

Change History (14)

Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

Attachment: osd_rtl.patch added

patch file to applay to mythtv-0-21-fixes (rev. 192.89)

Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

Attachment: osd.xml.rtl.patch added

OSD text of RTL languages fix for text falling out of pop-up box background (applied to ver.193.63)

comment:1 Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

I have tested it on several installations and started my Internet project at: https://sourceforge.net/projects/mythdorarpms/ but I think the best way is to include proper RTL texts display in mainstream project. Please , check this patch, as soon as possible!

comment:2 Changed 11 years ago by ido

hi, I've only reviewed your patch briefly, but it looks good. i still think logical2visual should be applied just before "printing" (ie. ttffont) and not inside any widget. but if it works.... hope it will be incorporated to trunk faster than my 10 months and still waiting. I assume you solved the Segmentation Faults (#5640) people experienced ?

comment:3 Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

I like to explain what is done to help developers to understand and include the patch in mainstream versions of MythTV.

Short description of the problem in current stable releases: Texts of Right-To-Left languages are not properly displayed in some OSD windows like: 1) LiveTV menu - text is going Left-To-Right and is Justified to the Left. 2) TV Recordings menu - text is going Left-To-Right and is Justified to the Left. 3) TV Program Info window - multiline text is split in wrong way, lines are going from bottom to top and are Justified to the Left. 4) Other OSD pop-up windows - text is Justified to the Left. *) One hidden problem - there are two functions operating on RTL: QString OSDTypeText::BasicConvertFromRtoL(const QString &text) QString OSDTypeText::ConvertFromRtoL(const QString &text) Second is calling first one to do RTL conversion and after that is doing again RTL conversion (in case the fribidi is enabled). It is double RTL conversion!

I have tested the patch from Ido Roseman - it is not included in last stable source. He solves Left-To-Right problem in 1) and 2), and Bottom-To-Top problem in 3) But, he does not solves Left Justified text problem. Also he introduces one new problem - Parentheses in TV Program Info window are swapped like: some text )2006(.

What I am doing in my patch (osd_rtl.patch): I am not using Ido Roseman's patch, because it moved the RTL conversion in ttfont.cpp and in that point is hard to make Right Justification. RTL conversion is needed in two different classes: OSDTypeText and OSDListBtnTypeItem Ido's patch uses a common for two classes class - ttfont.

I am moving RTL conversion to NEW Class named RTL. That way it is possible to use it from both OSDTypeText and OSDListBtnTypeItem classes and possibly in future from another classes without moving it again. Also , and more important, now Right Justification can be implemented from the caller. I am introducing isRTL return variable , using embedding_level_list return variables from fribidi_log2vis to decide whether text is RTL and needs Right Justification. This way no configuration is needed and text is Left or Right Justified automatically. My patch addresses all points 1,2,3,4 mentioned above and fixes the *) hidden problem.

The patch is tested in running systems on MythDora? and Fedora 9, built separately. Program is running stable. I addition some adjustment's are needed in right position of some texts, discovered after the texts was correctly Justified to the Right. I have fixed what I found in separate patch (osd.rtl.xml.patch) That patch is changing width of some fields in osd.xml files.

Tony Arie Kolev, Linux Professional (LPIC-1 Certification), C,C++,Java Programmer for more than 10 years of experience.

comment:4 Changed 11 years ago by ido

I'm just thinking out loud... to me these are two separate issues. RTL should be solved in the rendering level, alignment should be in the widget level. if you look at the regular menus, that's how it is implemented. also maybe we should create Align-Auto mode like in Qt ? Ido Roseman, Just a guy :-)

comment:5 Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

Hello, Ido,

First, about the Segmentation Faults (#5640) people experienced - I have never experienced it, what I can say is that It is probably introduced when in patch #4885 You return reference to a local variable - I mean the commented QDeepCopy and returned reference to free memory (I remember from my c language study that locally defined variables memory is freed when function returns - do You think so? (the code from patch #4885):

QString output = rtl_string_composer.join("");

479

480 return QDeepCopy<QString>(output);

481 return output;

So the output can be anything - not so good.

It is just a guess , of course , that Segmentation Faults was introduced by this.

In my patch I am not doing thinks like that.

Second, maybe You are right theoretically, practically in existent program, it was easier and more effectively to me to do it that way. Please, feel free to make fixes, the way You like it.

When this #6004 will be in status other than new? Hello , is the anybody out there?

comment:6 Changed 11 years ago by danielk

Resolution: duplicate
Status: newclosed

Appears to be a dup of #4885, moved an updated version of this patch there.

Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

Attachment: osd.xml.rtl.v2.patch added

Combined two prev. patches + mem. leak. fix. This is the only patch to applay

comment:7 Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

This ticket is closed, perfectly working patch is the last one: osd.xml.rtl.v2.patch - combined version of osd_rtl.patch & osd.xml.rtl.patch + memory leak. fixed (thanks to Daniel) Next, more efficient version will be in #4885, we moved from here and are working on.

Changed 11 years ago by kolevtony@…

Attachment: osd.xml.rtl.v3.patch added

More fixes of rtl texts falling out of right side of buttons in main menu

comment:8 Changed 11 years ago by kolevtony@…

Added v3 patch which is update of v2 patch fixes of theme.xml files of various themes where RTL texts are falling out or near to edge of buttons in main menu and sub menus.

comment:9 Changed 11 years ago by stuartm

Ticket locked: set

This ticket is closed, patches added to it will likely go ignored.

Non-OSD theme changes should be submitted separately, in a different ticket, but patches should ideally be against trunk.

Changed 11 years ago by Tony Arie Kolev <kolevtony@…>

Attachment: osd.xml.rtl.v4.patch added

Yet More fixes of rtl texts falling out of right side

Note: See TracTickets for help on using tickets.