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

Incorrect calculation of text width (XmbTextEscapement) #728

Closed
setdebug opened this issue Oct 26, 2022 · 5 comments
Closed

Incorrect calculation of text width (XmbTextEscapement) #728

setdebug opened this issue Oct 26, 2022 · 5 comments
Labels
reproducible:fvwm2 Issue is also present in fvwm2 skip:changelog Issue/PR should skip CHANGELOG type:bug Something's broken!

Comments

@setdebug
Copy link

Upfront Information

Please provide the following information by running the command and providing
the output.

fvwm3 1.0.5 (released)
with support for:  ReadLine, XPM, PNG, SVG, Shape, XShm, SM, Bidi text, XRandR, XRender, XCursor, XFT, NLS

Running on FreeBSD 13.1 amd64

The configuration file sets the font as follows:

DefaultFont "-*-helvetica-bold-*-*-*-14-*-*-*-*-*-*-*"

In menus, Alt-Tab, etc., the right side of text appears to be cut off when using this font:

menu
alt-tab

If I edit libs/Flocale.c near line 2229 like this:

else if (flf->fontset != None)
{
	// result = XmbTextEscapement(flf->fontset, tmp_str, new_l);
	XRectangle ink;
	XmbTextExtents(flf->fontset, tmp_str, new_l, &ink, NULL);
	result = ink.x + ink.width;
}

The text isn't cut off anymore; however, underlines are then positioned incorrectly because FlocaleTextWidth returns different values. I can't find an obvious solution to fix the issue without changing how the underlines are drawn.

@setdebug setdebug added the type:bug Something's broken! label Oct 26, 2022
@somiaj
Copy link
Collaborator

somiaj commented Oct 26, 2022

This is actually quite an old bug, unsure if a fix has ever been found.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=243825

Though, most just use XFT fonts these days, and I don't think this is an issue with them. Have you tried using XFT fonts?

@ThomasAdam ThomasAdam added the reproducible:fvwm2 Issue is also present in fvwm2 label Oct 26, 2022
@setdebug
Copy link
Author

setdebug commented Oct 27, 2022

I just tried changing all instances of "-*-helvetica-bold-*-*-*-14-*-*-*-*-*-*-*" to "xft:Helvetica:weight=bold:slant=oblique:pixelsize=14:scalable=False" and the results are exactly the same.

It's interesting this bug is that old - I'm surprised I didn't find that bug report!

@ThomasAdam
Copy link
Member

I'm unlikely to fix this any time soon.

@somiaj
Copy link
Collaborator

somiaj commented Oct 28, 2022

@setdebug It could be that your thought of modifying the underline code is part of what is needed to fix this. If you are going to look at this deeper, and look into modifying the code that draws the underline, here is another old bug report to be aware of (underlines not correctly working with non utf-8 characters). https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464363

@ThomasAdam ThomasAdam added the skip:changelog Issue/PR should skip CHANGELOG label Aug 29, 2023
@ThomasAdam
Copy link
Member

I'm going to close this bug for now. If anyone feels like picking this up and fixing it though, please do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reproducible:fvwm2 Issue is also present in fvwm2 skip:changelog Issue/PR should skip CHANGELOG type:bug Something's broken!
Projects
None yet
Development

No branches or pull requests

3 participants