V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Khlieb
V2EX  ›  问与答

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

  •  
  •   Khlieb · 2015-08-03 00:04:52 +08:00 via Android · 1583 次点击
    这是一个创建于 3161 天前的主题,其中的信息可能已经有所发展或是发生改变。
    <!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">
    2 条回复    2015-08-03 00:12:42 +08:00
    Khlieb
        1
    Khlieb  
    OP
       2015-08-03 00:05:31 +08:00 via Android
    <!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
        2
    Khlieb  
    OP
       2015-08-03 00:12:42 +08:00 via Android
    个人的想法是在这个页面的“Style”选项右边加个名为“Feature”的输入框,在这个输入框里面输入字符串以后就可以改变下面大输入框的 OT feature,也就是 font-feature-setting 属性。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2871 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 13:08 · PVG 21:08 · LAX 06:08 · JFK 09:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.