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

Arabic Text goes out of editor's border when aligned right on iOS7 #709

Closed
ghanemabdo opened this issue Jan 21, 2014 · 10 comments
Closed

Arabic Text goes out of editor's border when aligned right on iOS7 #709

ghanemabdo opened this issue Jan 21, 2014 · 10 comments

Comments

@ghanemabdo
Copy link

Try adding some Arabic text ("اللغة العربية") to the editor and align the text to the right. On the iPad with iOS7 the first character ("ا") goes out of the screen boarder and the text appears as ("للغة العربية") while the text appears properly on the iPad with iOS6.x.

I tried adding a space before the first character, it appeared which means that the first character of every line will be hidden.

@mpramodjain
Copy link

I am also facing the same issue wrt Arabic Text and iOS7, getting cut on right side. Please update when the fix can be available with commit number.

@ghanemabdo
Copy link
Author

I solved the problem by adding the following code to the init method of the DTRichTextEditor:

  • (void)adjustViewInsetsForiOS7
    {
    // in iOS7+, the Arabic text is shown messy having the first character always out of the screen right border. This is why the attributed text content view insets are increased by 5 px to move the first character to the visible area.
    if ( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0.0") )
    {
    UIEdgeInsets insets = self.attributedTextContentView.edgeInsets ;
    insets.right += 5 ;
    self.attributedTextContentView.edgeInsets = insets ;
    }
    }

Actually the code moves the right inset of the text content view of the rich text editor a few pixels to the right which brings the hidden first character to the visible frame.

@mpramodjain
Copy link

Is there any generic changes that to be done, instead of hardcoding the insets.right + = 5, from DTCoreText team.

@odrobnik
Copy link
Collaborator

I think the bug must be in the manual layouting. Somebody should fix it there in DTCoreTextLayoutFrame.

@mpramodjain
Copy link

Cocoanetics,

Its a bug specific to iOS7, Can you please point me to the fix for the issue. I found the DTCoreTextLayoutFrame is being changed around 3years agon

@mpramodjain
Copy link

Cocoanetics,

Can you please update on the fix, on which file it is available exactly or commit info so we can check the changes in our integration?

@odrobnik
Copy link
Collaborator

I am not working on it.

Sent from my iPhone

On 27.01.2014, at 14:04, mpramodjain notifications@github.com wrote:

Cocoanetics,

Can you please update on the fix, on which file it is available exactly or commit info so we can check the changes in our integration?


Reply to this email directly or view it on GitHub.

@odrobnik
Copy link
Collaborator

@mpramodjain have a look in this location, the X coordinate seems to get messed up: https://github.com/Cocoanetics/DTCoreText/blob/develop/Core/Source/DTCoreTextLayoutFrame.m#L615-L620

This method is the one where the positions of lines etc. are calculated.

@mpramodjain
Copy link

Oliver, thanks for the update.

However, we pulled the latest code and observed the issue still exist with the latest code also. We will check further and update any findings if.

@odrobnik
Copy link
Collaborator

odrobnik commented Jun 4, 2014

@mpramodjain Did you find a fix for your issue?

@odrobnik odrobnik closed this as completed Jun 4, 2014
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

No branches or pull requests

3 participants