Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RTL language causes overlapping in settings, #4888 #4889

Merged
merged 3 commits into from May 25, 2024
Merged

Conversation

low-batt
Copy link
Contributor

@low-batt low-batt commented Apr 23, 2024

This commit will:

  • Correct the constraints in PrefSubViewController.xib
  • Change the Mirror setting to Never on the color wells in the XIB
  • Change the language-direction of the battery icon from Fixed to Left to Right, Mirrors

This corrects a problem with color wells overlapping their labels on the Subtitle tab of IINA's settings. This also changes the battery icon shown in full screen mode to flip in a RTL language correcting another overlapping problem.


Description:

@low-batt low-batt linked an issue Apr 23, 2024 that may be closed by this pull request
1 task
@low-batt
Copy link
Contributor Author

See issue #4776 for a screenshot of the RTL overlaps.

IINA 1.3.4:
released

With the changes in this PR…
fixed-en
fixed-he

This commit will:
- Correct the constraints in PrefSubViewController.xib
- Change the Mirror setting to Never on the color wells in the XIB
- Change the language-direction of the battery icon from Fixed to Left
  to Right, Mirrors

This corrects a problem with color wells overlapping their labels on the
Subtitle tab of IINA's settings. This also changes the battery icon
shown in full screen mode to flip in a RTL language correcting another
overlapping problem.
@low-batt low-batt marked this pull request as draft April 25, 2024 21:47
@low-batt
Copy link
Contributor Author

The issue with the malformed color wells in RTL has been fixed:
he-sub-settings

But the mirroring applied by AppKit to the battery icon results in a blurry image:
he-battery

@lhc70000 will be generating a reversed battery image. I will then add it to the existing battery icon image set as a Right to Left image.

I have set this to be a draft until the blurry battery problem is corrected.

@ShlomoCode
Copy link

It seems to me that a perfect inversion is like this:
CleanShot 2024-04-26 at 03 17 33
Instead of:
CleanShot 2024-04-26 at 03 24 37@2x

@ShlomoCode
Copy link

ShlomoCode commented Apr 26, 2024

@lhc70000 will be generating a reversed battery image. I will then add it to the existing battery icon image set as a Right to Left image.

I mirrored the PDF from here simply using Apple Preview, it seems to keep full quality.
battery.pdf
CleanShot 2024-04-26 at 04 47 27

@low-batt
Copy link
Contributor Author

Thanks! But… been there, done that. It all looked good in Preview and in Xcode, but at runtime the flipped battery looks just like the original battery. It faces the wrong direction. This is because Apple Preview does not remake the PDF, it adds a rotate tag to it. Seems AppKit does not support the tag.

At least I think that is what was happening. Did I miss something?

@ShlomoCode
Copy link

ShlomoCode commented Apr 26, 2024

Yes, it looks like you're right :(
BTW recreating the file with ImageMagick helps, but I couldn't find the exact command to keep the file at full quality

@low-batt
Copy link
Contributor Author

Took me a while to figure out what was happening. Since Xcode showed the reversed PDF correctly I was thinking the code was not picking the RTL version of the battery.

@lhc70000 created the battery icon. He will be able to provide a flipped one that matches the existing one.

@ShlomoCode
Copy link

@low-batt What do you think about this?

@low-batt
Copy link
Contributor Author

Oh. I missed that detail. My thoughts are that IINA should not try to change this. This is the behavior Apple supplies for an AppKit NSColorWell. If this is incorrect then Apple needs to fix it. Just to be sure I ran the little test program I wrote while working on this and confirmed this is the Apple supplied RTL behavior for this component.

@lhc70000
Copy link
Member

Added the mirrored battery icon.

@low-batt
Copy link
Contributor Author

Thanks! The new icon looks good. However I am going to simplify the change. There is no need for the code in MainWindowController. The easier way to do this is to reconfigure the icon to select the correct image automatically. I will work on that change now.

@low-batt
Copy link
Contributor Author

The constraint for the text within the battery icon is correct for LTR and a little off for RTL. I will be fixing that, but gotten too late tonight. I have to help afriend tomorrow, so may not get to it until Saturday. Leaving this as a draft for now.

To get an icon to have separate LTR and RTL images change the direction to Both as I shown below. Once that change is made a location for a RTL image appears and you can just drag & drop the RTL image to it.
Both

This commit will:
- Correct the constraints in PrefSubViewController.xib
- Change the Mirror setting to Never on the color wells in the XIB
- Change the direction of the battery icon from Fixed to Both
- Add a reversed image to the battery icon
- Add a additionalInfoLabelXConstraint outlet to MainWindowController
- Add code to MainWindowController.windowDidLoad to adjust
  additionalInfoLabelXConstraint to center the label that provides the
  charge state when the battery icon is reversed

This corrects a problem with color wells overlapping their labels on the
Subtitle tab of IINA's settings. This also changes the battery icon
shown in full screen mode to flip in a RTL language correcting another
overlapping problem.
@low-batt
Copy link
Contributor Author

LTR:
LTR

RTL:
RTL

I think this one is ready for review

@low-batt low-batt marked this pull request as ready for review May 24, 2024 17:29
@low-batt low-batt requested review from uiryuu and lhc70000 May 24, 2024 17:29
@uiryuu uiryuu merged commit 16adeea into develop May 25, 2024
1 check passed
@uiryuu uiryuu deleted the he-sub-settings branch May 25, 2024 00:59
uiryuu added a commit that referenced this pull request May 25, 2024
uiryuu added a commit that referenced this pull request May 25, 2024
@uiryuu uiryuu restored the he-sub-settings branch May 25, 2024 01:00
@uiryuu uiryuu deleted the he-sub-settings branch May 25, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RTL language causes overlapping in subtitle settings
4 participants