aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2020-01-16 19:52:40 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2020-01-16 19:52:40 +0100
commita7c62174f60f993faab7ac8dfa3f034ad10c0557 (patch)
tree9d65d604761962d83a15669ae6099f51cae420ed
parent600e480af340d8fb462d7909440d839bc82a428a (diff)
downloadd2tk-a7c62174f60f993faab7ac8dfa3f034ad10c0557.tar.xz
base: put font faces into defines.
-rw-r--r--VERSION2
-rw-r--r--src/base.c4
-rw-r--r--src/base_pty.c15
3 files changed, 14 insertions, 7 deletions
diff --git a/VERSION b/VERSION
index cd63bdd..b1f4994 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.949
+0.1.959
diff --git a/src/base.c b/src/base.c
index 63c11f7..411e5be 100644
--- a/src/base.c
+++ b/src/base.c
@@ -644,11 +644,13 @@ d2tk_base_is_active_hot(d2tk_base_t *base, d2tk_id_t id,
#define light_orange 0xffcf00ff
#define dark_orange 0xcf9f00ff
+#define FONT_SANS_BOLD "FiraSans-Bold.ttf"
+
D2TK_API const d2tk_style_t *
d2tk_base_get_default_style()
{
static const d2tk_style_t style = {
- .font_face = "FiraSans-Bold.ttf",
+ .font_face = FONT_SANS_BOLD,
.border_width = 1,
.padding = 1,
.rounding = 4,
diff --git a/src/base_pty.c b/src/base_pty.c
index 1fd5076..687bb0a 100644
--- a/src/base_pty.c
+++ b/src/base_pty.c
@@ -38,6 +38,11 @@
#define MAX(x, y) (x > y ? y : x)
+#define FONT_CODE_LIGHT "FiraCode-Light.ttf"
+#define FONT_CODE_REGULAR "FiraCode-Regular.ttf"
+#define FONT_CODE_MEDIUM "FiraCode-Medium.ttf"
+#define FONT_CODE_BOLD "FiraCode-Bold.ttf"
+
typedef struct _cell_t cell_t;
typedef struct _d2tk_atom_body_pty_t d2tk_atom_body_pty_t;
@@ -797,15 +802,15 @@ _term_draw(d2tk_base_t *base, d2tk_atom_body_pty_t *vpty,
if(cell->bold)
{
- style.font_face = "FiraCode-Bold.ttf";
+ style.font_face = FONT_CODE_BOLD;
}
else if(cell->italic)
{
- style.font_face = "FiraCode-Light.ttf";
+ style.font_face = FONT_CODE_LIGHT;
}
else
{
- style.font_face = "FiraCode-Regular.ttf";
+ style.font_face = FONT_CODE_REGULAR;
}
d2tk_base_set_style(base, &style);
@@ -817,7 +822,7 @@ _term_draw(d2tk_base_t *base, d2tk_atom_body_pty_t *vpty,
if(cell->cursor)
{
- style.font_face = "FiraCode-Bold.ttf";
+ style.font_face = FONT_CODE_BOLD;
style.text_fill_color[D2TK_TRIPLE_NONE] = 0x0;
style.text_stroke_color[D2TK_TRIPLE_NONE] = focus
? DEFAULT_FG
@@ -880,7 +885,7 @@ d2tk_base_pty(d2tk_base_t *base, d2tk_id_t id, d2tk_clone_t clone, void *data,
style.fill_color[D2TK_TRIPLE_ACTIVE_HOT] = _term_light(vpty);
style.fill_color[D2TK_TRIPLE_ACTIVE_FOCUS] = _term_dark(vpty);
style.fill_color[D2TK_TRIPLE_ACTIVE_HOT_FOCUS] = _term_light(vpty);
- style.font_face = "FiraCode-Regular.ttf";
+ style.font_face = FONT_CODE_REGULAR;
d2tk_base_set_style(base, &style);
_term_resize(vpty, ncols, nrows);