Giter Club home page Giter Club logo

fonts.css's Introduction

Fonts.css -- 跨平台中文字体解决方案

一直以来跨平台的中文字体 CSS 设置都是一件让人很头疼的事情,这个库打包了一些常见字体的名字,希望能覆盖 Windows、Mac 以及 Linux 的常见字体,方便引用。在 font-family 直接支持宋、楷、黑和仿宋之前,我觉得这样一种解决方案依然还是有其存在价值的。

Demo & Doc

https://zenozeng.github.io/fonts.css/

NPM

npm install fonts.css --save

Usage

<head>
    <link rel="stylesheet" type="text/css" href="fonts.css" />
</head>
<body>
    <p class="font-kai">
        故天将降大任于是人也必先苦其心智劳其筋骨饿其体肤空乏其身行弗乱其所为所以动心忍性曾益其所不能
    </p>
</body>

Contributors

License

Copyright (C) 2013-2018 Zeno Zeng and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Footnote

fonts.css's People

Contributors

8788 avatar dependabot[bot] avatar dingyx99 avatar fyears avatar zenozeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fonts.css's Issues

两个小问题

  1. 黑体为何要加 Tahoma 且加在 Arial 前面?Tahoma 和 Arial 都是 Windows 带的字体,没必要包含两个,而 Arial 更接近 Helvetica。
  2. 应该给楷体、仿宋的方案增加英文字体,常见的楷体、仿宋的英文部分惨不忍睹。

The repository problem in npm

Hi @zenozeng ,
I am the member of cdnjs project,
and we want to host this library,
I have some problems,
I downloaded the library from npm,
but I found that there are only two versions (v1.3.1 , v1.4.0) in npm.
However there are 5 versions in github.
Can you help me add the missing repositories (v1.0.0 , v1.1.0, v1.3.0)? Thanks!

cdnjs/cdnjs#9171

Western glyphs for Chinese punctuation marks

Since the code points of the curved quotation marks are shared by Chinese and Western scripts, according to the generated CSS, the quotation marks are displayed as Western quotation marks, because Western fonts (like Noto Sans) are put before Chinese fonts, which do not conform to the Chinese layout requirements. Dashes, ellipses, and middle dots have the same problem.

The clreq project solves this by using the unicode-range CSS descriptor: https://github.com/w3c/clreq/blob/gh-pages/local.css

调整华文字体的顺序

版权问题不应该由前端负责,显示效果的优先级应该更高。
何况在 Mac 中华文为默认字体。
一个字体既然能被调用,对于 API 层级来说应该就认为它是可用的。

Font weight of Source Han Sans family

Each font of Source Han Sans family has seven font weights: Extra Light, Light, Regular, Normal, Medium, Bold, Heavy. They are separated into seven fonts (seven otf or one otc), but they belong to the same font family Source Han Sans CN/TWHK/JP/KR.

If the operating system handles opentype fonts correctly, then they can be used as one single font, for example "Source Han Sans CN". When you ask for different font weight, the system will select the correct variation to render instead of using pseudo bold/light version. This is the case in Linux and Mac OSX. Windows needs to be tested.

Therefore, the correct font-family name in CSS should not have "normal" or other suffixes.

Traditional Chinese support

I am thinking about how to deal with Traditional Chinese better.

Currently the font sequence works good for SC, but not OK for TC. The most troublesome part is that some characters have the same code point in SC and TC but have different "standard" or "preferred" glyphs.

Another problem is that the popular/preferred fonts in mainland and TWHK are not the same.

Source Han Sans project works this problem around by providing two version of fonts (CN and TWHK). What should we do? Two CSS?

Use the original pangram

The phrase

The quick brown fox jumps over the lazy dog

is the original and widely-used pangram, while

a fox jumps over the lazy dog

is not.

增加英文支持

英文在中文网页下还蛮常见的,可能需要优化一下显示吧,对各个字体的搭配,另外less重用时最好要允许定制英文fallback。

AR PL New Sung

In Archlinux, I cannot find "AR PL SungtiL" but found "AR PL New Sung" (opendesktop-fonts package) which is also licensed under APL. It is also a good serif/song font. You might wish to add it before/after SungtiL.

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.