From be6506ca04ccce10868a8cd51d89e586284d149b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 25 Jul 2014 16:24:26 -0400 Subject: [PATCH] Add FC_WEIGHT_DEMILIGHT Part of https://bugs.freedesktop.org/show_bug.cgi?id=81453 Also hooks up FC_WEIGHT_BOOK to fcfreetype.c. --- doc/fontconfig-user.sgml | 2 ++ fontconfig/fontconfig.h | 2 ++ src/fcfreetype.c | 8 +++++++- src/fcname.c | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml index 775d1f7..b54ba7a 100644 --- a/doc/fontconfig-user.sgml +++ b/doc/fontconfig-user.sgml @@ -473,6 +473,8 @@ symbolic names for common font values: extralight weight 40 ultralight weight 40 light weight 50 + demilight weight 65 + semilight weight 65 book weight 75 regular weight 80 normal weight 80 diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 8575cc4..1f26cb4 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -131,6 +131,8 @@ typedef int FcBool; #define FC_WEIGHT_EXTRALIGHT 40 #define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT #define FC_WEIGHT_LIGHT 50 +#define FC_WEIGHT_DEMILIGHT 65 +#define FC_WEIGHT_SEMILIGHT FC_WEIGHT_DEMILIGHT #define FC_WEIGHT_BOOK 75 #define FC_WEIGHT_REGULAR 80 #define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 000b101..0e1ff5d 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1095,6 +1095,8 @@ static const FcStringConst weightConsts[] = { { (FC8) "thin", FC_WEIGHT_THIN }, { (FC8) "extralight", FC_WEIGHT_EXTRALIGHT }, { (FC8) "ultralight", FC_WEIGHT_ULTRALIGHT }, + { (FC8) "demilight", FC_WEIGHT_DEMILIGHT }, + { (FC8) "semilight", FC_WEIGHT_SEMILIGHT }, { (FC8) "light", FC_WEIGHT_LIGHT }, { (FC8) "book", FC_WEIGHT_BOOK }, { (FC8) "regular", FC_WEIGHT_REGULAR }, @@ -1632,8 +1634,12 @@ FcFreeTypeQueryFace (const FT_Face face, weight = FC_WEIGHT_THIN; else if (os2->usWeightClass < 250) weight = FC_WEIGHT_EXTRALIGHT; - else if (os2->usWeightClass < 350) + else if (os2->usWeightClass < 325) weight = FC_WEIGHT_LIGHT; + else if (os2->usWeightClass < 365) + weight = FC_WEIGHT_SEMILIGHT; + else if (os2->usWeightClass < 390) + weight = FC_WEIGHT_BOOK; else if (os2->usWeightClass < 450) weight = FC_WEIGHT_REGULAR; else if (os2->usWeightClass < 550) diff --git a/src/fcname.c b/src/fcname.c index 4666178..1d8fe75 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -136,6 +136,8 @@ static const FcConstant _FcBaseConstants[] = { { (FcChar8 *) "thin", "weight", FC_WEIGHT_THIN, }, { (FcChar8 *) "extralight", "weight", FC_WEIGHT_EXTRALIGHT, }, { (FcChar8 *) "ultralight", "weight", FC_WEIGHT_EXTRALIGHT, }, + { (FcChar8 *) "demilight", "weight", FC_WEIGHT_DEMILIGHT, }, + { (FcChar8 *) "semilight", "weight", FC_WEIGHT_DEMILIGHT, }, { (FcChar8 *) "light", "weight", FC_WEIGHT_LIGHT, }, { (FcChar8 *) "book", "weight", FC_WEIGHT_BOOK, }, { (FcChar8 *) "regular", "weight", FC_WEIGHT_REGULAR, },