Font Manager Redux 字体管理器 Redux

作者: 安迪·赫茨菲尔德 日期: 1985年3月 人物: 巴德·特里布尔、史蒂夫·乔布斯、杰罗姆·库南、比尔·阿特金森、布鲁斯·霍恩、拉里·凯尼恩、伯勒尔·史密斯、史蒂夫·卡普斯 主题: 软件设计、技术、个性、通宵达旦、QuickDraw 概要: 关于苹果第一代Macintosh的开发以及制造它的人的轶事: 即使在我离开 Apple 后,我仍然继续开发字体管理器 , 字体管理器 Redux Font Manager Redux

To improve something, you might need to throw away your finished work and start again when you find something better. When you make a new improvement, it might affect the old parts of your work, so you need to be willing to change them so they fit better with the new parts. For example, when making the Macintosh computer, the team had to write a program called font manager a few times because the computer was changing so much.

为了改进某些东西,您可能需要扔掉已完成的工作,并在找到更好的东西时重新开始。当你做出新的改进时,它可能会影响你工作中的旧部分,因此你需要愿意改变它们,以便它们更好地适应新部分。
例如,在制造Macintosh计算机时,由于计算机变化太大,团队不得不多次编写一个名为字体管理器的程序。

Bill Atkinson’s QuickDraw graphics package handled all the work of drawing text, but it didn’t want to worry about technical details like reading from the computer’s memory. The font manager’s main job was to get the right font for QuickDraw, knowing what type of font, how large, and what style. This way, QuickDraw could focus on drawing text without having to think about where the font was stored or how to load it.

Bill Atkinson 的 QuickDraw 图形包处理了绘制文本的所有工作,但它不想担心技术细节,例如从计算机内存中读取数据。
字体管理器的主要工作是为 QuickDraw 获取正确的字体,了解字体的类型、大小和样式。这样,QuickDraw 就可以专注于绘制文本,而不必考虑字体存储在哪里或如何加载它。

The first version of the font manager was simple. It had a few built-in fonts that were connected to the computer. If you asked for a font that wasn’t built-in, it would use the default font that the computer had. We used a font called “Cream” from a program called Smalltalk for most of 1981.

字体管理器的第一个版本很简单。它有一些连接到计算机的内置字体。如果您要求使用非内置字体,它将使用计算机具有的默认字体。 1981 年的大部分时间里,我们都使用来自 Smalltalk 程序的名为“Cream”的字体。

In the spring of 1982, we were building the first part of our user interface software. We wanted to let people who write applications use different fonts, so we had to find a way to get those fonts from the computer and store them in memory. We also needed to get special pieces of code called “drivers” into the computer. Larry Kenyon and I worked together to create a system that can load and store things from the computer, which we called the “object manager”. This system was used by both the font manager and the code that loaded the drivers.

1982 年春天,我们正在构建用户界面软件的第一部分。我们想让编写应用程序的人使用不同的字体,因此我们必须找到一种方法从计算机获取这些字体并将它们存储在内存中。
我们还需要将称为“驱动程序”的特殊代码放入计算机中。 Larry Kenyon 和我一起创建了一个可以从计算机加载和存储东西的系统,我们称之为“对象管理器”。该系统由字体管理器和加载驱动程序的代码使用。

Bill Atkinson recently gave Quickdraw the power to make images and text bigger or smaller. We added a new feature to the font manager that can find the best font for a request, even if it’s not perfect. If we don’t have a font in the right size, we can make one by enlarging or shrinking it. However, text that has been scaled can look a bit uneven, so we allowed applications to choose if they want to use scaled text or not.

Bill Atkinson 最近赋予 Quickdraw 放大或缩小图像和文本的能力。我们在字体管理器中添加了一项新功能,可以根据请求找到最佳字体,即使它并不完美。
如果我们没有合适大小的字体,我们可以通过放大或缩小来制作。但是,缩放后的文本可能看起来有点不均匀,因此我们允许应用程序选择是否要使用缩放后的文本。

