views:

57

answers:

1

Am using Silverlight 4. I want to populate a combobox with a list of the fonts available. I have searched high and low and can't find a way to do this. Seems be a lot of dead ends. There was a similar question asked in May but with no suitable answer.

Surely its not impossible?

+3  A: 

If you mean this question I stick by my previous answer also posted there:

Generate a lookup table for Silverlight:

There is insufficient information provided in Silverlight to get the full font names without some form of lookup table.

I also provided the WPF code to generate such a table, in that previous question. If you do create such a lookup table, for the most common fonts, then the problem is solved.

That creation task just needs to be run on a machine with lots of fonts (or at least the fonts relevant to your target audience).

Anyone out there (with lots of fonts installed) care to generate a C# compatible table, using my source, and post it for cut & paste? :)

Enough already
Yep. That was one of the questions. I'm thinking that I might just need to provide a DB table where people can install the fonts they want to be available to their users. I could init the DB table with some records for the most common fonts. Bit crappy but at least they can maintain the list.
therealtkd
@therealtkd: I just found this list of the most common fonts, that might come in handy for you: http://www.codestyle.org/css/font-family/sampler-CombinedResults.shtml It's old, but fonts have not evolved as fast as say Silverlight versions :)
Enough already
@HiTech Magic: In your other answer, I thought that it was great how you did that - I didn't even know that was available. I was looking up fonts by iterating through all installed fonts and then parsing the actual font file to get information. Your technique was to save me a ton of code and headache. Unfortunately, during the process I discovered a bug in WPF 4.0 in the `FontWeight` (confirmed by MSFT as "not the same FontWeight as earlier versions of WPF", but not confirmed as a bug). But anyway, your code is great, so +1 for that one before and +1 for this one now.
Otaku
Thanks HiTech Magic
therealtkd