CJLabel icon indicating copy to clipboard operation
CJLabel copied to clipboard

不同CTRun的下滑线对齐

Open AndyLxl opened this issue 4 years ago • 6 comments

一个CTLine里面,不同CTRun,它们的下划线没有处在同一水平线上,如何调整

AndyLxl avatar Jan 28 '21 06:01 AndyLxl

一个CTLine里面,不同CTRun,它们的下划线没有处在同一水平线上,如何调整

如果是label整体文本的垂直对齐,使用label.verticalAlignment属性;如果是针对图文混排的指定行的对齐,可以使用+initWithView:viewSize:lineAlignment:configure:或+insertViewAtAttrString:view:viewSize:atIndex:lineAlignment:configure:方法设置;当然也可以只插入一个0.1像素的空白view,同时设置lineAlignment属性,从与达到对齐效果

lele8446 avatar Feb 02 '21 08:02 lele8446

感谢回复,目前我已经把系统自动画的线变为透明色,然后再在一行的最低点画的线

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: lele8446 <[email protected]> 发送时间: 2021年2月2日 16:49 收件人: lele8446/CJLabel <[email protected]> 抄送: AndyLxl <[email protected]>, Author <[email protected]> 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

一个CTLine里面,不同CTRun,它们的下划线没有处在同一水平线上,如何调整

如果是label整体文本的垂直对齐,使用label.verticalAlignment属性;如果是针对图文混排的指定行的对齐,可以使用+initWithView:viewSize:lineAlignment:configure:或+insertViewAtAttrString:view:viewSize:atIndex:lineAlignment:configure:方法设置;当然也可以只插入一个0.1像素的空白view,同时设置lineAlignment属性,从与达到对齐效果

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

AndyLxl avatar Feb 02 '21 08:02 AndyLxl

github 已回复,你看看是不是你要的效果

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: AndyLxl <[email protected]> 发送时间: 2021年1月28日 14:22 收件人: lele8446/CJLabel <[email protected]> 抄送: Subscribed <[email protected]> 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

@大佬,像这样的情况,怎么让下划线平行

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

lele8446 avatar Feb 02 '21 08:02 lele8446

可以满足我自己的需求。我用的dtcoretext,看苹果ctrun.h里的ctrundraw函数,注释里面说明了是不会自动划线的,但是实际还是画了,奇怪。

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: lele8446 <[email protected]> 发送时间: 2021年2月2日 16:54 收件人: lele8446/CJLabel <[email protected]> 抄送: AndyLxl <[email protected]>, Author <[email protected]> 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

github 已回复,你看看是不是你要的效果

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: AndyLxl <[email protected]&gt; 发送时间: 2021年1月28日 14:22 收件人: lele8446/CJLabel <[email protected]&gt; 抄送: Subscribed <[email protected]&gt; 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

@大佬,像这样的情况,怎么让下划线平行

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

AndyLxl avatar Feb 02 '21 08:02 AndyLxl

划线问题我没遇到,CJLabel就是用的CTRunDraw绘制文字

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: AndyLxl <[email protected]> 发送时间: 2021年2月2日 16:57 收件人: lele8446/CJLabel <[email protected]> 抄送: lele8446 <[email protected]>, Comment <[email protected]> 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

可以满足我自己的需求。我用的dtcoretext,看苹果ctrun.h里的ctrundraw函数,注释里面说明了是不会自动划线的,但是实际还是画了,奇怪。

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: lele8446 <[email protected]&gt; 发送时间: 2021年2月2日 16:54 收件人: lele8446/CJLabel <[email protected]&gt; 抄送: AndyLxl <[email protected]&gt;, Author <[email protected]&gt; 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

github 已回复,你看看是不是你要的效果

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: AndyLxl <[email protected]&amp;gt; 发送时间: 2021年1月28日 14:22 收件人: lele8446/CJLabel <[email protected]&amp;gt; 抄送: Subscribed <[email protected]&amp;gt; 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

@大佬,像这样的情况,怎么让下划线平行

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

lele8446 avatar Feb 02 '21 09:02 lele8446

您好,问个问题,就是段开头是中文双引号的时候,左双引号整个字形会多出一些空白,如何让它和其他段对齐?

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: lele8446 @.> 发送时间: 2021年2月2日 17:03 收件人: lele8446/CJLabel @.> 抄送: AndyLxl @.>, Author @.> 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

划线问题我没遇到,CJLabel就是用的CTRunDraw绘制文字

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: AndyLxl @.&gt; 发送时间: 2021年2月2日 16:57 收件人: lele8446/CJLabel @.&gt; 抄送: lele8446 @.&gt;, Comment @.&gt; 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

可以满足我自己的需求。我用的dtcoretext,看苹果ctrun.h里的ctrundraw函数,注释里面说明了是不会自动划线的,但是实际还是画了,奇怪。

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: lele8446 @.&amp;gt; 发送时间: 2021年2月2日 16:54 收件人: lele8446/CJLabel @.&amp;gt; 抄送: AndyLxl @.&amp;gt;, Author @.&amp;gt; 主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

github 已回复,你看看是不是你要的效果

发自我的iPhone

------------------ 原始邮件 ------------------
发件人: AndyLxl @.&amp;amp;gt;
发送时间: 2021年1月28日 14:22
收件人: lele8446/CJLabel @.
&amp;amp;gt;
抄送: Subscribed @.***&amp;amp;gt;
主题: 回复:[lele8446/CJLabel] 不同CTRun的下滑线对齐 (#21)

@大佬,像这样的情况,怎么让下划线平行


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

AndyLxl avatar Mar 15 '21 23:03 AndyLxl