While Bruce Horn was working on something else, I should have noticed it earlier, but by the fall of 1982, it became clear that making fonts and drivers into resources would have many benefits. We would save space by getting rid of some extra code and simplify the system by combining many small files. This would also allow applications to have their own fonts, if they wanted to. I came up with a simple way to combine font style and size into a single resource ID, and changed the font manager to use resources. The resource ID was a 16-digit code with one special bit reserved. This meant the font manager could handle 128 different font styles in 128 different sizes, which seemed like enough at the time.

虽然 Bruce Horn 正在做其他事情,但我应该更早注意到这一点,但到 1982 年秋天,很明显将字体和驱动程序制作成资源会带来很多好处。
我们将通过删除一些额外的代码来节省空间,并通过组合许多小文件来简化系统。如果应用程序愿意的话,这也将允许应用程序拥有自己的字体。我想出了一个简单的方法,将字体样式和大小组合到一个资源 ID 中,并更改字体管理器以使用资源。
资源 ID 是一个保留了一位特殊位的 16 位代码。这意味着字体管理器可以处理 128 种不同大小的 128 种不同字体样式,这在当时看来已经足够了。

We made some small changes to the font manager in 1983 to make it easier to create the menu, but the main idea didn’t change. We sent it out in January 1984. The team was very tired and didn’t do much work in 1984. Some people, including me, quit or took time off, and new people came to work, like Burt and Ernie. I didn’t think I would work on the font manager again.

1983 年,我们对字体管理器做了一些小改动,以便更轻松地创建菜单,但主要思想没有改变。我们是1984年1月发出来的。1984年团队很累,没有做太多工作。
包括我在内的一些人辞职或休假,然后新人开始工作,比如伯特和厄尼。我没想到我会再次从事字体管理器的工作。

In the beginning of 1985, Jerome Coonen got his software team ready to make a new version of the ROM that would come with the Mac Plus in January 1986. This new version had many fixes for problems and some new features like Appletalk and a better way to organize files. Because there was extra space, it even included a special file for system resources in the ROM, which helped the computer start faster and use less memory. Jerome asked me for ideas on how to make it better, and I gave him a long list of suggestions.

1985 年初,Jerome Coonen 让他的软件团队准备制作新版本的 ROM,该版本将于 1986 年 1 月随 Mac Plus 一起提供。这个新版本修复了许多问题,并提供了一些新功能,例如 Appletalk 和更好的方法来组织文件。
由于有额外的空间,它甚至在ROM中包含了一个用于系统资源的特殊文件,这有助于计算机更快地启动并使用更少的内存。杰罗姆向我询问如何改进的想法,我给了他一长串建议。

I suggested changing the way fonts are managed on the Macintosh. The LaserWriter, which prints in Postscript, made it confusing because the way fonts work on the screen and printer are different. The current system makes it hard to get everything right. I thought we should make some changes to help the screen and printer work better together, and make it easier to use more fonts. I was sad because my suggestions weren’t accepted because we didn’t have enough time to do the changes and it seemed like too much work.

我建议更改 Macintosh 上管理字体的方式。以 Postscript 打印的 LaserWriter 让人感到困惑,因为字体在屏幕和打印机上的工作方式不同。
当前的系统很难让一切都正确。我认为我们应该进行一些更改,以帮助屏幕和打印机更好地协同工作,并更轻松地使用更多字体。我很伤心,因为我的建议没有被接受,因为我们没有足够的时间进行更改,而且工作量似乎太大了。

Even though I didn’t work for Apple anymore, I still kept in touch with the company because my best friend, Burrell Smith, lived next door to me. We bought two houses on the same property in Palo Alto in 1983. Another friend, Bud Tribble, had finished his medical school and came back to Apple in 1984. He lived at Burrell’s house, so I saw him often. Sometimes, without warning, Steve Jobs would visit me at my house on a weekend afternoon.

