views:

21

answers:

1

Hi, I need to use an exotic font with tiny_mce, I edited the theme_advanced_fonts property and I am using the content_css property to link an stylesheets that defines my font family.

I can select the font from the menu but text is not displayed with that, so I have to edit the source html and the style property for the text to be rendered with the fontface I want.

Thats not a nice thing to ask to my clients.

What can I do?

A: 

I suggest you write your own plugin using a dropdown select list and updating the iframes head with the newly choosen css (font).

The code to set the css could look liek

iframe_id = ed.id;
with(document.getElementById(iframe_id).contentWindow){
  var h=document.getElementsByTagName("head");
  var newStyleSheet=document.createElement("link");
  newStyleSheet.rel="stylesheet";
  newStyleSheet.href="http:myerver.com/css/my.css";
  h[0].appendChild(newStyleSheet);
}
Thariama
Well, checking the source the stylesheet is linked inside the tiny_mce preview iframe, I can display the font I want but only if I edit the source html, not by using the menu, but once I manualy edit the html the menu option for the font I've selected is also selected.
Macario
what kind of menu are you talking about?
Thariama
Tiny_mce has a configuration option called theme_advanced_fonts, whatever font you put there is going to be available in a menu. So there I can see the font I want, I can select it but becomes inmediatelly unselected. If I edit the source and on the visual side put the cursor under text I've defined with my font then the correct option apears selected. Thanks.
Macario
i do not use that one, but i strongly suggest that you write your own plugin using the fonts you desire as a custom input parameter and putting them inside your own tinymce UI dropdwon
Thariama