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] Emoji in the conversation avatar may be slightly misaligned #13923

Open
Antreesy opened this issue Dec 2, 2024 · 2 comments
Open

[Bug] Emoji in the conversation avatar may be slightly misaligned #13923

Antreesy opened this issue Dec 2, 2024 · 2 comments

Comments

@Antreesy
Copy link
Contributor

Antreesy commented Dec 2, 2024

Code reference for used SVG template:

/**
* https://github.com/sebdesign/cap-height -- for 500px height
* Automated check: https://codepen.io/skjnldsv/pen/PydLBK/
* Noto Sans cap-height is 0.715 and we want a 200px caps height size
* (0.4 letter-to-total-height ratio, 500*0.4=200), so: 200/0.715 = 280px.
* Since we start from the baseline (text-anchor) we need to
* shift the y axis by 100px (half the caps height): 500/2+100=350
*
* Copied from @see \OC\Avatar\Avatar::$svgTemplate with some changes:
* - {font} is injected
* - size fixed to 512
* - font-size reduced to 240
* - font-weight and fill color are removed as they are not applicable
*/
private string $svgTemplate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="512" height="512" version="1.1" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="100%" fill="#{fill}"></rect>
<text x="50%" y="330" style="font-size:240px;font-family:{font};text-anchor:middle;">{letter}</text>
</svg>';

Might look different (vertical alignment) in different OS or monitors

@Antreesy Antreesy changed the title Emoji in the avatar is slightly misaligned? @Antreesy [Bug] Emoji in the conversation avatar may be slightly misaligned Dec 2, 2024
@Antreesy Antreesy added this to the 💔 Backlog milestone Dec 2, 2024
@Antreesy
Copy link
Contributor Author

Antreesy commented Dec 2, 2024

Not a solution, but might be copied to adjust dimensions for the SVG

@SystemKeeper
Copy link
Contributor

Sidenote, on macOS with FullHD monitor it looks fine in chrome, but it looks mis-aligned when using a 4K monitor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants