Font fixes
@lorenzolpandolfo Does this work for you?
I meant to try and commit this to your branch 🤦♂️.
@Moosems I understand what you did because i did it too. For some reason, if we call self.textwidget.cget("font"), it returns a str type for the current font, even if we send like a Font instance or tuple self.config(font=Font("Consolas", 20)).
But yea, we can get the font family and size with some string functions and then create a Font instance. But, I don't know why, the Font.metrics()["linespace"] is returning a wrong size, resulting in a different position to tilde characters.
I was trying to fix these problems but I got exausted and didn't commited anything to not mess the fork.
example 1:
example 2:
this bug happens because the tilde font measurement is wrong.
if we print the dlineinfo for each line, it results (Im using text.config(font="Consolas 18"))
and, if we subtract the 2 from 30, it returns 28, that is the linespace. But if I
print(font.metrics()["linespace"]) it is returning "27"... I don't know why.
And, in my text editor, Pytext, when I run the tilde code, it works with any font problems, I don't know why too.
I need more time to analyze all these situations, but im very confuse with some behaviours!