From 1b65c09ea2b7f5f5c8b950362cfbc5a174717499 Mon Sep 17 00:00:00 2001 From: chenchangqing Date: Mon, 25 Jul 2022 12:47:52 +0800 Subject: [PATCH 1/2] 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; From 54341cc01a49e8de1db9fd4a838a19f3a4c8e742 Mon Sep 17 00:00:00 2001 From: chenchangqing Date: Mon, 25 Jul 2022 17:22:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8D=E7=AE=A1rtl=EF=BC=8C=E8=BF=98?= =?UTF-8?q?=E6=98=AFltr=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YYText/Component/YYTextLayout.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/YYText/Component/YYTextLayout.m b/YYText/Component/YYTextLayout.m index 9c8ffdff..d0e4fbde 100644 --- a/YYText/Component/YYTextLayout.m +++ b/YYText/Component/YYTextLayout.m @@ -522,9 +522,8 @@ + (YYTextLayout *)layoutWithContainer:(YYTextContainer *)container text:(NSAttri CGPoint ctLineOrigin = lineOrigins[i]; // https://github.com/ibireme/YYText/issues/930 - if ([UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) { - ctLineOrigin.x = 0; - } + // 不管rtl,还是ltr计算方式保持一致 + ctLineOrigin.x = 0; // UIKit coordinate system CGPoint position;