Commit fe2b97fb authored by Julian Sparber's avatar Julian Sparber

avatar: Use a better linear function for padding around the initials

The new function grows quicker and therfore it makes the initials
smaller on a specifc avatar size. It also makes it simpler to adjust the
grow of the padding.
parent b46380dc
Pipeline #54271 passed with stages
in 14 minutes and 33 seconds
......@@ -247,8 +247,10 @@ set_font_size (HdyAvatar *self,
/* This is the size of the biggest square fitting inside the circle */
sqr_size = (gdouble)size / 1.4142;
/* The padding has to be a function of the overall size.
* This one looks pritty good. */
padding = ((gdouble)size - sqr_size) / 2.0;
* The 0.4 is how steep the linear function grows and the -5 is just
* an adjustment for smaller sizes which doesn't have a big impact on bigger sizes.
* Make also sure we don't have a negative padding */
padding = MAX (size * 0.4 - 5, 0);
max_size = sqr_size - padding;
new_font_size = (gdouble)height * (max_size / (gdouble)width);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment