On installing and removing fonts, Part 6: That's your name? What's your real name? Nah. What was it before you changed it?

by Michael S. Kaplan, published on 2008/07/15 10:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2008/07/15/8732674.aspx


The blogs that came before:

Now last time I hinted that there was yet another problem related to font removal that has to be considered.

But let me back up for a moment.

It is a problem I hinted at in Part 1 when I mentioned in passing:

Hell, two different fonts from two different places can have the same name and the first of many comparisons you might do is with the name and the version.

I should watch the cussing with all of the minors lurking about, but ignoring that for a damn moment, the implication (or maybe it is more of an imputation) is obvious.

Behind each font is a filename.

A filename that might be the same as some identically named file.

As long as the "get rid of file extension" zealots keep not getting their way you can have some confidence that identically named file is also a font, but the facts remain the same -- someone might be squatting on your turf with their own file that callously has the same name as yours and which obnoxiously happened to be installed first. Bastards that these people were, they probably also killed Kenny...

But the problem remains -- when you install you have to deal with the fact that some other font file name is the same.

Now AddFontResource only takes a filename, but the font itself can have all sort of names in it -- the names that will be "registered" for the font so that it can be found later.

Aha, so if the file is already there and you determine that it is not some earlier version of yours to be replaced (see Part 1 for more information on that) then all your setup program has to do is rename the file and then you have none of the problems with someone who happens to have the same name.

So everything is good, right?

Well, kind of. With the system trying to maximize the chances of a font trying to get installed. Everything is good....

Until problems happen.

I return once again to Paul Linnerud, and an example explained by him:

...the system has Palatino installed as palatino.ttf. The user drags Palatino Linotype with file name palatino.ttf into the fonts folder. The fonts folder will determine that palatino.ttf is already used by a font and rename the Palatino Linotype file as pala001.ttf. Later if the installation program wishes to install Palatino Linotype with palatino.ttf it will really replace Palatino and we will end up with two Palatino Linotype fonts installed with different file names.

And yes, the font folder of some versions of Windows has that renaming code -- and this problem really can happen. Even if it didn't, a font installer can do the very same thing. What will your installer/uninstaller do if if finds that the file it is trying to remove/replace is not the file it is meant to touch but someone else's?

Go on, guess.

If your guess is anything along the lines of "not what you want it to" then you get a gold star. Since most won't....

The name of the file and the name(s) of the font itself are just entirely separate beasts -- even the updating operation can be dicey and you will want to really make sure it is your font.

So How can all of these problems be solved?, you may be asking.

Or Can these problems be solved? might be the question on the tip of your tongue.

Stay tuned and we'll start talking solutions, next time....

 

This blog brought to you by Ϥ (U+03e4, aka COPTIC CAPITAL LETTER FEI)


Rex Sutton on 26 Jul 2008 1:50 PM:

Yeah found your blog looking for How the Hell to handle 2 fonts that share the same system name and even the same screen name in some cases. Kind of a weird identity theft thing. Is it pronounced tomato or tomato?

The fonts Athletic and Athletic Supporter are both called Athletic.ttf

The fonts Blackjack and well Blackjack do the same thing... this one was a Real pain in the neck because the system pretty well preferred the scripty version of Blackjack to the urban techno version and I didn't have any way of seperating them.. Even double clicking the name from the .zip file displayed the scripty version.. Had to rename all instances (font Navigator finds fonts anywhere, I like to save a copy of the font with the project because I work in more than one place) then restart to be able to use the Techno version.

All because some ankle biter didn't convert the fonts to outlines.

Michael S. Kaplan on 26 Jul 2008 5:01 PM:

You might be interested in the last few posts in this series, which talk about solutions that can apply to some off the situation you are talking about....

Michael S. Kaplan on 26 Jul 2008 5:05 PM:

(the last few blogs are coming up soon)


referenced by

2008/09/08 On installing and removing fonts, Part 8: Sometimes being selfish makes you more trustworthy

2008/07/30 On installing and removing fonts, Part 7: What was the question, exactly?

go to newer or older post, or back to index or month or day