Skip to content

Instantly share code, notes, and snippets.

@Hexcles
Last active January 2, 2022 03:35
Show Gist options
  • Save Hexcles/6325659 to your computer and use it in GitHub Desktop.
Save Hexcles/6325659 to your computer and use it in GitHub Desktop.
Font substitute CSS for web pages
/*
* Replace ugly Chinese bitmap fonts with system default sans-serif.
* ATTENTION: this will intentionally change the appearance of web pages!
* Most Chinese websites do not mean to use serif fonts, especially for these ugly ones.
*/
@font-face {
font-family: "宋体";
src: local("sans-serif");
}
@font-face {
font-family: "SimSun";
src: local("sans-serif");
}
@font-face {
font-family: "新宋体";
src: local("sans-serif");
}
@font-face {
font-family: "NSimSun";
src: local("sans-serif");
}
@font-face {
font-family: "华文中宋";
src: local("sans-serif");
}
@font-face {
font-family: "STZhongsong";
src: local("sans-serif");
}
/*
* Replace ugly English (bitmap) monospace fonts.
* This will change the appearance and even layout a little bit.
*/
@font-face {
font-family: "Courier";
src: local("monospace");
}
/* Courier New will be replaced below. */
@font-face {
font-family: "Lucida Console";
src: local("monospace");
}
@font-face {
font-family: "Consolas";
src: local("monospace");
}
/*
* Replace some commercial/bad-rendering Chinese sans-serif fonts with system default.
* This will change the appearance and even layout a little bit.
*/
@font-face {
font-family: "微软雅黑";
src: local("sans-serif");
}
@font-face {
font-family: "Microsoft YaHei";
src: local("sans-serif");
}
@font-face {
font-family: "Microsoft JhengHei";
src: local("sans-serif");
}
@font-face {
font-family: "黑体";
src: local("sans-serif");
}
@font-face {
font-family: "SimHei";
src: local("sans-serif");
}
@font-face {
font-family: "华文细黑";
src: local("sans-serif");
}
@font-face {
font-family: "STXihei";
src: local("sans-serif");
}
@font-face {
font-family: "STHeiTi";
src: local("sans-serif");
}
@font-face {
font-family: "幼圆";
src: local("sans-serif");
}
/*
* Replace some commercial/bad-rendering English fonts with
* open-source/freetype-friendly substitutions.
* They have nearly the same metrics and style!
*/
@font-face {
font-family: "Arial";
src: local("Liberation Sans");
}
@font-face {
font-family: "Times New Roman";
src: local("Liberation Serif");
}
@font-face {
font-family: "Courier New";
src: local("Liberation Mono");
}
@font-face {
font-family: "Tahoma";
src: local("DejaVu Sans Condensed");
}
/* Verdana and DejaVu Sans look similar but have different spacing. */
/*
* Try avoiding unnecessary rules.
* The original version of the following fonts don't exist on my machine,
* and the replacement is done by fontconfig. */
/*
@font-face {
font-family: "Calibri";
src: local("Carlito");
}
@font-face {
font-family: "Cambria";
src: local("Caladea");
}
@font-face {
font-family: "Helvetica";
src: local("TeX Gyre Heros");
}
@font-face {
font-family: "Helvetica Neue";
src: local("TeX Gyre Heros");
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment