12
167
Fork
You've already forked fnott
32

[feature-request] Vertically centered text #103

Open
opened 2023年07月23日 09:56:07 +02:00 by sewn · 3 comments
Contributor
Copy link

example (mako):

image

fnott:
image

you can see why this doesn't look very nice.

another thing i've noticed and that you can see in the image above, is the fact that the scaled down icon of mako looks alot smoother than what is on fnott.

example (mako): ![image](/attachments/5056199c-db23-4979-8892-50065d2d29bd) fnott: ![image](/attachments/db40fb05-ed03-444b-9a8d-a4b5da111b10) you can see why this doesn't look very nice. another thing i've noticed and that you can see in the image above, is the fact that the scaled down icon of mako looks alot smoother than what is on fnott.
Owner
Copy link

Vertically centered text

I'll have to think about how, if at all, we can do this. Layouting is already complex, and I'd rather not complicate further...

another thing i've noticed and that you can see in the image above, is the fact that the scaled down icon of mako looks alot smoother than what is on fnott.

PNGs, and other raw bitmaps are scaled using pixman's default scaler, which doesn't produce very good results.

Can you try the patch below? It changes the scaling filter to the best one supported by pixman, lanczos3.

diff --git a/notification.c b/notification.c
index d2b9b16..f301171 100644
--- a/notification.c
+++ b/notification.c
@@ -724,10 +724,35 @@ notif_set_image_internal(struct notif *notif, pixman_image_t *pix, bool custom)
 pixman_image_get_width(pix), pixman_image_get_height(pix),
 notif->image_width, notif->image_height);
 
+ struct pixman_f_transform f_scale;
+ pixman_f_transform_init_scale(&f_scale, scale, scale);
+
 struct pixman_transform t;
- pixman_transform_init_scale(
- &t, pixman_double_to_fixed(scale), pixman_double_to_fixed(scale));
+ pixman_transform_from_pixman_f_transform(&t, &f_scale);
 pixman_image_set_transform(pix, &t);
+
+ /* TODO: make scaling filter configurable? */
+ {
+ int param_count = 0;
+#if 0
+ pixman_kernel_t kernel = filter_to_use == FCFT_SCALING_FILTER_CUBIC
+ ? PIXMAN_KERNEL_CUBIC
+ : PIXMAN_KERNEL_LANCZOS3;
+#endif
+ pixman_kernel_t kernel = PIXMAN_KERNEL_LANCZOS3;
+ pixman_fixed_t *params = pixman_filter_create_separable_convolution(
+ &param_count,
+ pixman_double_to_fixed(scale),
+ pixman_double_to_fixed(scale),
+ kernel, kernel,
+ kernel, kernel,
+ pixman_int_to_fixed(1),
+ pixman_int_to_fixed(1));
+
+ pixman_image_set_filter(
+ pix, PIXMAN_FILTER_SEPARABLE_CONVOLUTION, params, param_count);
+ free(params);
+ }
 }
 
 static bool
> Vertically centered text I'll have to think about how, if at all, we can do this. Layouting is already complex, and I'd rather not complicate further... > another thing i've noticed and that you can see in the image above, is the fact that the scaled down icon of mako looks alot smoother than what is on fnott. PNGs, and other raw bitmaps are scaled using pixman's default scaler, which doesn't produce very good results. Can you try the patch below? It changes the scaling filter to the best one supported by pixman, lanczos3. ```diff diff --git a/notification.c b/notification.c index d2b9b16..f301171 100644 --- a/notification.c +++ b/notification.c @@ -724,10 +724,35 @@ notif_set_image_internal(struct notif *notif, pixman_image_t *pix, bool custom) pixman_image_get_width(pix), pixman_image_get_height(pix), notif->image_width, notif->image_height); + struct pixman_f_transform f_scale; + pixman_f_transform_init_scale(&f_scale, scale, scale); + struct pixman_transform t; - pixman_transform_init_scale( - &t, pixman_double_to_fixed(scale), pixman_double_to_fixed(scale)); + pixman_transform_from_pixman_f_transform(&t, &f_scale); pixman_image_set_transform(pix, &t); + + /* TODO: make scaling filter configurable? */ + { + int param_count = 0; +#if 0 + pixman_kernel_t kernel = filter_to_use == FCFT_SCALING_FILTER_CUBIC + ? PIXMAN_KERNEL_CUBIC + : PIXMAN_KERNEL_LANCZOS3; +#endif + pixman_kernel_t kernel = PIXMAN_KERNEL_LANCZOS3; + pixman_fixed_t *params = pixman_filter_create_separable_convolution( + &param_count, + pixman_double_to_fixed(scale), + pixman_double_to_fixed(scale), + kernel, kernel, + kernel, kernel, + pixman_int_to_fixed(1), + pixman_int_to_fixed(1)); + + pixman_image_set_filter( + pix, PIXMAN_FILTER_SEPARABLE_CONVOLUTION, params, param_count); + free(params); + } } static bool ```
Owner
Copy link

Can you try the patch below? It changes the scaling filter to the best one supported by pixman, lanczos3.

Made a PR out of it: #124

> Can you try the patch below? It changes the scaling filter to the best one supported by pixman, lanczos3. Made a PR out of it: https://codeberg.org/dnkl/fnott/pulls/124

Is there any plan for this centring? I think it'd look nicer with the padding I have set :-)

Is there any plan for this centring? I think it'd look nicer with the padding I have set :-)
Sign in to join this conversation.
No Branch/Tag specified
master
releases/1.8
releases/1.7
releases/1.6
releases/1.5
release/1.4
parse-font-apply-fontconfig-rules
releases/1.3
releases/1.2
releases/1.1
releases/1.0
1.8.0
1.7.1
1.7.0
1.6.0
1.5.0
1.4.1
1.4.0
1.3.0
1.2.1
1.2.0
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
0.0.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fnott#103
Reference in a new issue
dnkl/fnott
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?