mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2025-10-29 11:48:42 +00:00
Hyprbars: center button text (#291)
This commit is contained in:
parent
557e7b4e11
commit
6d525bcfea
@ -238,8 +238,12 @@ void CHyprBar::renderText(SP<CTexture> out, const std::string& text, const CHypr
|
||||
|
||||
cairo_set_source_rgba(CAIRO, color.r, color.g, color.b, color.a);
|
||||
|
||||
int layoutWidth, layoutHeight;
|
||||
pango_layout_get_size(layout, &layoutWidth, &layoutHeight);
|
||||
PangoRectangle ink_rect, logical_rect;
|
||||
pango_layout_get_extents(layout, &ink_rect, &logical_rect);
|
||||
|
||||
const int layoutWidth = ink_rect.width;
|
||||
const int layoutHeight = logical_rect.height;
|
||||
|
||||
const double xOffset = (bufferSize.x / 2.0 - layoutWidth / PANGO_SCALE / 2.0);
|
||||
const double yOffset = (bufferSize.y / 2.0 - layoutHeight / PANGO_SCALE / 2.0);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user