Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
girara
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Johannes Löthberg
girara
Commits
949c879a
Commit
949c879a
authored
Sep 03, 2016
by
Sebastian Ramacher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update font handling for changes in Gtk+ 3.21
Signed-off-by:
Sebastian Ramacher
<
sebastian+dev@ramacher.at
>
parent
4d713a0a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
6 deletions
+103
-6
data/girara-post-3.20.css_t
data/girara-post-3.20.css_t
+10
-1
girara/config.c
girara/config.c
+1
-2
girara/internal.h
girara/internal.h
+2
-0
girara/session.c
girara/session.c
+90
-3
No files found.
data/girara-post-3.20.css_t
View file @
949c879a
...
...
@@ -2,7 +2,15 @@
color: @default-fg@;
background-color: @default-bg@;
background-image: none;
font: @font@;
font-family: @font-family@;
font-size: @font-size@;
font-weight: @font-weight@;
box-shadow: none;
border-style: none;
margin: 0px;
padding: @bottombox-padding1@px @bottombox-padding2@px @bottombox-padding3@px
@bottombox-padding4@px;
}
/* Scrollbar */
...
...
@@ -114,4 +122,5 @@
#@session@ scrolledwindow overshoot.right,
#@session@ scrolledwindow overshoot.right:backdrop {
background-color: transparent;
background-image: none;
}
girara/config.c
View file @
949c879a
...
...
@@ -50,8 +50,7 @@ cb_font(girara_session_t* session, const char* UNUSED(name),
{
g_return_if_fail
(
session
!=
NULL
&&
value
!=
NULL
);
girara_template_set_variable_value
(
session
->
private_data
->
csstemplate
,
"font"
,
value
);
css_template_fill_font
(
session
->
private_data
->
csstemplate
,
value
);
}
static
void
...
...
girara/internal.h
View file @
949c879a
...
...
@@ -148,6 +148,8 @@ HIDDEN bool girara_cmd_dump_config(girara_session_t* session,
HIDDEN
bool
girara_sc_feedkeys
(
girara_session_t
*
session
,
girara_argument_t
*
argument
,
girara_event_t
*
event
,
unsigned
int
t
);
HIDDEN
void
css_template_fill_font
(
GiraraTemplate
*
csstemplate
,
const
char
*
font
);
/**
* Structure of a command
*/
...
...
girara/session.c
View file @
949c879a
...
...
@@ -44,7 +44,6 @@ init_template_engine(GiraraTemplate* csstemplate)
{
static
const
char
*
variable_names
[]
=
{
"session"
,
"font"
,
"default-fg"
,
"default-bg"
,
"inputbar-fg"
,
...
...
@@ -78,6 +77,88 @@ init_template_engine(GiraraTemplate* csstemplate)
for
(
size_t
idx
=
0
;
idx
<
LENGTH
(
variable_names
);
++
idx
)
{
girara_template_add_variable
(
csstemplate
,
variable_names
[
idx
]);
}
if
(
gtk_check_version
(
3
,
20
,
0
)
==
NULL
)
{
girara_template_add_variable
(
csstemplate
,
"font-family"
);
girara_template_add_variable
(
csstemplate
,
"font-size"
);
girara_template_add_variable
(
csstemplate
,
"font-weight"
);
}
else
{
girara_template_add_variable
(
csstemplate
,
"font"
);
}
}
void
css_template_fill_font
(
GiraraTemplate
*
csstemplate
,
const
char
*
font
)
{
if
(
gtk_check_version
(
3
,
20
,
0
)
!=
NULL
)
{
girara_template_set_variable_value
(
csstemplate
,
"font"
,
font
);
return
;
}
PangoFontDescription
*
descr
=
pango_font_description_from_string
(
font
);
if
(
descr
==
NULL
)
{
return
;
}
girara_template_set_variable_value
(
csstemplate
,
"font-family"
,
pango_font_description_get_family
(
descr
));
char
*
size
=
g_strdup_printf
(
"%d%s"
,
pango_font_description_get_size
(
descr
)
/
PANGO_SCALE
,
pango_font_description_get_size_is_absolute
(
descr
)
==
FALSE
?
"pt"
:
""
);
girara_template_set_variable_value
(
csstemplate
,
"font-size"
,
size
);
g_free
(
size
);
switch
(
pango_font_description_get_weight
(
descr
))
{
case
PANGO_WEIGHT_THIN
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"thin"
);
break
;
case
PANGO_WEIGHT_ULTRALIGHT
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"ultralight"
);
break
;
case
PANGO_WEIGHT_SEMILIGHT
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"light"
);
break
;
case
PANGO_WEIGHT_LIGHT
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"light"
);
break
;
case
PANGO_WEIGHT_BOOK
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"book"
);
break
;
case
PANGO_WEIGHT_MEDIUM
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"medium"
);
break
;
case
PANGO_WEIGHT_SEMIBOLD
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"semibold"
);
break
;
case
PANGO_WEIGHT_BOLD
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"bold"
);
break
;
case
PANGO_WEIGHT_ULTRABOLD
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"ultrabold"
);
break
;
case
PANGO_WEIGHT_HEAVY
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"heavy"
);
break
;
case
PANGO_WEIGHT_ULTRAHEAVY
:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"ultraheavy"
);
break
;
default:
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"normal"
);
break
;
}
pango_font_description_free
(
descr
);
}
static
void
...
...
@@ -91,10 +172,16 @@ fill_template_with_values(girara_session_t* session)
char
*
font
=
NULL
;
girara_setting_get
(
session
,
"font"
,
&
font
);
if
(
font
!=
NULL
)
{
girara_template_set_variable_value
(
csstemplate
,
"font"
,
font
);
css_template_fill_font
(
csstemplate
,
font
);
g_free
(
font
);
}
else
{
girara_template_set_variable_value
(
csstemplate
,
"font"
,
"monospace normal 9"
);
if
(
gtk_check_version
(
3
,
20
,
0
)
==
NULL
)
{
girara_template_set_variable_value
(
csstemplate
,
"font-family"
,
"monospace"
);
girara_template_set_variable_value
(
csstemplate
,
"font-size"
,
"9pt"
);
girara_template_set_variable_value
(
csstemplate
,
"font-weight"
,
"normal"
);
}
else
{
girara_template_set_variable_value
(
csstemplate
,
"font"
,
"monospace normal 9"
);
}
};
/* parse color values */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment