I'm trying to find out if Embedded Open Type (.eot) files can be used in Silverlight. I found an older post that says they can't, but it's a few years old and given how fast SL has moved, I'm not sure if that has changed.
If so, how would they be used? As a <Glyph/> object or...?
I don't think so. You can embed true type fonts fonts in your Silverilght app though. Expression Blend makes it easy to do, simply select a font and then tick the 'embed' box. You would of course need to make sure you met any font licensing requirements for fonts that you embed in your application.
The fonts are embedded as a zipped resource within your dll via a custom build action called 'BlendEmbeddedFont' and then referenced like this in your app:
<TextBlock Text="TextBlock" FontFamily="/SilverlightApplication12;component/Fonts/Fonts.zip#Segoe UI" />
No. This is because Silverlight (like Flash) thinks of itself as an "application", not a "document". There's a lot of banter on this subject of font embedding vs. linking and web fonts. Silverlight incorrectly uses the word "embed" where it actually "links" instead.
Like any good technology though, it may be possible to reverse engineer an EOT file though - these security guys did it using IE: Reverse Engineering the Embedded OpenType Decompression. I don't think would be illegal in any way as the compression/decompression is a submission to W3C on http://www.w3.org/Submission/2008/SUBM-MTX-20080305/ (although it may make the font foundries a little angry). Or maybe you could look at this ttf-to-eot converter and do the reverse: http://code.google.com/p/ttf2eot/
Anyway, you have a lot of work ahead of you if you want to go down this path.
Related
I am learning about how to localize a project and using a book as a tutorial. I've added the UICulture to the .csproj and assembly files:
[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
But now the book says to update the elements with the UID and I don't know where to do it.
I have to invoke the msbuild (not sure form where) and need to use
msbuild/t:updateuid ProjectName.csproj.
How do I do this?
If I may suggest an alternative approach. I never liked the "default" Microsoft approach to localization in WPF, so way back in 2008 I started looking for alternatives. I eventually settled on a solution described in an article named "Simple WPF Localization" on CodeProject. It's a XAML markup extension and it also allows you to change languages on the fly, etc. Very simple to use.
The author now has a more capable, "advanced" version: Advanced WPF Localization that allows you to localize images, brushes, margins, etc. (it's all at the top of the article).
There are a few other such "libraries" available (some are on CodeProject as well), but I've been using this one for 3.5 years with no issues whatsoever. Might be worth looking into if the approach fits what you're doing.
I have a question about Flash. I am writing my first browser game, and I am trying to decide on a technology.
I have a few requirements:
I don't want to have to pay to write code and a not-complete-crap free IDE would also be good.
I want most (or > 70%) of "normal" computer users to have it installed, so, Unity's pretty much out.
I don't really need performance too much
I need 2D, not 3D
Needs to be able to communicate with the server, and no extra downloads required.
Preferably works with the Facebook platform, but, this isn't a requirment.
Now, I would go with Flash as it fills all of my requirements, but, to my understanding, I need to pay for CS5 to get coding with Flash. Is an alternative around this possible?
Are there any other alternatives I'm missing?
To add onto what ColinE mentioned, FlashDevelop also provides you the ability to download and install the Flex SDK. However, if FlashDevelop as an IDE doesn't work for you, you can also download the Flex SDK yourself.
This is essentially the same thing that's included with Adobe's Flash Builder application, which is basically built on top of Eclipse. This should at least give you a start on creating things in Flash, though you'll be limited to ActionScript 3. I'd suggest sticking with AS3 as it provides a lot of power compared to AS2.
If you do choose to use the Flex SDK, I'll give you a bit of knowledge I've gained since I started using it for developing games. This may be a little long-winded but hopefully it'll answer some of the initial starter questions.
You can develop apps/games using the Flex library but this may increase the size of your SWF file. However, it's worth noting that it's not required to use the library. You can use the compiler (mxmlc) provided in the SDK to build against .as files as well.
From here, there's a few gotchas that might creep in when it comes to assets. Flex provides you the ability to embed assets within your class files. Out of the box, it allows for the embedding of a handful of formats, most notably PNG, TTF, XML and SWF. There's a lot that you'll be able to do with Flex from a code standpoint but it's not very pretty for creating the assets themselves. Primarily, I use the Flash IDE only for cases where a project requires a SWF asset, however, most of my projects tend to use PNG.
When using an embedded SWF asset, you may come across an issue where any code that's included in the asset, such as any hover or animation logic as ActionScript, gets stripped out of the copy embedded in the resulting project's SWF. A workaround for this is forcing the mimetype to "application/octet-stream" and using a Loader object's loadBytes() method.
Finally, you should be able to make some sort of progress provided you have some sort of ActionScript knowledge. There are plenty of resources out there but be aware that a fair amount of them still use AS2. The knowledge can be applied with some modifications but may require some extra legwork to implement. The language is fairly easy to work with.
With all that, I wish you luck. Flash gets a lot of flack these days but even with HTML5 nearing final, there's still a lot of features that it will never be able to touch without leveraging Flash in some way.
Flash, Silervlight or HTML5 will tick pretty much all of those boxes for you, however Silverlight is only installed on ~65% of computers at the moment.
HTML5 can be tough to develop with, so perhaps Flash is your best bet. See the following question which discusses Flash IDEs:
Flash Developer IDE
FlashDevelop is a free development environment for Flash.
I believe your question is about which type of development you should use to get this game going, but I would also urge you to consider the future of each of these software sets, and choose based on what you would like more experience in.
Flash has been holding it's ground pretty well, but I've seen it less and less on major sites these days, and I believe HTML 5 is taking pretty good stabs at it. Even Pandora doesn't use flash anymore, and that was a pretty well designed little flash app (they still use AIR for Pandora One, but not their main site). Instead, like many other websites, it's using HTML and JavaScript.
So, while flash is slowly losing ground to HTML and JavaScript, where does Silverlight stand? Microsoft is still pushing their Silverlight technology, and based on Microsoft's support scheme, they'll still be using it for the next few years at least. At the same time, it's based on the .NET framework, so you'll be gaining some valuable WPF and .NET skills by using Silverlight.
There is no right or wrong decision here, it's really just based on which technology you see yourself using past this product, and which technology you want to learn.
I'd give it a shot in Silverlight, myself, but that's simply because I dislike flash, and there's already too many HTML and JavaScript developers.
edit:
Silverlight is a relatively small 30 second install. I generally hate installing new plugins, but Silverlight is relatively painless, imo.
The Silverlight Application Package extension is given as ".xap" which is a zip file. Why is it named XAP? why not something else? Does anyone know why microsoft went with the name XAP? Is there any meaning to XAP? or is XAP an acronym?
SAP
Trademarked. German Software Company. Out.
SLAP
A slap or "smack" is a broad stroke
made with the open hand, as opposed to
a punch that is made with a closed
fist. Slaps are frequently made across
the face, but can be also made across
hands or any other body part, and can
use either the palm of the hand or the
back of the hand.
Not the best connotation you need for Silverlight. Out.
XAP
XAML Application Package. Descriptive. Nonoffensive. Beats Apache to the punch nicely. In.
Two options come to mind:
A contraction/abbreviation of XAML Application (or XAML Application Package).
A contraction/abbreviation of cross-platform application.
I suspect it may have been the first option or possibly a combination of both.
I really need a way of loading a .ppt document in my wpf application. Can anyone give me a hint, code sample?
Checkout the following discussion thread. Also Dr.WPF got an interesting article that might help you as well: Hosting Office in WPF Application
However consider license costs will be quite high for your scenario...
According to this artice the DSO Framer is no longer supported. Have to look for something else.
You may need to elaborate a bit more on your particular need to get a practical answer.
I don't think hosting PowerPoint (ppt) is a good option because it requires ppt to be installed on the target machine.... and if the target machine has ppt then you can use its API to save the document as HTML and open it in a WebBrowser control.
If the target machine doesn't have powerpoint you may look into some online file conversion service and try hooking up there to convert to HTML and still use WebBrowser control.
I definitely don't recommend wasting your time with DSOFramer - it's very unstable at best and it will just feel like you're one step away from making it work for a while but it doesn't work.
Another option is of course to write your own parser for ppt files, the OfficeOpenXML version of the files is definitely "parseable". I've done that for Word docx and it's relatively easy to get the course data out of the document - say shapes, text... - but the devil there is in the details. There are a zillion little features to implement.
There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with x:Uid's, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, binary blobs (say, PDF files), or strings that are embedded in code.
So, how might you localize an application that:
Contains several assemblies
Contains images and other binary blobs (eg: PDF docs) that need to be localized
Has string data that isn't in XAML (eg: MessageBox.Show("Hello World");)
You should have a look at the article and code available here. It describes different ways of localizing WPF apps, using LocBaml, custom markup extensions, or attached properties. IMHO the best solution is to use the markup extensions and Resx resources. The code contains a localization framework for doing that.
Not an expert here, but "littering" your xaml with x:Uids is not worse than "littering" your Windows Forms code with all the string table nonsense you have to do for localizing them.
As far as I understand, WPF apps still support "all the Framework CLR resources including string tables, images, and so forth." which means you can have localized resources.
Of course, it would be much simpler if you created a markup extension that handled much of this nonsense for you. You can find an example of someone doing this here. And there was another, similar solution at http://blog.taggersoft.com/2008/07/wpf-application-localization-pattern_29.html, but that link no longer works.
You can use the old "ResX" files which support all of your mentioned scenarios. How this can be accomplished in a WPF application is explained here:
WPF Application Framework (WAF) => See Localization Sample
try the Gnu GetText utilities, and supporting applications. It does generate C# classes based around ResourceManager and ResourceSets, and of course you can reuse the translations for other parts of your application - eg web pages, native code, or iphone etc.