Welcome Guest, Not a member yet? Register   Sign In
Strip tags
#1

[eluser]basty_dread[/eluser]
how to re place all the font size and font family with the one i will specify?


so i could have uniform font size and font family..

I hope you could help me.. Thanks in advance..
#2

[eluser]Craig A Rodway[/eluser]
Erm... use CSS? :roll:
#3

[eluser]basty_dread[/eluser]
css is not working..
i already tried css.. and its not working..
this is the string that i should replace the formatting:
ie font size = 14px
font-family = arial

[code]
<p>
<span style="font-size:9px;"><span style="font-family:arial,helvetica,sans-serif;">Arial</span></span></p>
<p>
<span style="font-size:10px;"><span style="font-family:comic sans ms,cursive;">Comic Sans</span></span></p>
<p>
<span style="font-size:11px;"><span style="font-family:courier new,courier,monospace;">Courier New</span></span></p>
<p>
<span style="font-size:12px;"><span style="font-family:georgia,serif;">Georgia</span></span></p>
<p>
<span style="font-size:14px;"><span style="font-family:lucida sans unicode,lucida grande,sans-serif;">Lucida Sans Unicode</span></span></p><p>
<span style="font-size:16px;"><span style="font-family:tahoma,geneva,sans-serif;">Tahoma</span></span></p>
<p> <span style="font-size:18px;"><span style="font-family:times new roman,times,serif;">Times New Roman</span></span></p>
<p> <span style="font-size:20px;"><span style="font-family:trebuchet ms,helvetica,sans-serif;">Trebuchet MS</span></span></p>
<p>
<span style="font-size:26px;"><span style="font-family:verdana,geneva,sans-serif;">Verdana</span></span></p>
[code]
#4

[eluser]basty_dread[/eluser]
and this is the coding that i done..
it is working but its very long code..

where $content is the content above.

Code:
$setsize = ":15px"; // this is the size that i want to replace

        $size = array(":6px", ":7px", ":8px", ":9px", ":10px", ":11px", ":12px", ":13px", ":14px", ":15px", ":16px", ":17px", ":18px", ":19px", ":20px", ":21px", ":22px", ":23px", ":24px", ":25px", ":26px");
        $replaced = str_replace($size, $setsize, $content);

$fsetstyle = "family:arial,helvetica,sans-serif"; // this is the font family that i want to replace

$fstyle = array("family:arial,helvetica,sans-serif", "family:comic sans ms,cursive", "family:courier new,courier,monospace", "family:georgia,serif", "family:lucida sans unicode,lucida grande,sans-serif", "family:tahoma,geneva,sans-serif", "family:times new roman,times,serif", "family:trebuchet ms,helvetica,sans-serif", "family:verdana,geneva,sans-serif");

$replaced = str_replace($fstyle, $fsetstyle, $replaced);
#5

[eluser]Craig A Rodway[/eluser]
Code:
$size = '15';
$font = 'arial,helvetica,sans-serif';

$replaced = preg_replace('/([0-9]+px)/', $size.'px', $content);
$replaced = preg_replace('/(font-family:)(.*);/', '$1' . $font . ';', $replaced);
#6

[eluser]basty_dread[/eluser]
Code:
$replaced = preg_replace('/([0-9]+px)/', $size.'px', $content);
this doesnt replace the word with 10px etc..

what might be wrong
#7

[eluser]basty_dread[/eluser]
is there any working code there? pls . help.. thank you..
#8

[eluser]Craig A Rodway[/eluser]
Looks OK to me - output of the code.




Theme © iAndrew 2016 - Forum software by © MyBB