Interview with Bill Cheng, Author of Tgif

Posted 18 Mar 2002 at 18:05 UTC by sej Share This

William Cheng (Bill) is the creator of Tgif, a mature vector graphic editor for X Windows licensed under the QPL (

Scott: When did you start work on Tgif, and what were your reasons?

Bill: It was the late 80s, I was writing papers with LaTeX and I hated the picture environment. I really liked MacDraw. So, I found myself drawing figures on a Mac, export the figures into EPS, and ftp the EPS files to my UNIX workstation to be included in my LaTeX papers. I thought the process was crazy and started to write my own MacDraw for UNIX.

Scott: What other environments for vector-graphics were available at the time? Did you ever consider building on them?

Bill: Our UNIX machines were running X Window System. I recall the only vector-graphics package out there was xfig. But xfig's drawing paradigm of verb-object was opposite of MacDraw's object-verb paradigm. I liked the object-verb paradigm and didn't even think of changing xfig's fundemental bahavior.

Scott: What features of Tgif are you most proud of? What features do you think your users appreciate the most?

Bill: The feature that I was most proud of was the ability to attach attributes to objects in a very generic way. One can type some text, draw an object, and say "attach some text to this object as attributes". I didn't know of any other drawing tool that has a feature like that. It was a strange feature. But it turned out to be quite useful. For example, when I first saw Mosaic in 1994, I thought hyperlinking was so cool! Then I realized that I could easily do the same thing in tgif by using the attribute feature. In a very short time, tgif became a hyper-structured-graphics editor/browser! Another example was that my advisor was using tgif to create slides for a class he was teaching. He needed a lot of equations for the slides. He was tired of creating equations in LaTeX, running dvips and pstoepsi to create EPS files, and import the EPS files into tgif. He asked me if I can make his life easier. Then the LaTeX equation object was born. Again, attributes were used. To this date, I think the LaTeX equations is probably the feature tgif users appreciate the most.

Scott: What portion of Tgif did you enjoy developing the most?

Bill: It was fun to do things that other tools don't have. Pretty much any new use of attributes was a lot of fun. To do the LaTeX equation, I introduced scripting (or internal commands) into tgif. I'm not too proud of tgif's scripting language because it's not much of a language. But it was fun to keep adding new internal commands. Adding animation was also a lot of fun. Another major fun was to support double-byte fonts. I read and write traditional Chinese and for a very long time I tried to add support for Chinese fonts into tgif. One day, I got this e-mail from Gouichi Iisaka (if my memory serves me right) in Japan with a very large source code patch to make tgif handle Japanese input method and Japanese fonts! I was very impressed. Every time I made a release of tgif, he released a new patch. I tried to integrate his code into tgif, but all my attempts have failed. When I was make the major change from tgif-3.0.18 to tgif-4.0, I was doing a major overhaul of the data structure for text objects. It was the perfect time to integrate Mr. Iisaka's double-byte code into the new text object. It was very painful to get that text object to work, but I had a lot of fun!

Scott: You coined the term hyper-structured-graphics, and added this capability to Tgif. I added a similar capability to ivtools. Can you explain what this is, and why people might be interested in it?

Bill: When I first saw Mosaic in 1994, I thought hyperlinking was so cool! Hyperlinking basically boils down to associating something that looks like HREF="http://www..." with a group of text. Click that text takes the browser to a new page. I realized that if a graphical object in tgif has an attribute with exactly the same form, when the user clicks on that object, I can open a new file, just like in Mosaic! The term structured-graphics refers to the way graphical objects can be grouped together and be treated as one object. Before implementing the hyperlinking feature, tgif was simply a structured-vector-graphics editor. After hyperlinking was introduced into tgif, I started calling tgif a hyper-structured-graphics editor/browser on the WWW.

Scott: For years you had a gratis-yet-restricted license for Tgif. Why did you start dual-licensing with a free-software license, and why did you go with the QPL (The Qt Public License):

Bill: Although I like people using tgif for free, I didn't believe that others should make money off of selling tgif. I figured that if anyone should make money off of tgif, I should get a cut of it. Although I didn't mind not making money on it myself. I was considering selling tgif one day. When that day comes, I certainly don't want to find myself competing against my own code which was taken over by someone else! Eventually, I gave up my hope of ever selling tgif and wanted to release tgif under an open source license. I didn't like GPL mainly because under GPL, someone can take over tgif and make major modifications to it and call tgif his/hers and I won't even know about it. The great thing about QPL is that other can only release patches and have to keep the original tgif release intact. Also, the patches can be used by myself to be integrated into future releases of tgif. In a word, comparing to GPL, QPL is "very friendly" to the initial developer.

Scott: What is the most common feedback you get on Tgif?

Bill: I think it's either "Can you increase the resolution" or "Can you make rotated ovals and arcs look better"?

Scott: What do you hope/plan for Tgif in the future?

Bill: I want to increase the resolution by 4096 times! Hopefully, this can make rotated ovals and arcs look better. Here's a (incomplete) list... Object background color; more arrow tip styles; rotate arrow tips; support arc-chord and arc-pie-slice; support line-join, line-cap, and miter-limit; user specified bitmaps/pixmaps, UML templates, fix transformation matrix to use relative coordinates, pins, gimp-like control for splines, object in layers, powerpoint-like animations, etc.

Scott: Maybe this question should have been earlier, but would you care to share when and why you started programming in the first place?

Bill: I was a hardware engineer building computer boards. When I finished the i286 CPU board for Teradata, I asked my manager what's my next project. He told me that it's going to be the i386 CPU board. I knew at that time I need to do something else! In 1986, someone was willing to take a chance on me and offered me a software position and I gladly took on the challenge. My first programming project was using SunView. I had a lot of fun and never looked back.

Scott: Any thoughts on free software in general, or earning a living from free software?

Bill: A lot of selfless people have made tremendous contributions to the free software movement. Without them, I'll probably be running Windows or Solaris on my desktop and complain every day about my desktop. I think very few of these people got rich living from free software. I don't think I have very special talent, so I will stay away from trying to make a living from free software.

Scott: Any question I didn't ask you wish I had?

Bill: Is tgif buggy? What's the quality of the tgif code?

Scott: Ok, so what's the answer?

Bill: Every large software has bugs. I did a line count on the source and header files and got a little over 170,000 lines. I wrote most of these lines of code, so I know the code pretty well. As far as I know, tgif doesn't have too many bugs. But, since I wrote most of it, I can tell you that tgif's code is pretty ugly. I didn't have good programming habbits when I started writing tgif. Then it grew too big and I never got around to really clean it up. This was the reason I was really impressed when I saw the large patch from Mr. Iisaka. I could never figure out how he figured out how to make big changes in tgif.

Scott: Thanks very much for your time. I don't know if you read the interview I did with Bernhard Reiter (Intevation president) and Bernhard Herzog (Sketch author), but I closed with a series of alternates to which you can answer one, or the other, or both, or none, or huh? You wouldn't want to be treated any different, would you? Here goes...

Mac OS X or Windows XP? I don't like Mac. So it has to be Windows XP.

Continuous line drawing or Multi-click line drawing? Multi-click.

RGB or CMYK? I don't have a good understanding of CMYK. So, RGB it is.

C++ or C? C++ is the right way.

Frameworks or Libraries? Libraries.

Align-to-path or Align-to-grid? Both.

Layered graphics or Structured graphics? Both.

Copyleft or Non-copyleft? To start a brand new project, non-copyleft. To build on others, copyleft.

Amiga or TRS-80? Haven't tried either of them. My first computer was an Apple IIe.

Southern California or Northern California? Southern Cal for living and Northern Cal for making money.

Origin in the lower left or Origin in the upper right? Lower left (like in mathematics).

and finally...

vi or emacs? vi.

Related URLS:

Vector Graphics Foundry

What does he mean by "non-copyleft to work for new projects"?, posted 20 Mar 2002 at 01:36 UTC by jordanb » (Apprentice)

I'm not sure I'm following, is he saying that you should only make projects free if the existing license is forcing you, or you should make new projects free but non-copyleft? I wish the interviewer had explored that a bit more. Good interview other than that.

I've not tried tgif, but I use xfig with LaTeX often. I'd try it out based on this interview were I not avoiding qpl software.

Figurine is GPLed, posted 21 Mar 2002 at 16:41 UTC by movement » (Master)

Figurine uses .fig format and is under the GPL. It's not really under development any more, but you still might find it useful if xfig is doing your head in.

Re: Figurine is GPLed, posted 21 Mar 2002 at 18:43 UTC by sej » (Master)

Or you can use fig2dev (a stand-alone program that is part of the xfig distribution) to convert FIG documents to many things. Including PostScript and EPS which can then be converted to anything pstoedit supports: Tgif, pdf, DXF, idraw EPS, Kontour, GNU metafile (plotutils), Sketch, ...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

Share this page