尽管我不再在苹果公司工作,但我仍然与公司保持联系,因为我最好的朋友伯勒尔史密斯就住在我隔壁。 1983 年,我们在帕洛阿尔托的同一处房产上购买了两栋房子。
另一位朋友巴德·特里布尔 (Bud Tribble) 完成了医学院学业,于 1984 年回到苹果公司。他住在伯勒尔家里,所以我经常见到他。有时,史蒂夫·乔布斯会毫无预兆地在周末下午来我家拜访我。

One day in February 1985, Steve asked me what I thought about a plan to make a computer’s memory bigger. I said it wasn’t a big enough idea and gave an example of some changes they were making to the way the computer displayed letters. But I didn’t expect Steve’s answer to be.

1985 年 2 月的一天,史蒂夫问我对扩大计算机内存的计划有何看法。我说这不是一个足够大的想法,并举例说明了他们对计算机显示字母的方式所做的一些改变。但我没想到史蒂夫的答案是。

“Since you think it’s so important, why don’t you do it yourself?” Steve said to me. “If you help out, we’ll have enough time to get it done. Maybe we could even give you a few computers in return.”

“既然你觉得这么重要,为什么不自己做呢?”史蒂夫对我说。 “如果你帮忙,我们就有足够的时间来完成它。也许我们甚至可以给你几台电脑作为回报。”

I told someone I would think about it. Then the next day, someone named Bud Tribble came to talk to me about it. I agreed to make a new font manager for the computer’s memory. In return, Apple would send me three high-capacity Macintosh computers. I asked Apple to send them directly to my siblings as gifts. I had to stop what I was doing and focus on making the font manager so it could be finished in a month.

我告诉某人我会考虑一下。第二天,一个名叫巴德·特里布尔的人来找我谈论这件事。我同意为计算机内存制作一个新的字体管理器。作为回报,苹果公司会寄给我三台大容量的麦金塔电脑。
我要求苹果将它们作为礼物直接发送给我的兄弟姐妹。我不得不停下手头的事情,专注于制作字体管理器,这样它才能在一个月内完成。

I soon got a new program to manage fonts up and running. This program used a new way to describe the properties of a font family, such as the pictures that make up the font. This new way allowed us to support many thousands of different font families, instead of just a small number like before. I also got a new feature working that allows letters to be drawn at different widths, but I needed some changes to another program called QuickDraw so that other apps could use this new feature.

我很快就得到了一个新程序来管理字体的启动和运行。该程序使用了一种新的方式来描述字体系列的属性,例如组成字体的图片。这种新方法使我们能够支持数千种不同的字体系列,而不是像以前那样只支持少量字体。
我还获得了一项新功能,允许以不同的宽度绘制字母,但我需要对另一个名为 QuickDraw 的程序进行一些更改,以便其他应用程序可以使用此新功能。

I talked to Bill about changing something that needed to be changed. I was surprised that he didn’t want to do it. He didn’t want to fix some problems we found because he thought changing anything would mess up other programs that were already working. Then, when I went to a meeting at Apple, I talked to Bud, Steve, and Bill about this. We told him that if he wasn’t going to fix QuickDraw, one of us would do it instead. Bill said he would think about it and we would talk again the next day to make a decision.

我和比尔讨论了改变一些需要改变的事情。我很惊讶他不想这么做。他不想修复我们发现的一些问题,因为他认为更改任何内容都会扰乱其他已经运行的程序。
然后,当我去苹果公司开会时,我和巴德、史蒂夫和比尔谈论了这个问题。我们告诉他,如果他不打算修复 QuickDraw,我们中的一个人会代替。比尔说他会考虑一下,我们第二天再讨论再做决定。

We were all surprised when Bill came to Apple the next day, excited to show us how he improved the drawing of ovals. Before, it took almost twice as long. He worked on the code the night before and got excited about fixing bugs and making improvements. He found six ways to make it better. I was happy Bill was excited about QuickDraw again, but also a little worried that he might have gone too far in changing things.

当比尔第二天来到苹果公司时,我们都很惊讶,他很高兴向我们展示他如何改进椭圆形的绘制。以前,花费的时间几乎是以前的两倍。他在前一天晚上编写了代码,并对修复错误和进行改进感到兴奋。
他找到了六种让它变得更好的方法。我很高兴比尔再次对 QuickDraw 感到兴奋,但也有点担心他在改变事物方面可能做得太过分了。

It was almost time to stop making changes to the code, but the font manager was almost ready. Bill had added a way to measure the width of font styles correctly, and it seemed to work well. However, the night before we were supposed to stop making changes, Bill called me at around 8pm.

几乎是时候停止对代码进行更改了,但是字体管理器几乎已经准备好了。
比尔添加了一种正确测量字体样式宽度的方法,而且看起来效果很好。
然而,在我们应该停止做出改变的前一天晚上,比尔在晚上 8 点左右给我打电话。

“Hey Andy, I’ve got some good news. I found a way to make drawing text faster - it’s now 40% faster! But I need your help to make it work.”

“嘿安迪,我有一些好消息。我找到了一种可以更快地绘制文本的方法 - 现在速度提高了 40%!但我需要你的帮助才能使其发挥作用。”

It was discovered that most writing is in lower case, so letters only use half of the space provided. Only a few letters, like “g” or “j”, have parts that go below the main line of the writing. Most letters don’t go all the way to the top of the line either. This means that QuickDraw can ignore the empty spaces in the letters, which saves a lot of time.

人们发现大多数文字都是小写的,因此字母只使用了所提供空间的一半。只有少数字母,如“g”或“j”,有位于写作主线下方的部分。
大多数字母也不会一直到达行的顶部。这意味着QuickDraw可以忽略字母中的空白,从而节省大量时间。

QuickDraw didn’t have enough time to measure the top and bottom of each character as it was being drawn. But it was a good job for the font manager, which could do it once right after it loaded a new font into memory. The font manager calculated a special number for each character, telling Bill where to start and stop drawing. Bill told me what format he needed the information to be in, and asked if I thought I could do it.

QuickDraw 在绘制时没有足够的时间来测量每个字符的顶部和底部。
但这对于字体管理器来说是一项很好的工作,它可以在将新字体加载到内存后立即执行此操作。
字体管理器为每个字符计算一个特殊的数字,告诉比尔在哪里开始和停止绘制。
比尔告诉我他需要什么格式的信息,并问我是否可以做到。

I thought it was a very unusual idea to try and do something like that with only 16 hours to go before it had to be done. But I thought it was a great idea, so I told Bill I’d give it a try. I went out to eat and then bought two packs of a type of soda called Diet Coke. At 10pm, I started writing code for the font. I found a good and quick way to do it, going through the numbers one by one. After drinking 8 of the Diet Cokes, I thought I had finished it around sunrise. Then I had enough time to sleep for a few hours before meeting Bill at Apple at 10am.

我认为在距离完成任务只有 16 个小时的情况下尝试做这样的事情是一个非常不寻常的想法。
但我认为这是个好主意,所以我告诉比尔我会尝试一下。
我出去吃饭,然后买了两包一种叫做健怡可乐的苏打水。晚上 10 点,我开始为字体编写代码。我找到了一种又好又快的方法来做到这一点,逐一检查数字。
喝完 8 杯健怡可乐后,我以为我在日出时就喝完了。然后我有足够的时间睡几个小时,然后上午 10 点在 Apple 与 Bill 会面。

We were nervous when we tried it, but luckily everything worked well the first time. Bill’s tests showed that we got the 40% speed-up we were expecting. Although the deadline got delayed for other reasons, our extra effort actually made the task more exciting, I think.

尝试时我们很紧张,但幸运的是第一次一切都很顺利。 Bill 的测试表明我们获得了预期的 40% 加速。
虽然由于其他原因导致最后期限被推迟,但我认为我们的额外努力实际上使任务变得更加令人兴奋。
目录