Bugfix for Large Font extension — size depends on HTML nesting level

Please post any support questions here. Guest posting is allowed
luo-ning
Posts: 6
Joined: Tue Mar 08, 2022 2:44 am

Bugfix for Large Font extension — size depends on HTML nesting level

Post by luo-ning »

Duplicating this from https://www.phpbb.com/customise/db/exte ... 01#p830201
===
===
There's a bug in the implementation of the font size options: they're implemented by setting a percentage font-size on the selector *, meaning that every child element is scaled by that amount, relative to its parent. So an element with 3 ancestors is rendered at [percentage] ^ (3 + 1), e.g. for 105% it would be ~121.55%; meanwhile, an element with 10 ancestors would be rendered at 105% ^ (10 + 1) ≈ 171.03%.

To put it another way, <span><span>abc</span></span> is bigger than <span>abc</span>, even if those span elements have no styling info associated with them!

This already looks a little off if you choose "130%" (the actual value used for this is 104%, presumably because actually using 130% would look horrendous). Worse, if you choose the maximum "400%" (actual value 120%), elements closer to the root are rendered at a reasonable but slightly-increased size, whereas elements further from the root are rendered at a GIGANTIC size. Here's an example:
===
400pct-before.png
===
The main heading, "Panel de Control de Usuario", is comparatively tiny, whereas the option "Los usuarios pueden contactarme por email" is so massive it's pushed the "Sí" and "No" options into the page margin.

===

===
I couldn't find a publicly-accessible repo, so I forked it and made changes (against 3.2.4-RC2) here: https://github.com/lionel-rowe/phpbb-la ... 586820c6cb

This fixes the bug and gives consistent scaling across all of the UI. Here's 400% after the change:
===
400pct-after.PNG
You do not have the required permissions to view the files attached to this post.
Administrator
Site Admin
Posts: 756
Joined: Tue Nov 18, 2014 11:30 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by Administrator »

Many thanks for your input. I have tried your suggested code and I can not see any difference in behaviour on my testing board. I have edited both files and it all looks the same to be.

I understand your thinking behind the idea, its just not working for me. Am I missing something?
luo-ning
Posts: 6
Joined: Tue Mar 08, 2022 2:44 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by luo-ning »

Administrator wrote: Tue Mar 08, 2022 9:45 am I have tried your suggested code and I can not see any difference in behaviour on my testing board.
Hmm, that's weird. Any chance you could post before and after screenshots of the user control panel at 400% setting? That was how I could see the difference most clearly.
Administrator
Site Admin
Posts: 756
Joined: Tue Nov 18, 2014 11:30 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by Administrator »

@400%

Before VVVV

before.jpg

After VVVV

after.jpg
You do not have the required permissions to view the files attached to this post.
luo-ning
Posts: 6
Joined: Tue Mar 08, 2022 2:44 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by luo-ning »

Ahh, it looks like it didn't update with the changes, so I'd guess it's a caching issue. Does it persist after purging the cache?
Administrator
Site Admin
Posts: 756
Joined: Tue Nov 18, 2014 11:30 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by Administrator »

Naturally that was the first thing I tried, I have also tried a fresh install, with the same result.
luo-ning
Posts: 6
Joined: Tue Mar 08, 2022 2:44 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by luo-ning »

Curiouser and curiouser... is it correctly rendering the updated CSS? It should now be rendering as

Code: Select all

body > * {
    font-size: 400%;
}
instead of

Code: Select all

* {
    font-size: 120%;
}
The screenshots in my post are from a fresh local install of phpBB 3.3.5, with unchanged 3.2.4-RC2 vs. my forked version of 3.2.4-RC2.
Administrator
Site Admin
Posts: 756
Joined: Tue Nov 18, 2014 11:30 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by Administrator »

120%
screenshot_818.jpg
You do not have the required permissions to view the files attached to this post.
luo-ning
Posts: 6
Joined: Tue Mar 08, 2022 2:44 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by luo-ning »

It looks like the new code has got added, but the old code hasn't been removed, causing a syntax error in the CSS:
 
css-syntax-err.png
 
I posted a link to the diff to make viewing the side-by-side changes easier, but you'd want to copy over the whole of the relevant source files, rather than selectively copy-pasting from the diff. For convenience, here's a zipped version that can be used as a drop-in replacement for the whole extension:

https://github.com/lionel-rowe/phpbb-la ... RC2-forked
You do not have the required permissions to view the files attached to this post.
Administrator
Site Admin
Posts: 756
Joined: Tue Nov 18, 2014 11:30 am

Re: Bugfix for Large Font extension — size depends on HTML nesting level

Post by Administrator »

... and now it appears to be working correctly.

How very strange :smt017

Thanks for your input, I will do some more testing when I have the time and then upload it to this site.