App icon indicating copy to clipboard operation
App copied to clipboard

[$1000] Italics is trimming the text from right side

Open kavimuru opened this issue 1 year ago • 18 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open any chat
  2. Type something in a different language (eg: हैलौ)
  3. Send it normally and then send it in italics

Expected results:

text should be rendered completely

Actual results:

text trimmed from right

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [x] Android / native
  • [ ] Android / Chrome
  • [ ] iOS / native
  • [ ] iOS / Safari
  • [ ] MacOS / Chrome / Safari
  • [ ] MacOS / Desktop

Version Number: 1.3.1 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/43996225/232652535-a645e101-880e-4c81-a8b3-ab588ae71994.mp4

Expensify/Expensify Issue URL: Issue reported by: @chiragxarora Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1681719422937499 View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012c31dd93569c6a66
  • Upwork Job ID: 1649042299370901504
  • Last Price Increase: 2023-04-27

kavimuru avatar Apr 18 '23 02:04 kavimuru

Triggered auto assignment to @slafortune (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

MelvinBot avatar Apr 18 '23 02:04 MelvinBot

Bug0 Triage Checklist (Main S/O)

  • [x] This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • [x] This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • [x] This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • [x] This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • [x] I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

MelvinBot avatar Apr 18 '23 02:04 MelvinBot

Looks good!

slafortune avatar Apr 20 '23 13:04 slafortune

Job added to Upwork: https://www.upwork.com/jobs/~012c31dd93569c6a66

MelvinBot avatar Apr 20 '23 13:04 MelvinBot

Current assignee @slafortune is eligible for the External assigner, not assigning anyone new.

MelvinBot avatar Apr 20 '23 13:04 MelvinBot

Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane (External)

MelvinBot avatar Apr 20 '23 13:04 MelvinBot

Triggered auto assignment to @AndrewGable (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Apr 20 '23 13:04 MelvinBot

The Expensify Neue family of fonts does not include hindi language characters. On iOS if the font does not support the character it seems like the OS falls back to a font which supports the character. In this case the font falls back to a non-italic one.

On Android it looks like the OS tries to render an oblique/faux italic style if the font does not support an italic character. Hence the trimmed text on Android.

ExpensifyNeue
Android iOS
ExpensifyNeue-italics(android) ExpensifyNeue-italics(iOS)

For instance this is how Poppins, which support italic hindi language characters render.

Poppins
Android iOS
Poppins-Italic(android) Poppins-Italic(iOS)

The hacky solution seems to be adding an NBSP to the end of the string on Android but this will potentially break on multiline texts.

peterlazar1993 avatar Apr 20 '23 18:04 peterlazar1993

📣 @peterlazar1993! 📣

Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.

Screen Shot 2022-11-16 at 4 42 54 PM

Format:

Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

MelvinBot avatar Apr 20 '23 18:04 MelvinBot

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ea98e1bac7222f62

peterlazar1993 avatar Apr 20 '23 18:04 peterlazar1993

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

MelvinBot avatar Apr 20 '23 18:04 MelvinBot

Hi @peterlazar1993 , problem is not with the fonts not being supported, because the similar issue is seen with uppercase W's too. Author hasn't included that image so I'll do that for you. Problem is with letters going outwards from upper right corner. screenshot_2023-04-17-14-10-46-004_com.binghuo.magnifyingglass.magnifier.jpg

chiragxarora avatar Apr 20 '23 18:04 chiragxarora

@chiragxarora Thank you for clarifying, you are right. The issue is in general with italic text that is wide.

peterlazar1993 avatar Apr 21 '23 00:04 peterlazar1993

Proposal

Please re-state the problem that we are trying to solve in this issue.

In chat, text in italics is trimmed at the end of the string

What is the root cause of that problem?

I beleive the root cause of the problem is the underlying native Text component which does not account for the right width for slanting characters. For eg. iOS, Android

What changes do you think we should make in order to solve the problem?

The idea is to give a larger width to the Text component than the rendered length.

The formatted text(bold, italics) is rendered using react-native-render-html which in turn creates View and Text elements. By allowing the container View element to flex to full width, the Text can extend beyond the rendered width.

Results
Before After

peterlazar1993 avatar Apr 21 '23 00:04 peterlazar1993

@AndrewGable, @slafortune, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

MelvinBot avatar Apr 24 '23 10:04 MelvinBot

@AndrewGable, @slafortune, @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?

MelvinBot avatar Apr 26 '23 10:04 MelvinBot

what issss this issue. @peterlazar1993 @chiragxarora sorry, I don't understand the root cause of this issue. Could you please elaborate on the exact root cause of this issue? Thanks 🙇

rushatgabhane avatar Apr 26 '23 14:04 rushatgabhane

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

MelvinBot avatar Apr 27 '23 16:04 MelvinBot

Still waiting on more context in proposals as https://github.com/Expensify/App/issues/17553#issuecomment-1523559722 mentions

AndrewGable avatar May 01 '23 20:05 AndrewGable

@AndrewGable @slafortune @rushatgabhane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

MelvinBot avatar May 02 '23 19:05 MelvinBot

@AndrewGable @slafortune @rushatgabhane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

MelvinBot avatar May 02 '23 20:05 MelvinBot

Still waiting more proposals

AndrewGable avatar May 04 '23 21:05 AndrewGable

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar May 08 '23 17:05 melvin-bot[bot]

@AndrewGable, @slafortune, @rushatgabhane Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar May 08 '23 20:05 melvin-bot[bot]

Bumped on slack for proposals https://expensify.slack.com/archives/C01GTK53T8Q/p1683611957463039

rushatgabhane avatar May 09 '23 05:05 rushatgabhane

Proposal

Please re-state the problem that we are trying to solve in this issue.

In the chat report, italics text is being clipped on the right hand side.

What is the root cause of that problem?

There is an issue on Android where text that does not have a truetype italics variant gets clipped at the right hand side due to the measured width of TextView widget. The measured width tends to be calculated during rendering of a native control. There is a StackOverflow question from over 12 years ago where this is properly detailed.

What changes do you think we should make in order to solve the problem?

There are a few ways to solve the problem.

  1. Fix: Use a font that has an italics variant (Source).
  2. Fix: Create a custom widget based on the TextView widget and override the onMeasure method to increase the width of the control. This would require changes to upstream React Native.
  3. Hack: Add the Unicode hairspace character to the end of the string (&#x200A;)

What alternative solutions did you explore? (Optional)

None.

akinwale avatar May 09 '23 06:05 akinwale

@AndrewGable @slafortune @rushatgabhane this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

melvin-bot[bot] avatar May 09 '23 20:05 melvin-bot[bot]

@AndrewGable, @slafortune, @rushatgabhane Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar May 12 '23 20:05 melvin-bot[bot]

@rushatgabhane @AndrewGable do you think we need more proposals?

slafortune avatar May 15 '23 15:05 slafortune

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar May 15 '23 16:05 melvin-bot[bot]