mirror of
https://github.com/typst/typst
synced 2025-05-15 01:25:28 +08:00
Add font exceptions for Kaiti SC and Kaiti TC (#4616)
This commit is contained in:
parent
d769b21356
commit
5e187a5d05
@ -44,12 +44,14 @@ pub fn find_exception(postscript_name: &str) -> Option<&'static Exception> {
|
|||||||
|
|
||||||
/// A map which keys are PostScript name and values are override entries.
|
/// A map which keys are PostScript name and values are override entries.
|
||||||
static EXCEPTION_MAP: phf::Map<&'static str, Exception> = phf::phf_map! {
|
static EXCEPTION_MAP: phf::Map<&'static str, Exception> = phf::phf_map! {
|
||||||
// The old version of Arial-Black, published by Microsoft in 1996 in their "core fonts for the web" project, has a wrong weight of 400.
|
// The old version of Arial-Black, published by Microsoft in 1996 in their
|
||||||
|
// "core fonts for the web" project, has a wrong weight of 400.
|
||||||
// See https://corefonts.sourceforge.net/.
|
// See https://corefonts.sourceforge.net/.
|
||||||
"Arial-Black" => Exception::new()
|
"Arial-Black" => Exception::new()
|
||||||
.weight(900),
|
.weight(900),
|
||||||
// Archivo Narrow is different from Archivo and Archivo Black. Since Archivo Black seems
|
// Archivo Narrow is different from Archivo and Archivo Black. Since Archivo Black
|
||||||
// identical to Archivo weight 900, only differentiate between Archivo and Archivo Narrow.
|
// seems identical to Archivo weight 900, only differentiate between Archivo and
|
||||||
|
// Archivo Narrow.
|
||||||
"ArchivoNarrow-Regular" => Exception::new()
|
"ArchivoNarrow-Regular" => Exception::new()
|
||||||
.family("Archivo Narrow"),
|
.family("Archivo Narrow"),
|
||||||
"ArchivoNarrow-Italic" => Exception::new()
|
"ArchivoNarrow-Italic" => Exception::new()
|
||||||
@ -321,4 +323,12 @@ static EXCEPTION_MAP: phf::Map<&'static str, Exception> = phf::phf_map! {
|
|||||||
.family("Latin Modern Sans 12"),
|
.family("Latin Modern Sans 12"),
|
||||||
"LMSans17-Oblique" => Exception::new()
|
"LMSans17-Oblique" => Exception::new()
|
||||||
.family("Latin Modern Sans 17"),
|
.family("Latin Modern Sans 17"),
|
||||||
|
// STKaiti is a set of Kai fonts. Their weight values need to be corrected
|
||||||
|
// according to their PostScript names.
|
||||||
|
"STKaitiSC-Regular" => Exception::new().weight(400),
|
||||||
|
"STKaitiTC-Regular" => Exception::new().weight(400),
|
||||||
|
"STKaitiSC-Bold" => Exception::new().weight(700),
|
||||||
|
"STKaitiTC-Bold" => Exception::new().weight(700),
|
||||||
|
"STKaitiSC-Black" => Exception::new().weight(900),
|
||||||
|
"STKaitiTC-Black" => Exception::new().weight(900),
|
||||||
};
|
};
|
||||||
|
@ -79,6 +79,8 @@ impl From<usvg::FontStyle> for FontStyle {
|
|||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
pub struct FontWeight(pub(super) u16);
|
pub struct FontWeight(pub(super) u16);
|
||||||
|
|
||||||
|
/// Font weight names and numbers.
|
||||||
|
/// See `<https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-weight#common_weight_name_mapping>`
|
||||||
impl FontWeight {
|
impl FontWeight {
|
||||||
/// Thin weight (100).
|
/// Thin weight (100).
|
||||||
pub const THIN: Self = Self(100);
|
pub const THIN: Self = Self(100);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user