[2.0.6] Font Face BBCode

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
16
52%
Very Good
11
35%
Good
3
10%
Fair
0
No votes
Poor
1
3%
 
Total votes: 31

User avatar
Ludacris
Registered User
Posts: 57
Joined: Thu Aug 07, 2003 2:25 am
Contact:

Post by Ludacris » Fri Sep 26, 2003 6:02 pm

It just worked for me.
Image

superluigisunshine
Registered User
Posts: 28
Joined: Mon Jul 07, 2003 10:08 pm
Location: Texas
Contact:

Post by superluigisunshine » Sun Sep 28, 2003 2:23 am

Erm...

I tried this, but it still does not work. I am fairly certain I've done this right, but the Font drop down menu isn't there, and when I type [font=arial]text[/font], It just shows that. No font change.

It didn't mess anything up, so... I'm guessing it's just me. :P
I need help.

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sun Sep 28, 2003 6:57 am

superluigisunshine wrote: Erm...

I tried this, but it still does not work. I am fairly certain I've done this right, but the Font drop down menu isn't there, and when I type [font=arial]text[/font], It just shows that. No font change.

It didn't mess anything up, so... I'm guessing it's just me. :P
Do you have a link where I can see it? In any case make sure that you modify the templates (if have other than subSilver, those too.)
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

cchrisr
Registered User
Posts: 30
Joined: Thu Oct 16, 2003 7:47 pm
Location: New Orleans
Contact:

Post by cchrisr » Thu Oct 16, 2003 7:50 pm

I am also having a problem: although the posting page works, the font does not show up. The board is at:
http://unobcm.50free.net/forums/index.php

I've looked around and it seems as if the html font tag isn't being posted with the text; but bear in mind that I'm not an expert (hence, my post :D )

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sat Oct 18, 2003 8:26 am

cchrisr wrote: I am also having a problem: although the posting page works, the font does not show up. The board is at:
http://unobcm.50free.net/forums/index.php

I've looked around and it seems as if the html font tag isn't being posted with the text; but bear in mind that I'm not an expert (hence, my post :D )

The URL doesn't work for me.

Anyhow, the font type is using CSS (Cascading Style Sheets) in a span tag as the font tag is depreciated in the HTML standard. If the span tag with the font information isn't there, then you have to check bbcode.php and bbcode.tpl for errors.
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

_Pegasus
Registered User
Posts: 55
Joined: Fri Mar 14, 2003 3:10 pm
Location: Fullerton, CA
Contact:

Post by _Pegasus » Sat Oct 18, 2003 8:39 am

I just installed it and it "mostly" works.

It will not work for a couple of fonts that I believe should work.

It works for these two fonts that I added...

Code: Select all

$lang['font']['tahoma'] = 'Tahoma, Verdana';
$lang['font']['script'] = 'Script, serif';
but not these two...

Code: Select all

$lang['font']['comic'] = 'Comic Sans MS, sans-serif';
$lang['font']['black'] = 'Arial Black';
** Both fonts are standard Windows fonts, so that shouldn't be an issue, should it?

Also, I do not have or see a drop down list of fonts as others here seem to.
Pegasus Productions
SimCity 4 Custom Mods & Fansite

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sat Oct 18, 2003 10:58 am

_Pegasus wrote: but not these two...

Code: Select all

$lang['font']['comic'] = 'Comic Sans MS, sans-serif';
$lang['font']['black'] = 'Arial Black';
** Both fonts are standard Windows fonts, so that shouldn't be an issue, should it?

Some browsers might have problems with fonts that have blanks in their name, so try:

Code: Select all

$lang['font']['comic'] = '\'Comic Sans MS\', sans-serif';
$lang['font']['black'] = '\'Arial Black\'';
As to the drop down list problem. Check the templates/subSilver/posting_body.tpl template for correctness
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

_Pegasus
Registered User
Posts: 55
Joined: Fri Mar 14, 2003 3:10 pm
Location: Fullerton, CA
Contact:

Post by _Pegasus » Sat Oct 18, 2003 4:43 pm

Herbalite wrote:
_Pegasus wrote:but not these two...

Code: Select all

$lang['font']['comic'] = 'Comic Sans MS, sans-serif';
$lang['font']['black'] = 'Arial Black';
** Both fonts are standard Windows fonts, so that shouldn't be an issue, should it?

Some browsers might have problems with fonts that have blanks in their name, so try:

Code: Select all

$lang['font']['comic'] = '\'Comic Sans MS\', sans-serif';
$lang['font']['black'] = '\'Arial Black\'';


I gave that a try suspecting that was not the issue because the provided Times New Roman font, which also has spaces in the name, works fine. Example:

Code: Select all

$lang['font']['times'] = 'Times New Roman, serif';
The Comic and Arial Black fonts still refuse to work.
Herbalite wrote: As to the drop down list problem. Check the templates/subSilver/posting_body.tpl template for correctness


Checked and rechecked... I was mistaken. The drop down box displays. I didn't notice it because its empty.. has no "Font Face:" label, and is too long to display on the same row as the drop down boxes.

When I drop down the box, only "Font Face" is listed... none of the font names are displayed.
Pegasus Productions
SimCity 4 Custom Mods & Fansite

_Pegasus
Registered User
Posts: 55
Joined: Fri Mar 14, 2003 3:10 pm
Location: Fullerton, CA
Contact:

Post by _Pegasus » Sat Oct 18, 2003 5:37 pm

Herbalite wrote: Some browsers might have problems with fonts that have blanks in their name, so try:

Code: Select all

$lang['font']['comic'] = '\'Comic Sans MS\', sans-serif';
$lang['font']['black'] = '\'Arial Black\'';
As to the drop down list problem. Check the templates/subSilver/posting_body.tpl template for correctness


Here's an Update....

Drop Down Box
I noticed that the empty drop down box contained several empty lines... as if it was being populated with the font options but the text wasn't displaying. I found that the font names display only if you move your cursor over them. Something is weird with the drop down box behavior. Note that the other drop down boxes (Font Color and Font Size) function properly.

Non Functional Fonts
I discovered how to make the Comic & Arial Black fonts work... but the method is inconsistant.

Here is my font list as it appears in lang_main.php:

Code: Select all

$lang['Font_style'] = 'Font Face';
// Add/remove your font-faces for this language here into the array
$lang['font']['arial'] = 'Arial, sans-serif';
$lang['font']['courier'] = 'Courier, Courier New, monospace';
$lang['font']['times'] = 'Times New Roman, serif';
$lang['font']['tahoma'] = 'Tahoma, Verdana';
$lang['font']['verdana'] = 'Verdana, sans-serif';
$lang['font']['comic'] = 'Comic Sans MS, sans-serif'; 
$lang['font']['black'] = 'Arial Black, sans-serif';
$lang['font']['script'] = 'Script, serif';


I found that while posting a message, if I applied the fonts via the drop down box, dispite the display issue noted above, the fonts worked.

Here is the text I typed in the message:

Code: Select all

** Tags applied by drop down box **
[font=Arial Black, sans-serif]Test of Arial Black Text.[/font][/b]
[font=Comic Sans MS,Arial]Test of  Comic Text.[/font]
[font=Arial, sans-serif]Test of Arial Text.[/font]

** Tags applied manually **
[font=arial]Test of Arial Text.[/font]
[font=times]Test of Times Text.[/font]
When applied from the drop down box, note that the alternate font names are applied as well... and the short or token name of the font is not used.

However, the short/token font names can be applied manually, but still only work for certain fonts. It appears that when the short/token font name is used, its not consistantly inserting or converting to the proper font & alternate font names. (which I'm guessing is what it does)

** Also... the Courier font as originally provided in the code did not function, when applied manually, until I added Courier New as an alternate font... even though the Courier font is installed on my system.[/b]
Pegasus Productions
SimCity 4 Custom Mods & Fansite

_Pegasus
Registered User
Posts: 55
Joined: Fri Mar 14, 2003 3:10 pm
Location: Fullerton, CA
Contact:

Post by _Pegasus » Sun Oct 19, 2003 12:53 am

Further (Final?) Update...

Drop Down Box Display Issue
I solved the drop down display issues. The "genmed" class on the template I'm using sets the font color to white... which of course does not show on the white background of the drop box.

It was easier to just delete the two ' class="genmed" ' references in the added code than to define another class w/ black text in that template's .css sheet... although that would have been the proper way to do it.

And because the alternate fonts also show up in the drop down box, it is too wide to fit on the same row with the Font Color & Font Size drop downs. I deleted the alternate fonts and reduced the other drop down's labels to "Color" and Size"... and all three drop downs now fit on the same line

** This is full screen at 1024x768 resolution. The position issue of the drop down may also have merely been an issue with the particular template (Black Soul) I was using.

Non Functional Fonts
All fonts work properly when selected from the drop down box. However, the Comic Sans MS and Arial Black fonts still will not work when typed in manually using the short/token names.

** Also, selecting a font from the drop down, without any text highlighted, always adds the tags to the end of the message... not at the current position of the cursor. All the bbcode tags work this way; its not an issue with this mod. Its just annoying... and a good idea for a mod/fix (hint, hint, nudge, nudge) if one does not already exist.
Pegasus Productions
SimCity 4 Custom Mods & Fansite

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sun Oct 19, 2003 4:31 am

Thanks to your feedback, I think I now where the problem lies. As soon as I find a fix I will post it here, and also provide an updated MOD for it
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

_Pegasus
Registered User
Posts: 55
Joined: Fri Mar 14, 2003 3:10 pm
Location: Fullerton, CA
Contact:

Post by _Pegasus » Sun Oct 19, 2003 5:41 am

Herbalite wrote: Thanks to your feedback, I think I now where the problem lies. As soon as I find a fix I will post it here, and also provide an updated MOD for it


Great!!

... and thanks for the Great mod and the support! :D
Pegasus Productions
SimCity 4 Custom Mods & Fansite

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Mon Oct 20, 2003 12:15 am

Here is what it needs to be able to use the short names from
$lang['font']['....'];

However I won't add it to the official MOD for following reasons:

1) one has to know the internal list of shortnames. So the usefulness is very limited.

2) it's for my standards a pretty ugly hack.

Having said that, here are the instructions to use after installation of the MOD.

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
includes/bbcode.php

#
#-----[ FIND ]------------------------------------------
#

	$text = preg_replace("/\[font=(.*?):$uid\]/si", $bbcode_tpl['font_open'], $text);
	$text = str_replace("[/font:$uid]", $bbcode_tpl['font_close'], $text);

#
#-----[ REPLACE WITH ]------------------------------------------
#

	if (($fm = preg_match_all ("/\[font=(.*?):$uid\]/si", $text, $font_match)))
	{
		for ($f = 0; $f < $fm; $f++)
		{
			if (isset ($lang['font'][$font_match[1][$f]]))
			{
				$text = str_replace("[font=" . $font_match[1][$f] . ":$uid]", "[font=" . $lang['font'][$font_match[1][$f]] . ":$uid]", $text);
			}
		}
		$text = preg_replace("/\[font=(.*?):$uid\]/si", $bbcode_tpl['font_open'], $text);
		$text = str_replace("[/font:$uid]", $bbcode_tpl['font_close'], $text);
	}

In the interest of cutting costs, the light at the end of the tunnel has been switched off...

_Pegasus
Registered User
Posts: 55
Joined: Fri Mar 14, 2003 3:10 pm
Location: Fullerton, CA
Contact:

Post by _Pegasus » Mon Oct 20, 2003 1:11 am

Herbalite wrote: Here is what it needs to be able to use the short names from
$lang['font']['....'];

However I won't add it to the official MOD for following reasons:
1) one has to know the internal list of shortnames. So the usefulness is very limited.

2) it's for my standards a pretty ugly hack.


Not too ugly. Lets say its beauty lies in its functionality. :wink:

It works great. It worked on the two fonts (Arial Black & Comic Sans MS) that I was having short name problems with.

I also rechecked all the other fonts I had added, both using short names and the full names generated by the drop down box... and everything works perfectly. GREAT JOB !!!

** I'd suggest considering putting this fix in the mod. I agree that the short names are going to get far less use, primarily because they can only be entered manually. But at least that functionality would be there for those who prefer it.

An "undocumented feature" is often better than no feature at all. And that functionality would be there when/if you discover a way to make the short name usage more evident...

...such as populating the drop down box with the short names instead of the formal font names... and reworking the code accordingly.

Thanks again for the Great Mod and the great support!! :D
Pegasus Productions
SimCity 4 Custom Mods & Fansite

cchrisr
Registered User
Posts: 30
Joined: Thu Oct 16, 2003 7:47 pm
Location: New Orleans
Contact:

Post by cchrisr » Mon Oct 20, 2003 1:57 pm

danke schon.

Post Reply

Return to “[2.0.x] MOD Database Cleanup”