Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Text alignment issues when using different font sizes on the same line #2026

Open
Tchou opened this issue Sep 1, 2024 · 2 comments
Open
Labels
bug Bug report or bug fix PR triage Issue that hasn't been verified

Comments

@Tchou
Copy link

Tchou commented Sep 1, 2024

What happened?

Conky version: 1.21.7
Backend: X11
Font engine: xft

While investigating why conky was truncating its content (last lines of text partially cut), I found out that it behaves randomly when using different font sizes on the same line. Note that even at the same pixelsize, some fonts may be higher than others. Also it is a common use case to have several fonts on the same line (e.g. using a symbolic font for icons and a regular one for text). A simple reproducer is the following one (note the two pixel sizes at the bottom of the config):

conky.config = {
    background = false,
    own_window = true,
    own_window_argb_visual = true,
    own_window_type = 'desktop',
    alignment = 'top_right',
    draw_outline = false,
    draw_shades = false,
    minimum_height = 1,
    minimum_width = 10,
    maximum_width = 4000,
    draw_borders = false,
    border_outer_margin = 0,
    border_inner_margin = 0,
    border_width = 0,
    use_xft = true,
    font = 'Hack:pixelsize=30',
    font0 = 'Helvetica:pixelsize=30'
}
conky.text = [[\
1 ${font}A${font0}B${font}C${font0}D${font}E
2 ${font}A${font0}B${font}C${font0}D${font}E
3 ${font}A${font0}B${font}C${font0}D${font}E
4 ${font}A${font0}B${font}C${font0}D${font}E]]

I expect conky to display 4 lines. Because the fontsizes are different, the text is misaligned and the text height computation is wrong.
image

If we increase the font0 size a bit, the errors seem to compensate somehow:

 font = 'Hack:pixelsize=30',
 font0 = 'Helvetica:pixelsize=40'

image
The text is misaligned, but still stays within the computed line height, the the four lines appear. Changing the size so that font is larger is worse:

 font = 'Hack:pixelsize=40',
 font0 = 'Helvetica:pixelsize=30'

image

I would expect the various texts to be aligned along their baseline.

Version

1.21.7

Which OS/distro are you seeing the problem on?

Ubuntu

Conky config

conky.config = {
    background = false,
    own_window = true,
    own_window_argb_visual = true,
    own_window_type = 'desktop',
    alignment = 'top_right',
    draw_outline = false,
    draw_shades = false,
    minimum_height = 1,
    minimum_width = 10,
    maximum_width = 4000,
    draw_borders = false,
    border_outer_margin = 0,
    border_inner_margin = 0,
    border_width = 0,
    use_xft = true,
    font = 'Hack:pixelsize=30',
    font0 = 'Helvetica:pixelsize=30'
}
conky.text = [[\
1 ${font}A${font0}B${font}C${font0}D${font}E
2 ${font}A${font0}B${font}C${font0}D${font}E
3 ${font}A${font0}B${font}C${font0}D${font}E
4 ${font}A${font0}B${font}C${font0}D${font}E]]

Stack trace

No response

Relevant log output

No response

@Tchou Tchou added bug Bug report or bug fix PR triage Issue that hasn't been verified labels Sep 1, 2024
@Tchou
Copy link
Author

Tchou commented Sep 1, 2024

To anyone reading this, the link points to a suspicious windows binary.
@brndnmtthws can you delete/hide the above comment ? I have already reported this user to GH.

Repository owner deleted a comment Sep 1, 2024
@brndnmtthws
Copy link
Owner

To anyone reading this, the link points to a suspicious windows binary. @brndnmtthws can you delete/hide the above comment ? I have already reported this user to GH.

Weird, thanks. Comment deleted and that account has been blocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR triage Issue that hasn't been verified
Projects
None yet
Development

No branches or pull requests

2 participants