来自文本的 CGPathRef
我们如何获取特定字符串的路径? 我刚刚发现 CTFontCreatePathForGlyph
会给出 CGPathRef
,但它会是文本的轮廓。 例如,我从上述方法得到的路径中的字母“O”就像一个圆圈,里面有一个圆圈.. 看看我们如何绘制字母“O”只是一个圆圈。 我希望上述详细信息足以理解我的问题。请告诉我任何更新,
我需要此文本路径来显示文本绘图动画。
更新 请看下图。(1) 显示了我现在得到的内容..但我需要如 (2) 中所示的路径
How can we get path of particular string?
I just found out that CTFontCreatePathForGlyph
will give CGPathRef
, but its will be the outline of text .
for example the letter 'O' the path i get from the above method is like a circle with in a circle ..
See how we draw the letter 'O' is just one circle.
I hope that the above details are enough for to understand my problem.let me know any updates
I need this text path for showing a text drawing animation..
UPDATE
please see the below image.(1) shows what i get now..but i need the path like shown in (2)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
任何贝塞尔路径,包括从字形中获得的路径,都只是一系列相连的贝塞尔曲线。你在屏幕上看到的就是CGContext渲染路径的结果。可以对路径进行描边,在这种情况下您只会看到轮廓。
它也可以被填充,在这种情况下,内部区域被填充颜色或图案。使用 CGContextFillPath() 用颜色填充路径。缠绕规则定义如何填充具有相交区域的路径。
Any Bezier path, including that one you get from the glyphs, is just a series of connected Bezier curves. What you see on the screen is the result of rendering the path by CGContext. The path can be stroked, in this case you will see just the outline.
Also it can be filled, in this case the internal regions are filled with colour or pattern. Use CGContextFillPath() to fill your path with colour. Winding rules define how to fill the path if it has intersecting zones.