求教怎样在这里实现设置 OpenType feature 的功能

2015-08-03 00:04:52 +08:00
 Khlieb
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>Test</title>
<style type="text/css">
1588 次点击
所在节点    问与答
2 条回复
Khlieb
2015-08-03 00:05:31 +08:00
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>Test</title>
<style type="text/css">
textarea{ line-height: 1.2; }
textarea#targ { font-family: freeserif; }
</style>
<script type="text/javascript">
function getStyle( elt ) { return document.getElementById(elt).style; }
function setFace( c ) { getStyle("targ").fontFamily = c.text; }
function setWeight( c ) { getStyle("targ").fontWeight = c.text; }
function setStyle( c ) { getStyle("targ").fontStyle = c.text; }
</script>
</head>
<body>
<p class="controls">
<span>Font:
<select onchange="setFace(options[selectedIndex])">
<option>FreeSerif</option> <option>FreeSans</option> <option>FreeMono</option>
</select>
</span>
<span>Weight:
<select onchange="setWeight(options[selectedIndex])">
<option>normal</option> <option>bold</option>
</select>
</span>
<span>Style:
<select onchange="setStyle(options[selectedIndex])">
<option>normal</option> <option>oblique</option>
</select>
</span>
</p>

<p>
<textarea id="targ" rows="10" cols="40"></textarea>
</p>
</body>
</html>
Khlieb
2015-08-03 00:12:42 +08:00
个人的想法是在这个页面的“Style”选项右边加个名为“Feature”的输入框,在这个输入框里面输入字符串以后就可以改变下面大输入框的 OT feature,也就是 font-feature-setting 属性。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/210320

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX