From 1b65c09ea2b7f5f5c8b950362cfbc5a174717499 Mon Sep 17 00:00:00 2001 From: chenchangqing Date: Mon, 25 Jul 2022 12:47:52 +0800 Subject: [PATCH] fit ar --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ YYText/Component/YYTextLayout.m | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 Demo/YYTextDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Demo/YYTextDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Demo/YYTextDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Demo/YYTextDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/YYText/Component/YYTextLayout.m b/YYText/Component/YYTextLayout.m index 708ba1dd..9c8ffdff 100644 --- a/YYText/Component/YYTextLayout.m +++ b/YYText/Component/YYTextLayout.m @@ -521,6 +521,11 @@ + (YYTextLayout *)layoutWithContainer:(YYTextContainer *)container text:(NSAttri // CoreText coordinate system CGPoint ctLineOrigin = lineOrigins[i]; + // https://github.com/ibireme/YYText/issues/930 + if ([UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { + ctLineOrigin.x = 0; + } + // UIKit coordinate system CGPoint position; position.x = cgPathBox.origin.x + ctLineOrigin.x;