Skip to main content
Home Forums Silverlight Programming Programming with JavaScript Embedding fonts.
4 replies. Latest Post by Mark Rideout on August 28, 2008.
(0)
DJA01
Member
67 points
45 Posts
08-27-2008 2:08 PM |
I am developing a Silverlight Application that embeds fonts so as to be able to display non-supported fonts (such as Helvetica). The code works quite well but for some unusual reason I cannot embed some Adobe fonts that I actually have licenses for. They are OpenType fonts but whenever I specify them in my JavaScript code it uses the default font (which is Lucida Grande I do believe). Also note that if I download free fonts off of the Internet (either OpenType or TrueType) everything works just fine. The problem seems to be related to the Adobe fonts.
Anyone have any idea why this might be the case? I can tried everything that I can think of but they just wont show.
Thanks
// Executing the appropriate code in order to download the Fonts needed for the Silverlight Canvas.
var spiContent = document.getElementById("mySilverlightPlugin"); // Holds a Reference to the Silverlight Plugin. var downloader = spiContent.createObject("downloader"); downloader.addEventListener("Completed", onFontDownloadComplete); downloader.open("GET", "Fonts/Fonts.zip"); downloader.send();function onFontDownloadComplete(sender, eventArgs){ var testBlock1; var testBlock2; var testBlock3; testBlock1 = sender.findName("textBlock1"); testBlock2 = sender.findName("textBlock2"); testBlock3 = sender.findName("textBlock3"); testBlock1.setFontSource(sender); testBlock2.setFontSource(sender); testBlock3.setFontSource(sender); testBlock1.fontFamily = "Helvetica LT Std"; testBlock2.fontFamily = "Helvetica LT Std"; testBlock3.fontFamily = "Helvetica LT Std";}
sl.ayer
Participant
852 points
164 Posts
08-27-2008 4:51 PM |
Does your license allow redistribution?
08-27-2008 4:53 PM |
Thats something that I planned on checking after I got this to work given that my Application is not "released" yet.
Would that matter in regards to whether or not Silverlight can display the fonts? If so, how would I check?
Thanks.
08-28-2008 9:13 AM |
Anyone have any clue?
Mark Rid...
Contributor
2357 points
273 Posts
08-28-2008 3:07 PM |
I believe I answered this on another post, but here goes again: Silverlight only support TrueType (TTF) and OpenType (OTF) fonts that contain TrueType outlines. There are plenty of fonts that contain postscript outlines which Silverlight does not support. In some cases you can convert open type/postscript fonts to TrueType outlines using a converter such as:http://www.fontlab.com/font-converter/transtype/
Also, feel free to send me the font (markri@microsoft.com) and I can tell you if it is a supported font.
-markSilverlight Program ManagerMicrosoftThis post is provided "as-is"