简体   繁体   English

HTML文本区域到SVG文本

[英]Html text area to svg text

Is is possible to convert the text in a textarea in html to a svg text? 是否可以将html文本区域中的文本转换为svg文本? The text area has formatted text ie bold, italics, bullets etc. This was created using jwysiwyg library. 文本区域已格式化文本,即粗体,斜体,项目符号等。这是使用jwysiwyg库创建的。 I am attaching the code: 我附上代码:

` `

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Example: Resizable - jWYSIWYG</title>
<link rel="stylesheet" type="text/css" href="../lib/blueprint/screen.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="../lib/blueprint/print.css" media="print" />
<!--[if lt IE 8]><link rel="stylesheet" href="../lib/blueprint/ie.css" type="text/css" media="screen, projection" /><![endif]-->
<link rel="stylesheet" href="../../jquery.wysiwyg.css" type="text/css"/>
<link type="text/css" href="../lib/ui/jquery.ui.all.css" rel="stylesheet"/>
<script type="text/javascript" src="../lib/jquery.js"></script>
<script type="text/javascript" src="../../jquery.wysiwyg.js"></script>
<script type="text/javascript" src="../lib/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../lib/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../lib/ui/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="../lib/ui/jquery.ui.resizable.js"></script>
<script type="text/javascript" src="../../controls/wysiwyg.image.js"></script>
<script type="text/javascript" src="../../controls/wysiwyg.link.js"></script>
<script type="text/javascript" src="../../controls/wysiwyg.table.js"></script>
<script type="text/javascript">
(function ($) {
    $(document).ready(function () {
        $('#wysiwyg').wysiwyg({
            resizeOptions: {},

            controls: {
                html: { visible: true }
            }
        });
    });
})(jQuery);
</script>
</head>
<body><div class="container">
    <h1>jWYSIWYG</h1>
    <h2>Example: Resizable</h2>
    <textarea id="wysiwyg" rows="5" cols="47"></textarea>

    <hr/>
    <a href="index.html">Index</a>
</div></body>
</html>

` `

The reference page for this is @ http://akzhan.github.com/jwysiwyg/ 参考页面是@ http://akzhan.github.com/jwysiwyg/

You have to split various sections in your svg with a tspan. 您必须使用tspan分割svg中的各个部分。 You can just use css here. 您可以在这里使用CSS。

<text x="382" y="238">
  <tspan >This text</tspan>
  <tspan style="font-weight:bold">is bold</tspan>
  <tspan> and this is normal</tspan>
</text>

Also, Highcharts renderer can do this for you automatically: 此外,Highcharts渲染器可以自动为您执行此操作:

http://www.highcharts.com/ref/#renderer http://www.highcharts.com/ref/#renderer

I use this a lot myself. 我自己经常使用。

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

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