This PR tries to calculate the maximum decent for the characters used in the username, and then use that to set the ascent for the upper half slice of the avatar.
For the slice of the lower half of the avatar, it is unrealistic to calculate the ascent of the line where it is, because for example, the content of the reply message has not been fetched when the avatar is inserted. So I decided to provide an option telega-avatar-slice-2-ascent, the default is 100 which is the maximum value of ascent, which is to do our best to make it higher than other text. And even setting it to 100 seems to have almost no visual impact. Anyway, no harm in having it as a custom option.
For the avatar of the three lines in @replies, I choose to not touch the original logic, that is keep the ascent as 'center, because we did not calculate the ascent of the second line, so we cannot get the correct height for the third line.
Please let me know if you have any suggestions, thanks! :pray:
This PR tries to calculate the maximum decent for the characters used in the username, and then use that to set the ascent for the upper half slice of the avatar. For the slice of the lower half of the avatar, it is unrealistic to calculate the ascent of the line where it is, because for example, the content of the reply message has not been fetched when the avatar is inserted. So I decided to provide an option
telega-avatar-slice-2-ascent
, the default is 100 which is the maximum value of ascent, which is to do our best to make it higher than other text. And even setting it to 100 seems to have almost no visual impact. Anyway, no harm in having it as a custom option.This PR can solve most of the avatar gaps problems, such as this one mentioned in the following issue.
https://github.com/zevlg/telega.el/issues/317#issuecomment-930042574
For the avatar of the three lines in
@replies
, I choose to not touch the original logic, that is keep the ascent as'center
, because we did not calculate the ascent of the second line, so we cannot get the correct height for the third line.Please let me know if you have any suggestions, thanks! :pray: