简体   繁体   English

如何使用 SVG 绘制字母 R

[英]How to draw letter R with SVG

I have a svg of letter B here is the code:我有一个字母B的 svg 这是代码:

 <svg id="logo" xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 84 96"> <title>Logo</title> <g transform="translate(-8.000000, -2.000000)"> <g transform="translate(11.000000, 5.000000)"> <path d="M45.691667,45.15 C48.591667,46.1 50.691667,48.95 50.691667,52.2 C50.691667,57.95 46.691667,61 40.291667,61 L28.541667,61 L28.541667,30.3 L39.291667,30.3 C45.691667,30.3 49.691667,33.15 49.691667,38.65 C49.691667,41.95 47.941667,44.35 45.691667,45.15 Z M33.591667,43.2 L39.241667,43.2 C42.791667,43.2 44.691667,41.85 44.691667,38.95 C44.691667,36.05 42.791667,34.8 39.241667,34.8 L33.591667,34.8 L33.591667,43.2 Z M33.591667,47.5 L33.591667,56.5 L40.191667,56.5 C43.691667,56.5 45.591667,54.75 45.591667,52 C45.591667,49.2 43.691667,47.5 40.191667,47.5 L33.591667,47.5 Z" fill="currentColor" /> <polygon id="Shape" stroke="currentColor" strokeWidth="5" strokeLinecap="round" strokeLinejoin="round" points="39 0 0 22 0 67 39 90 78 68 78 23" /> </g> </g> </svg>

And here is how it looks这就是它的外观

在此处输入图像描述

I just need to change letter B to letter R but i don't know the path and it should be centered in polygon我只需要将字母B更改为字母R但我不知道路径,它应该以多边形为中心

As I've commented: delete the path and add:正如我所评论的:删除路径并添加:

<text x="39" y="45" dominant-baseline="middle" text-anchor="middle" font-size="30">R</text>

where x="39" y="45" are the coords of the center of the hexagon.其中x="39" y="45"是六边形中心的坐标。 Please observe that the text is centered around this point ( <text x="39" y="45" dominant-baseline="middle" text-anchor="middle" )请注意文本以该点为中心( <text x="39" y="45" dominant-baseline="middle" text-anchor="middle"

 svg{width:90vh}
 <svg id="logo" xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 84 96"> <title>Logo</title> <g transform="translate(-8.000000, -2.000000)"> <g transform="translate(11.000000, 5.000000)"> <polygon id="Shape" stroke="currentColor" strokeWidth="5" strokeLinecap="round" strokeLinejoin="round" points="39 0 0 22 0 67 39 90 78 68 78 23" fill="none" /> <text x="39" y="45" dominant-baseline="middle" text-anchor="middle" font-size="30">R</text> </g> </g> </svg>

If you don't plan going down the rabit hole of SVG's, try to use a SVG builder, should be faster as easier to visualise.如果您不打算进入 SVG 的狂野,请尝试使用 SVG 构建器,它应该更快更容易可视化。

Examples: https://vectorpaint.yaks.co.nz/示例: https ://vectorpaint.yaks.co.nz/

https://editor.method.ac/ https://editor.method.ac/

After you finish you can download and use the svg file or open the file in your editor to see the code完成后,您可以下载并使用 svg 文件或在编辑器中打开文件以查看代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM