Giter Site home page Giter Site logo

wcfont's Introduction

WCFont

DEMO

使用 sfntly 动态裁剪中文字体,让网页中嵌入中文字体成为可能!

使用方法

第一步,在服务器上准备好字体文件:yourfont.ttf(由于 sfntly 的限制,只支持 true-type 格式)。

第二步,引入 JavaScript 脚本:

<h1>这是标题</h1>
<span class="title">这是副标题</span>

<script src="//example.com/?s=h1&family=yourfont"></script>
<script src="//example.com/?s=.title&family=yourfont"></script>

配置

HTTP 服务器

您需要将放置字体的域名下的 /fonts 目录对应到您放置输出字体的目录。

conf/application.conf

  • font.input:字体输入目录
  • font.output:字体输出目录
  • url:服务器的 URL 前缀,例如,当 URL 为 http://example.com 时,@font-face 中的 url 将会为 http://example.com/fonts/generated-name.woff

wcfont's People

Stargazers

 Liu Xiaoyi avatar SPARON avatar Duan Yao avatar Jiu LianCheng avatar

Watchers

Yi Yang avatar Dang Fan avatar

Forkers

levythu thinklib

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.