News:

Wondering if this will always be free?  See why free is better.

Main Menu

Font size by percent issue

Started by Blackylol, April 24, 2012, 09:22:51 PM

Previous topic - Next topic

Blackylol

I have seen some users posts in my forums with font bbcode like this [size=75%]text[/size] but I don't have any mod that does that in percents, I asked some people that done this in their posts and they have no idea why.

the only mod i have modifying posts are

Enhanced Dropdown
WYSIWYG Quick Reply


and ideas why is this happening ?
SMF 2.0.2

ziycon

You can use percentages for font size in SMF, its not a mod, its standard functionality.

Blackylol

well the problem is that the bbcode is not being processed, you can see the code as part of the text in the final post.
SMF 2.0.2

ziycon

Sorry, that was was incorrect. I saw point and not percentage. Percentage wont work, only pt will, for example .

MrPhil

The SMF size tag will accept 1-99 pt, 1-99 px, 0.1-9.99 em, small[er], large[r], x[x]-small, x[x]-large, medium, or HTML-style font size number 1 through 7.

CSS permits % as a font-size value, so the parse_bbc() code for the size tag could be extended:
'test' => '([1-9][\d]?p[xt]|small(?:er)?|large[r]?|x[x]?-(?:small|large)|medium|(0\.[1-9]|[1-9](\.[\d][\d]?)?)?em)\]',
to
'test' => '([1-9][\d]?p[xt]|small(?:er)?|large[r]?|x[x]?-(?:small|large)|medium|(0\.[1-9]|[1-9](\.[\d][\d]?)?)?em)\]|[1-9][\d]{0,2}%',

That might work out... possibly the % needs to be escaped \% .

Blackylol

nice that worked thanks, but there's no way to limit the % ? i can make crazy things like [size=99999%]asd[/size] and the font will be that big  ::)
SMF 2.0.2

Colin

Good point. I don't think there is. Might be a good thing to put in the feature request board.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

MrPhil

The code I gave,
[1-9][\d]{0,2}%
should allow between 1% and 999%, AFAICT. Is it actually permitting larger sizes? If it is, I'm not sure what's happening. You entered it exactly as given?

You might have to add a 'validate' element (function definition) to get finer control if 999% (9.99x larger) is too large, or you could play with the 'test' element to define a tighter range.

Advertisement: