UI: Configurable UI Font Weight #112454

Merged
Harley Acheson merged 36 commits from Harley/blender:TextUiStyles into main 2023-10-21 00:28:37 +02:00
3 changed files with 58 additions and 5 deletions
Showing only changes of commit 145d0343f1 - Show all commits

View File

@ -1066,11 +1066,11 @@ static FT_GlyphSlot blf_glyph_render(FontBLF *settings_font,
blf_ensure_size(glyph_font);
/* Current variation values. */
float weight = 400.0f;
float slant = 0.0f;
float width = 1.0f;
float spacing = 1.0f;
/* Current (base) style values. */
float weight = settings_font->info.weight;
float slant = settings_font->info.slant;
float width = settings_font->info.width;
float spacing = settings_font->info.spacing;
/* The variation targets we are hoping to get. */
float weight_target = float(settings_font->char_weight);

View File

@ -209,6 +209,42 @@ typedef struct FontBufInfoBLF {
} FontBufInfoBLF;
typedef struct FontInfo {
// preview?
short weight = 400; // default weight, 100 - 900. get from OS/2 usWeightClass
float width = 1.0f; // default width 1.0. get from OS/2 usWidthClass
float slant = 0.0f; // default slant 0.0. get from Post italicAngle;
float spacing = 1.0f; // default spacing 1.0
short family_class;
char panose_family_type;
char panose_serif_style;
char panose_weight;
char panose_proportion;
char panose_contrast;
char panose_stroke_variation;
char panose_arm_style;
char panose_letter_form;
char panose_midline;
char panose_xheight;
short selection_flags;
short first_charindex;
short last_charindex;
short typo_ascender;
short typo_descender;
short typo_linegap;
short x_height;
short cap_height;
short lower_optical_point_size;
short upper_optical_point_size;
// move unicode range bits here too
// CodePageRangebits
} FontInfo;
typedef struct FontBLF {
/** Full path to font file or NULL if from memory. */
char *filepath;
@ -307,6 +343,8 @@ typedef struct FontBLF {
/** Copy of the font->face->face_flags, in case we don't have a face loaded. */
FT_Long face_flags;
FontInfo info;
/** Data for buffer usage (drawing into a texture buffer) */
FontBufInfoBLF buf_info;

View File

@ -896,6 +896,21 @@ void blo_do_versions_userdef(UserDef *userdef)
*/
{
/* Keep this block, even when empty. */
LISTBASE_FOREACH (uiStyle *, style, &userdef->uistyles) {
style->paneltitle.character_weight = 400;
style->paneltitle.character_width = 1.0f;
style->paneltitle.character_spacing = 1.0f;
style->grouplabel.character_weight = 400;
style->grouplabel.character_width = 1.0f;
style->grouplabel.character_spacing = 1.0f;
style->widgetlabel.character_weight = 400;
style->widgetlabel.character_width = 1.0f;
style->widgetlabel.character_spacing = 1.0f;
style->widget.character_weight = 400;
style->widget.character_width = 1.0f;
style->widget.character_spacing = 1.0f;
}
}
LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) {