tags:

views:

409

answers:

4

I need to display a file that comes from a mac on a Windows machine.

The font name in the mac file is "Helvetica".

Windows does not have Helvetica but it has "Arial" which is the close. However, if I pass "Helvetica" to a WPF control the font family is ignored.

How can I get programmatically the closest font from "Helvetica" on Windows?

+2  A: 

They are actually different fonts, though the difference is subtle. Talk to any obsessed graphic designer and he or she will probably start ranting about Arial's inferiority. Hell, they even made a movie out of it.

http://www.helveticafilm.com/

So that's why there's no "mapping". Because they're just plain different. You'll have to come up with your own way of choosing which font you want to use (that is, you'll have to detect what you have and then use what you get from the OS).

Dave Markle
How do I get the closest font then?Office knows how to display Helvetica even though it's not on the machine.
tom7
For portability, Word documents and PDFs usually contain copies of all the used glyphs for all the fonts in the document. But not in a form that you can legally extract and use.
andrew
I believe Word maintains a list of common fonts and how it will substitute them should one not be available. That is most likely what you will have to do in your program. http://www.melbpc.org.au/pcupdate/2310/2310article10.htm
Dave Markle
A: 

There's some information about some Helvetica look-alikes here, maybe you could install these on your Windows machine. If you're worried about compatibility with other machines, you can't use this though, as it won't display the font on their machines (I believe it will default to some specific font, perhaps Arial or Times).

adam_0
+1  A: 

Some fonts contain an embedded PANOSE number, which classifies fonts visually and can be used to match similar fonts. It's what Windows' Fonts folder uses to list fonts by similarity. However, I'm not sure how widely supported it is.

Presumably, you'd need to know a particular Helvetica font's PANOSE number in order to find the near matches from the fonts you have installed.

See PANOSE on Wikipedia and MSDN Library page on Using PANOSE Numbers.

e100
A: 

it may be possible to convert Helvetica into a windows something like transtype you could then embed the font into your wpf app.

You may be on very sketchy ground in terms of licensing though!

There's a very good font stack generator over at codestyle.org, I've blogged about how to use it here http://devsigner.co.uk/creating-a-good-css-font-stack/

hope this helps!

devsigner