Jump to content

Using Typekit and other font services in TinyMCE


thetuningspoon
 Share

Recommended Posts

Up until now I have used Google Web Fonts for all my advanced type needs. With Google Web Fonts, creating a consistent user experience for the site editor between the WYSIWYG editor and the front end was easy. Here's what I would do:

  1. Use @import directly at the top of the site's main CSS file (instead of importing the fonts in the HTML <head>, which is Google's default suggestion).
     
  2. Specify a custom content.css in the TinyMCE field settings and then use an @import statement at the top of this file to import your site's main CSS file from step 1. Doing this makes all your styles and fonts available from within TinyMCE.
     
  3. After the @import statement in your content.css, overwrite any styles from the main CSS file that you don't want to apply in the TinyMCE field. For example, if you specified a background for your body tag you will probably want to overwrite this with background:#FFFFFF.

This worked great for general styling and for Google Web Fonts. I had hoped that I could achieve the same seamless experience using Typekit. However, Typekit does not use @import. Instead, it seems to require javascript to load the fonts. I tried adding this code in the admin <head>, but this does not load it into TinyMCE. Is there a way to import this javascript directly into TinyMCE?

Link to comment
Share on other sites

I'm not sure that there is, as TinyMCE is running in its own iframe. Maybe it is possible to add stuff to that iframe, but not that I'm aware of. If I had your need, I would probably use the InputfieldCKEditor module in Inline mode instead, as that should be a lot simpler to control. Lately I prefer using it for all my textareas over TinyMCE.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...