Dynamic Embedded Custom Font Generation
- 0 Comments
While working on a project this weekend, I came across a problem that I thought had a simple solution. I simply wanted to embed a custom font in a web document. I only wanted to use the custom font on a small area of text and have the rest of the text remain in the regular font. However sans using flash there are not a lot a prebuilt solutions to accomplish this.
Here are some of the problems and limited solutions that came up:
1. When using a custom font, most if not all browsers will not have access to the font so they will not know how to render it. This is the most obvious problem and means that if a solution is implemented, the text translation will have to be done on the server side and the results passed to the client browser.
2. One way to solve the problem and the method I took as short-term solution is to first have the font files located on the server. Next encase the text that you want to replace in the html file within script tags. Then on the server have a script file that replaces the text with custom font images at the specified size. This is not the ideal solution because it is not as dynamic as I would like it to be. Currently a lot of attributes such as font size are hard-coded into the script files which means to fine tune details, the server-side script is constantly being changed and is not highly optimized yet. I would like the solution to be more integrated in the process of content creation. The good thing is that is for the most part browser independent with all the work being done on the server side.
3. Use sIFR (Scalable Inman Flash Replacement). The is very elegant solution for the most part. sIFR is used to replace default browser text with text rendered in the font of your choosing. However javascript and flash must be loaded on the client browser for the method to work else the default font will be displayed. So basically javascript is used to create flash movies which are then overlayed over the normal text in the browser. It does not change the text but rather provides an overlay. This is why the user sees the generic text if flash/javascript is not loaded. sIFR is licensed under the GNU Lesser General Public License so it is free for everyone to use. One would think that this method would be bandwidth intensive but the implementation is highly optimized. The javascript files and flash movies are only loaded once from the server. After that they are pulled from the client browser cache. The only drawback to this solution is the the client browser has to have flash and javascript installed on the client browser.
The Jury Is Still Out
I think the jury is still out on dynamic embedded custom font generation. The web and user created content is still fairly new and there hasn’t been a real demand for this. However with the web community becoming more and more concerned with document and content presentation, I think this will become a hot area of interest with a wide host of varied solutions.

