Boxes and Glue
Transcription
Boxes and Glue
Boxes and Glue Copyright 2009 B.Bachler, E.Bonetti, L.Bontempi C.Haag, M.Hoogenboom, A.Jongstra, R.Monnikhof, D.Medic Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; A copy of the license is included in the section entitled “GNU Free Documentation License”. In February 2010 a workshop took place at the Piet Zwart Institute in Rotterdam. During three days we dealt with LATEX and the automated generation of LATEX documents, especially regarding the possibilities for graphic design. Boxes and Glue refers to Donald Knuth’s approach to typesetting1 and points at the same time back to not-so-ancient days of graphic design. Printlaying as analogue craft – glue, paper, scissors, rocks.Boxes of Stuff, Bags of Tricks, a Bag of Pipes.2 Here is a snapshot of things, prepared for and done during the workshop. Some simple examples, the students’ enhancements, two inspirational texts from GOTO10’s Book FLOSS + Art and the great METAFONT Tutorial as start for the next step. You shouldn’t expect out-of-the-box solutions, for free, like beer and speech, politically more correct than the Design SuiteTM and by the way the next hot shit for human-computer interaction. This does NOT provide you with the newer and better Processing for typesetting or Desktop Publishing. This is an introduction, especially for non-programmers, to the world of quick hacks, workarounds and almost-good-enough solutions. Searching, finding and replacing, fundamental principles for computer based text processing and frequently used in forkable tools, becomes here a style of working. Search for your tool, the almost-goodenough solution, hopefully find it and replace what does not fit your needs. 1 The TEX typesetting system uses a model of boxes and glue. Boxes contain typeset objects, such as text, mathematical displays, and pictures, and glue is flexible space that can stretch and/or shrink by amounts that are under user control. 1 2 A pipe is a form of redirection that is used in Linux and other Unix-like operating systems to send the output of one program to another program for further processing. 2 3 The Shrink-Wrapped Design Process Michael van Schaik 1 Preface It takes us years of education to learn to read, write and talk as ways of interacting with our environment. Isn’t it strange, then, that one receives barely any kind of education in interacting with computers (as a modern communication environment)? Instead most computer programs are built to use interfaces as translators from computer to human. Although this is meant to help, in many cases this also makes users less powerful because they can only consume set functions within the program. You can only compute what the software lets you compute, and only manipulate what you see. This is especially the case in the world of graphic design; due to the global monopoly of big firms like Adobe (which recently even bought it’s only real competitor Macromedia), all graphic designers seem forced to use the same software to produce their work. Strangely enough, the lion’s share of designers don’t really seems to care. Looking at my own education (in the Netherlands), a reason for this could be that the discourse here seems to be focused on ideas more than actual products (and the tools used to create them). Though there seems to be a growing interest in alternatives such as open source software as a means to a more independent design practice, the problem with these is that the few packages that are currently the killer apps in this field are often just free-er copies of existing software, not much different from their proprietary counterparts. What if designers actually learned to use the real power of the computer and computational media instead of the ready-made physical workspace that it currently tries to represent? There is an interesting opportunity here for designers to start using the computer as the universal machine that it really is instead of a shrink-wrapped special purpose machine modelled on analogue tools, locking them away from new creative possibilities specific to the field of computational media. Why learn to use only the Adobe tool-chain if one can build one’s own production-environment tool by tool? 2 Current Situation The main software tool-chains used in the field of graphic design can be divided in to “digital” and “print” oriented. Since most classically educated graphic designers (like myself) are primarily educated in the field of print production, it shouldn’t 5 The Shrink-Wrapped Design Process come as a surprise that this is also the main focus of most software. The main, widely used print-production software can be classified under three categories: vector based (Illustrator, Freehand), bitmap based (Photoshop, Fireworks) and software to gather and combine the two for prepress (X-press, inDesign). The software that focuses more on digital-design such as design for websites and CD-roms/DVDs generally tries to represent these media in a way designers are already familiar with from the world of print. What these software programs have in common is that they are an interface between a technical system and the visual workspace of a designer. So placing an image on a website works in just the same way as placing it in a book; the designer just imports the image and it’s there. What actually happens beneath the surface of the Graphical User Interface stays hidden. This might be considered a good thing, since it saves the designer from having to learn a whole new way of working for any new technical system, it’s just a matter of learning it once and then using the same techniques throughout all media designs. And who wants to know what’s “under the hood” anyway? – that’s the world of programmers, which is generally not of much interest to graphic designers. Without advocating Friedrich Kittler’s suggestion that computer users learn to read the true (hexadecimal) language of the computer, hiding the real (raw) material of a medium from the user is indeed an important paradigm common in most software engineering. 3 It can be considered the reason for the sort of fear of programming code that seems to exist among designers (and lots of computer users in general). Code is equal to problems. Code is where you see the actual computer break through the graphical skin, like in the art of JODI, or the field of glitch art, which is about errors and other things you’d like to prevent. 4 Take a look at, for example, the Macintosh OS X operating system, where the “engine” of the computer is almost invisible for the common user. You just do whatever you want to do as if you were in the physical world, and, invisibly, the system takes care of the technical layer. One never sees any program code, or even a glimpse of how the system is built up, while the fact that this system is based on Unix is considered one of its main advantages (The Unix-philosophy typically means having simple applications doing their job as well as possible, instead of wasting CPU power on things like dynamically resizing screens and using a “genie effect” on hiding them). The fear of program-code may originate from the first desktop systems, which introduced this shrink-wrapping of program code in a nice GUI (Graphical User Interface). And this fear is also very much there among graphic designers. It is considered their job to work in the visual field, the field of texts, nice fonts and images, and the computer is supposed to generate the appropriate code, say postscript (for print) or html or actionscript etc. (for digital media). This way the designer has the feeling of staying “above” the medium, calibrating it to their needs, unaffected by its actual individual (technical) capabilities and way of working. However, if we look at the historical context designers have worked in, things weren’t always like this. On the contrary, well known designers such as Piet Zwart or Wim Crouwel, for example, were actually working with new techniques (photography and photographic typesetting) and challenging, changing and creating the possibilities of these techniques. Through their knowledge of these new media, they also learned 6 3 FLOSS vs. Proprietary, or: Why it is Important to Study Our Software their intrinsic qualities. Thus, photography introduced the photographic image into design, but instead of taking that for granted, Piet Zwart re-appropriated these images as design elements. And while photographic typesetting was invented to easily reproduce existing type, Crouwel instead invented type specifically for the capabilities and restrictions of this technique. These are things that wouldn’t have been possible without a thorough (technical) knowledge of the medium. So, taking fear of the actual medium of the computer, program code, as a given, it is interesting to look at how this fear in fact restrains the designer nowadays. As mentioned, artistic education is focused mainly on the development of the self, and of original ideas. There is less interest in or time for studying the digital media used to communicate them. Because of the fear of being restrained by (the absence of knowledge of) program code, instead of the freedom this knowledge might give, the focus (at least in the Netherlands) is much more on concepts and physical or visual techniques. But what is forgotten is the importance of the medium in constituting part of the message. The computer is therefore, mistakenly, seen as just a meta-medium. One that reproduces all earlier media without changing them. Think also here of how metaphors like the paper folder in the desktop or the term “web pages” in the internet are used. And this last example is also one of the more obvious illustrations of the constraint this disinterest in/fear of the technical produces. The internet is, obviously, a totally different medium from print but by applying this metaphor of a page as a piece of paper, designers become its captive, in turn producing ideas such as websites that one can flip through like pages in a book (next, previous). This places a huge restriction on the actual âĂŸhyper-” quality of the web. In order to understand the media we work in, there should be much more focus on learning and understanding at least the basics of their intrinsic technical layers. This way designers may acquire more of an insight into the constraints GUI programs impose on the way they design our messages/media. 3 FLOSS vs. Proprietary, or: Why it is Important to Study Our Software The importance of knowledge for fully understanding and using or even designing the medium may seem quite obvious. It is also important, however, for less obvious reasons. If we consider graphic design a form of communication, or even a cultural activity, it is highly important for it to be totally free. Free to question, challenge and form critical opinions, free to question authority, free to protest and free to question and shape the media it works with. Therefore, knowledge of technology should also be considered an important way to gain insight into how political choices in software may invisibly inhibit a truly free and critical stance. To give an example, according to Microsoft the new Windows Vista operating system introduces a breakthrough user experience and is designed to help you feel confident in your ability to view, find, and organize infor- 7 The Shrink-Wrapped Design Process mation and to control your computing experience.1 The last part of this claim in particular can be seen in a totally different light if combined with the claim the Free Software Foundation makes on badvista.org: Among other harms, BadVista.org will focus on the danger posed by Treacherous Computing in Vista. Commonly called Trusted Computing in the industry, it is an attempt to turn computers from machines controlled by their user into machines that monitor their user and refuse to operate in ways that manufacturers don’t authorize.2 Though the last claim (as well as the first) should be considered an opinion, their combination gives a nice insight into how at least some technical knowledge should be considered a necessity to gain insight into the political choices forming the bases of software. Another way software can constrain its users may be found in the example of big software companies “donating” computers to schools or institutes and thereby implicitly forcing them to learn, use and thus buy their specific products. Or as Jaromil put it: “teaching them to use Sony cameras.”3 The strange thing is that while there exist excellent alternatives to most proprietary software in the form of Open Source software, this doesn’t seem to catch on very well. Open Source software is free (libre) software because the source code of the software is publicly available (or available after one has purchased the software). It is often free (gratis), created and maintained by networked communities of hackers and programmers. The importance of this software lies in the fact that it makes the user free to study or change it without being dependent on the original creators. Another important paradigm in this field is Open Standards, meaning the file formats used are documented and can be freely studied and implemented. An example of Open Standards can be found in the Open Document Format, which originates from the xml-based file format used by Open Office. Open Office is nowadays a fully working, Open Source alternative for closed proprietary software suites like Microsoft Office. The Open Document Format is a freely implementable file format that, because of its Open Standards, can be studied without restrictions. The value of the transparency and freedom that comes with these kinds of formats is underlined by the decision of the Dutch government to fully adopt open source software and open standards by 2006 (the “Motie Vendrik”, accepted in 2002). In June 2006 the Belgian government even decided to prohibit closed formats in official government documents by 2008. Though change takes time, this is also caused by the historic policy of deterring uptake of Open Source and Open Standards by those companies currently holding the biggest market share. Much of the history of free software is about 1 http://www.microsoft.com/uk/windows/products/windowsvista/features/default.mspx 5 2 http://badvista.fsf.org/ 6 3 in personal conversation with Jaromil, November 2006 8 4 Software is the Message circumventing restrictions put in place by companies. For example, at the time of writing Microsoft Office still does not support Open Document Format, which may be an important reason why the Dutch government’s progressive plans decided back in 2002 have yet to be realised. And if, for example, Adobe, nowadays the publisher of Flash and the Flashplayer, were to implement support for the (open standard) Scalable Vector Graphics format, the viewer-coverage for this Open Standard file format would instantly be about 100 percent. Instead they have decided to cease development of their svg plugin which was one of the few ways people using Internet Explorer were able to view svg content (since IE, surprisingly, is the only browser which hasn’t got any sort of basic native svg support). Luckily most other browsers have some form of native support for svg graphics built in, it’s just too bad that about 70 percent of computer users are still using Internet Explorer. The same story, by the way, goes for support of the (24-bit) png format (indeed, also an open standard), which all browsers except IE support natively. With the release of IE7 this seemed to have improved, except that this version is built not to install on systems older than Windows XP which, in turn, will not run on older hardware. 4 Software is the Message To get an insight into how software shapes our message, it might be nice to take a look at linguistics, for here the influence of the computer is quite remarkable. “Browsing” as a word for finding information (as in a library), “system crash” for not being able to remember something or even “ctrl-z” for undoing a mistake. These terms have not only become part of the wider language, their influence reaches far further. The software we use determines how we think. I personally noticed this phenomenon when I once tried to use sticker-remover to remove some traces of tape on a coffee-machine. The tape dissolved just fine, but so did the plastic of the coffee-machine. The first thing that popped into my mind was to press Cmd-z (I “Think different”). According to Marshall McLuhan, The new medium of TV as an environment creates new occupations. As an environment, it is imperceptible except in terms of its content. That is, all that is seen or noticed is the old environment, the movie. But even the effects of the TV environment in altering the entire character of human sensibility and sensory ratios is completely ignored. The content of any system or organization naturally consists of the preceding system or organization, and in that degree acts as a control on the new environment. It is useful to notice all of the arts and sciences as acting in the role of anti-environments that enable us to perceive the environment. 7 However, according to media theorist Arjen Mulder, while computers are indeed often said to also remediate the preceding media, they actually are a “metamedium”, a combination of all previous media: 9 The Shrink-Wrapped Design Process Only in this case, it is not so much a matter of remediation of all old and new media, as it is a hybridization, a melting of unequal media to a new unity. 8 Another example, which a friend with a background in architectural studies recently pointed out to me, is that with the introduction of each new software used in architecture, a new trend is born. For example, the release of Maya 3D sparked blob-architecture, whose shapes were specific to this software and could easily be traced back to the lines of software code from which they were generated. This leads to another interesting question: who is the producer and who is the consumer in this software setup? In a way the software companies are the producers of the environment in which certain ideas develop. One could argue this by saying software is just a tool in the process of developing and communicating ideas, but in the case of Maya, the generative algorithm is created by a software developer. Isn’t it true that the “designer” is actualising a potential form generated by the software developer’s algorithm? Of course this comparison might be seen as an exaggeration, but it illustrates the basic point very well. What a user/consumer of software is actually doing is placing his ideas in a preset environment. This works both ways, so (unconsciously) he is also conforming his ideas to this set environment. If we look at the example of Maya, the ideas of blob-architecture might well be developed according to a certain “zeitgeist”, but by elaborating them with this software the resulting physical shape becomes far from universal and is, as mentioned, sometimes very specific to the software used. In this instance we might even wonder who the actual producer of the blob-building is. Software always (in a certain way) influences your thinking. Analogous to “the medium is the message”, the software has become the medium (and thus, the message). 5 Software Filters the Message With the invention of the private computer, its developers started searching for ways to make it understandable to non-scientists. Maybe the most important development in this field has been the desktop metaphor. So far it has seemed to work fairly well; developers started to put all kinds of these metaphors into software and they made people understand computers better because of the references to existing physical objects. But the problem is that this imposes the idea of the computer as meta-medium. As a result the computer as medium in itself has become invisible behind all kinds of brush-metal windows and 3D-push buttons, and we tend to forget to question their logic. We often take software as a given fact, something that’s just there. But software, apart from influencing messages because of it’s logic, has another layer of influence, which is now becoming more obvious every day; politics. If we communicate using a software structure like the internet, aspects of the wider world such as free speech become an important issue here, too. That’s why it is so striking to see software companies functioning as an extension of less free regimes, such as Google for the government of China. Here Google is developing ways to filter the content of the “free” web, so that its Chinese users will not 10 6 OS / Free Software vs. Free Design / Libre find results that are considered harmful by the Chinese government. (It should be mentioned here that Google was one of the last search engines to submit to these demands from the Chinese government, which is both admirable and an index of the companies” power). Without necessarily passing judgement on Google or the Chinese government in this situation, it is a good example of why it is important for us to be able to look “through” software, to study the environments that manipulate our thoughts and that manipulate the information that is at the basis of formulating these thoughts. The inner-workings of Google are a big secret and can therefore in no way be objectively monitored. Hypothetically, what would prevent them from filtering results on, say, a person-to-person basis, or on an ip-location basis? These examples might seem far-fetched, but if I search using the term “test” on google.nl I get different and fewer results using the Safari browser than if I use Firefox (806 million results in Safari vs. 843 million in Firefox). This can be interpreted as at least some sort of browser-specific filtering already going on. It’s also no big secret that companies offering gratis services on the internet often generate money by selling the data they gather through their services. A friend gave me another recent example of software filtering of the message that is fuelled by politics: part of his practice as an artist involves researching new media. Another part involves photography, occasionally containing artistic nudity. So when a new system like Flickr appeared, he became an early and extensive user. It offered a very interesting way of combining two of his interests. But when Flickr was acquired by Yahoo and so became subject to its rules he was asked to remove his photos because they were considered sexually explicit content. Though internet companies haven’t at present much to do with the software we use to create graphic design, the situation is a strong example of the problem of relying completely on proprietary software. We have no way to monitor how they work, nor are we able to check what the major software companies might be planning in the future for their services. Some nowadays repressive regimes started out as ’Don’t be evil” revolutions (e.g. China) but power seems to have strange effects on people.4 We should never blindly rely on a particular software as our main let alone our only platform. 6 OS / Free Software vs. Free Design / Libre In the field of graphic design Open Source development can be regarded as a healthy alternative to proprietary software because it offers the possibility of studying / changing the source code, thereby disclosing how the program works, and how it may influence its user. This makes users less dependent on the original developer to make changes or solve bugs. Also, because most open source software uses Open Standards for saving files, users will not likely ’buy in” to a specific software but are free to exchange files and projects between different applications. At least, that is the idea of Open Standards. 4 Google’s corporate philosophy 9 11 The Shrink-Wrapped Design Process These are interesting times in the development of Open Source possibilities for graphic designers. For quite a lot of proprietary software a fairly developed open source alternative can be found. In the case of inDesign that would be Scribus, for Photoshop, The Gimp and for Illustrator, Inkscape. Then there are a whole bunch of less familiar but equally interesting software developments. For the purpose of giving an overview of the basic design software, however, these three examples should suffice. Without wanting to deny the political and philosophical impact of these projects, a practical issue is that they actually aren’t much more than a “free/libre” clone of existing proprietary software. The reason for this is simple, as Craig Bradney, part of the Scribus development team says: Our aim is not to replace wholesale other applications, but to provide the best DTP experience for Linux users – to provide the same kinds of tools users have had on other platforms and to use the inherent strengths of “Open Source Software and Linux/Unix” to Scribus advantage. 10 Though this is a perfectly legitimate reason for developers to create their software, the problem is twofold: firstly, the focus on “free as in libre”, is easily displaced to “free as in beer”. What is the importance of these developments, beside the fact that it doesn’t cost money to use them? Of course there is the advantages of it undermining the monopolistic landscape of (design) software, and that users are not made dependent on big companies. Although most Linux users are aware of this, and it may be a key consideration when they choose whether or not to use a particular piece of software, I have my doubts about how important this aspect really is to other users. Running Open Office on Windows is a lot less about being “free” and probably a lot more about being “gratis”. Though that’s as good a reason as any, this can in some ways be compared to using a black market reproduction of a product that has taken years of research and development. It looks the same, it works the same, but it’s Open Source. This comparison opens up another discussion in which one could argue that the way big companies have been able to become this big and rich is by underpaying their workers and patenting (other) peoples” ideas. Here, a motive could also be found for pleading for the right to take this knowledge back and make it public property. This is, however, something which will probably remain a point of contention for a long time, and is certainly not something I want to pass judgement on here. The second problem, which is actually more important to me, is that as a clone of existing software, these open source alternatives also copy the traps and mental models of their properietary counterparts. Therefore, in my opinion, for “free software” to be a valid term, the open sourcing of closed software by reverseengineering should be seen as only a beginning; a way to make software available as a field of study in order to discover its inner logic; to redevelop it in order to be really “free as in free speech”, or even thought. This doesn’t seem to be the aim of the free software movement at the moment. Just as much as the proprietary software it resembles, it focuses on making computing understandable by hiding it behind metaphors. These metaphors might actually be where the real problem lies. 12 6 OS / Free Software vs. Free Design / Libre If we take a look, for example, at Pure Data, a software developed as an open source project intended to work with any data, we see that there is much less hiding going on. The data is “wired” around by simple lines (like a pipe in the Unix command line environment), resembling nothing other than a line. Data flowing around can be manipulated in any conceivable way, if it don’t exist yet, it can be programmed. This same kind of openness or freedom can also be found in another open source project: Processing. As the website explains: Processing is an open source programming language and environment for people who want to program images, animation, and sound. [...] It is created to teach fundamentals of computer programming within a visual context and to serve as a software sketchbook and professional production tool. 11 This description also suggests a shift that seems necessary in current design education. In order to develop the design profession further in an interesting way instead of the constant spiral of visual sampling that it is now, a better understanding of media should be developed. Now that everybody can use software, and the pragmatic (theoretical) technical skills can be coded into computer systems, it becomes more and more important to develop this software further. Because, if software is the medium, it will be this software (digital media) that is part of the future subject of design. I’m not trying to say here that the formal study of conceptual thinking, or theoretical and technical knowledge, will become obsolete. Merely that, by getting a better understanding of our media, we will be able to design them better and to develop the design field further. To enable this understanding, it will be necessary to stop superimposing physical metaphors on everything computer related. This, as I have said, is causing an incorrect understanding of our media. This is the reason why, when constructing a website, designers often fail to use the potential of hypertext and hyper structures. They are trained to create an all inclusive conceptual idea and to communicate that within the technical possibilities of the medium (print). This might be why a website is often called a “page” and why designers often design them as if they were printed (preferably including kerning and all kinds of custom typefaces). In the digital media this attitude can only be seen as a dictatorial obsession, because part of (the strength of) digital media such as hypertext is that it can look different on any computer. Users get a say in how they would like to use the information you have designed, and therefore the design should focus more on structure and route than on punctuation. This obsessive focus on detail might be inherited from the physical world whose design and printing processes have been reproduced in computers. New media are much more modular. With the emerging generations of designers having been surrounded by computers all their life, it’s time to step out of representing the physical media within the computer. Designers should be trained in (at least the basics of) the underlying codes that make up the digital media in order to be able to really understand and use them. As Florian Cramer states: The closer the software is to the daily needs and work methods of programmers and system administrators, the higher typically its quality. 12 This shows how important it is for designers to start taking a more critical 13 The Shrink-Wrapped Design Process stance toward their software and to study it. The best Open Source software has been written in the field of programmers, simply because they found things missing or not working the way they wanted it to. Just as designers have been able to study and develop their processes and methodologies for years, now software (/programming) has become one of these processes and should be studied and developed the same way and with the same understanding. Maybe that way designers will learn to develop their own, really “free”, processes and escape the physical metaphors. 14 using the forkable repository The forkable repository is not at all a stable system. It’s a collection of scripts, tools, illustrations, documentation, an anarchive, perhaps a giant mess. The collection aims to be archive, production environment, documenation. From a technical perspective it tries to learn from a more or less time-tested design approach, that supports the kind of reuse I was looking for in the beginning. This set of design princliples gets to be talked about as the Unix Philosophy and makes software as reusable as forkable should be. The Unix Philosophy is present here as not the GNU in UNIX but in GNU/Linux, operating system and anarchive of software. The collection has been tested so far with Debian GNU/Linux and Ubuntu. 1 check it out You should be running GNU/Linux with subversion1 installed. sudo aptitude install subversion Do a checkout: svn co http://code.lafkon.net/subversion/forkable You will be asked for username and password. If you do not have already one, please send an email. Because we are currently on a test run, the subversion repository is not completly open to the public while you can browse everything at http://www.forkable.eu. The checkout may take some time because there is a rather large collection of vector illustrations from http://vektordb.lafkon. net included. 2 check the system Because, what is forkable at the moment, is a diversity of tools, glued together mostly inside bash scripts, there is a bunch of software that is actually needed to get everything working. 1 What is subversion? 15 using the forkable repository prepare your LATEX installation First you need a TEX installation for Debian and Ubuntu that is texlive. sudo aptitude install texlive Add the forkable TEXMF path to your local tex installation: Open /etc/texmf/texmf.cnf with a text editor. sudo nano /etc/texmf/texmf.cnf Add the following: TEXMFFORKABLE = /path/to/your/forkable/folder/utils/latex/TEXMF look for a line something like this: TEXMF = $TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,$TEXMFSYSCONFIG,!!$TEXMFSYSVAR, and the variable for the forkable TEXMF folder: TEXMF = $TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,$TEXMFFORKABLE,$TEXMFSYSCONFIG, You must do this so that LATEX finds the packages that are distributed with forkable. Reload TeX. sudo texhash install software you need to have java installed. sudo aptitude install sun-java5-bin you can the check_the_system.sh script to test which software you need to install. 3 folder structure generators Like the name says things that generate something. This is most active part of forkable release Finished stuff that is not really used anymore like a print layed book. utils Things that are usefull. Has become right now kind of a wastedump, for all stuff not matching categories. i 16 i/free + i/non-free For the distribution of projects i decided to differentiate data into free and non-free. Most projects include data that is the property of a third party like logos and therefore can not be put under free licenses. for the public svn checkout the non-free directories are excluded. to get layouts and scripts working nontheless these files are replaced by free supplementals. i/*/v vector graphics. see jon phillips i/*/p raster images to be included. p for pixel i/tmp local temporary directory. i/a – follow the donkey path Der Esel geht im Zickzack, döst ein wenig, blöde vor Hitze und zerstreut, geht im Zickzack, um den großen Steinen auszuweichen, um sich den Anstieg sanfter zu machen, um den Schatten zu suchen. 13 i/a is a recursive link i use so far for linking documents. this link stays the same for all documents what makes it easy to include documents into each other without specifying an absolute link. as far as i know latex resolves links not relative to the document path but relative to the root document. if i include in release/osk/Offener_Schaltkreis.tex via \input the document generators/lacmachine/doc/lacmachine.tex that uses a graphic via \include{i/v/graphic.pdf that is stored in generators/lacmachine/doc/i/v/graphic.pdf i can’t release/osk/Offener_Schaltkreis.tex because it searches for an image i/v/graphic.pdf that obviously does not exist. by providing each latex directory through a symlink with the path i/a i can link images with the path i/a/generators/lacmachine/doc/i/v/graphic.pdf, that is the same for release/osk/Offener_Schaltkreis.tex AND generators/lacmachine/doc/lacmachine.tex. Better solution welcome. o o/non-free output rendered with proprietary parts. not in the subversion repository. online at http://www.forkable.eu o/free output directories used for scripts in the subversion directory. 17 flexcommentbox 1 use This command creates a box that can be moved around the page. \flexcommentbox{.5\paperwidth}{.5\paperheight}{.5\textwidth} \flexcommentbox{1}{2}{3}{4} • • • • 1 is the X position 2 is the Y position 3 is the width 4 is what is inside (not outside) the box Height adjusts to the content of the box. 2 macro code \ newcommand \ flexcommentbox [4] {% \ deffootnote [1.5 em ]{1.5 em }{1 em }{\ textsuperscript {}} \ footnotetext { \ setlength \ fboxsep {10 pt }% \ vspace {#2} \ makebox [.5\ textwidth ][ l ]{ \ hspace {#1} \ parbox {#3}{ \ vspace { -1\ textheight } \ colorbox { white }{ % {\ small \ parbox {#3}{ \smallskip #4 % \smallskip } } } } } } } 3 examples 19 \flexcommentbox{.1\textwidth}{.2\textheight}{.5\textwidth}{} \flexcommentbox{.5\textwidth}{-.2\textheight}{.5\textwid fullpage 1 use This command creates a single image page. Takes 5 parametres. \fullpage{path/to/image}{1.5}{80,angle=45}{120}{optional pag \fullpage{1}{2}{3}{4}{5} • • • • • 1 is the path to an image 2 is the scale 3 is the x offset 4 is the y offset 5 is an optional page command Height adjusts to the content of the box. 2 macro code \ newcommand {\ fullpage }[5]{ \ newpage {\ renewcommand {\footnoterule}{\ rule {0 pt }{0 pt }} % REMOVE FOOTNOTERULE \ includepdf [ scale =#2 , offset =#4 #3 , pagecommand ={ \ thispagestyle { empty } #5 \ newpage }] {#1} } % REMOVE FOOTNOTERULE \ renewcommand {\footnoterule}{\ vspace *{10 pt } % REMOVE FOOTNOTERULE \hrule width 0.4\ columnwidth \ vspace *{10 pt }} % REMOVE FOOTNOTERULE } 3 examples 21 \fullpage{path/to/image}{1.5}{80}{120}{\flexcommentbox} \fullpage{path/to/image}{1.5}{80}{120}{\flexcommentbox} You can hack your own command by sneaking a parameter into the vertical offset brackets. For more parametres see the pdfpages package \fullpage{path/to/image}{1.5}{80,angle=45}{120}{\flexcommentbox} doublepage 1 use This command spreads an image over a double page. Takes 3 parametres, automatic recognition of even and odd pages is buggy, has been removed and should be done by eye and hand. \doublepage{path/to/image}{2.5}{-200} \doublepage{1}{2}{3} • 1 is the path to an image • 2 is the scale factor • 3 is the vertical 2 macro code \ newcommand {\ doublepage }[3]{ \ ifthispageodd { %\ hardpagebreak % DOPPELSEITE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ includepdf [ scale =#2 , offset = -260 #3] {#1} \ includepdf [ scale =#2 , offset = -300 #3] {#1} % DOPPELSEITE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\ twocolumn [] % DEATH PROOF PAGEBREAK }{ % DOPPELSEITE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ includepdf [ scale =#2 , offset = -260 #3] {#1} \ includepdf [ scale =#2 , offset = -300 #3] {#1} % DOPPELSEITE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\ twocolumn [] % DEATH PROOF PAGEBREAK \ clearpage }} 3 examples 25 gridpage 1 use This command creates a 3x3 grid. 9 is the maximum number of arguments LATEX takes by default. \grid{einmal}{zweimal}{dreimal}{viermal}{f"unfmal}{sechsmal} \gridpage{1}{2}{3}{4}{5}{6}{7}{8}{9} • • • • • • • • • 1 is left top 2 is left center 3 is left right 4 is center top 5 is center center 6 is center bottom 7 is right top 8 is right center 9 is right bottom 2 macro code \ newcommand {\ grid }[9]{ % \ hspace { -.5\ universalgrid } \ begin { picture }(0 ,0) % \ put (0.2 , -2.4){#1} % |} \ put (0.2 , -1.2){#4} % |} \ put (0.2 , -3.6){#7} % |} \ put (1.3 , -2.4){#2} % |} \ put (1.3 , -1.2){#5} % |} \ put (1.3 , -3.6){#8} % |} \ put (2.4 , -2.4){#3} % |} \ put (2.4 , -1.2){#6} % |} \ put (2.4 , -3.6){#9} % |} \end{ picture }% \ twocolumn [] % DEATH PROOF PAGEBREAK } 3 examples 29 gridpage viermal fünfmal sechsmal einmal zweimal dreimal siebenmal achtmal neunmal 30 3 examples 31 gridpage 32 3 examples 33 gridpage 34 graphic 1 use This command lets you include a graphic. It takes 5 parametres. \graphic{0}{0}{400}{400}{path/to/graphic}{1pt} \graphic{1}{2}{3}{4}{6} • • • • • • 1 is x start for the crop box 2 is y start for the crop box 3 is x end for the crop box 4 is y end for the crop box 5 is the path to the graphic 6 is weight for the border around the image 2 macro code \ newcommand {\ graphic }[7]{ \ setlength \ fboxsep {0 pt } \ setlength \ fboxrule {#7} \ fbox { \ includegraphics [ viewport =#2 #3 #4 #5 , clip , width =#6]{#1} } } 3 examples 35 graphic 36 3 examples 37 graphic 38 scalefontXtimes 1 use This writes simply writes a string and an upcounting \scalefont{.} into a texfile. # !/ bin / bash TEXGENERATED =o/ scalefontXtimes . tex COUNT =10 rm $TEXGENERATED while [ $COUNT -lt 90 ] do DEZ =‘echo 000 $COUNT | rev | cut -c 1 -2| rev ‘ SCALEFACTOR =‘echo $DEZ | cut -c 1 ‘. ‘echo $DEZ | cut -c 2 -3 ‘ echo " {\ scalefont {" $SCALEFACTOR "}" >> $TEXGENERATED echo " Networked Media Master }" >> $TEXGENERATED COUNT =‘expr $COUNT + 5‘ done exit 0; 39 scalefontXtimes Networked Media Master Networked Media Master worked Media Master dia Master Net- Networked Me- Networked Media Master Networked Me- dia Master Networked Media Master Net- worked Media Master Networked Me- dia Master Net- worked Media Master Networked Media Master Networked Media Master Net- worked Media Master Net40 1 use worked Media Master Networked Media Master Networke Media Master 41 Albert # !/ bin / bash TEXGENERATED = graphics . tex COUNT =0 ROTATION =0 rm $TEXGENERATED while [ $COUNT -lt 10 ] do DEZ =‘echo 000 $COUNT | rev | cut -c 1 -2| rev‘ SCALEFACTOR =‘echo $DEZ | cut -c 1 ‘. ‘echo $DEZ | cut -c 2 -3 ‘ # echo "\ scalefont {" $SCALEFACTOR "}" >> $TEXGENERATED # echo " Networked Media Master " >> $TEXGENERATED echo "\ graphic { albert & tineke . jpg }" >> $TEXGENERATED echo " {0}{0}{500}{300 , angle =${ ROTATION }}{ $SCALEFACTOR \ linewidth }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED echo "\ graphic { ISHARD . jpeg }" >> $TEXGENERATED echo " {0}{0}{200}{300 , angle =${ ROTATION }}{ $SCALEFACTOR \ linewidth }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED echo "\ graphic { rdam . jpg }" >> $TEXGENERATED echo " {0}{0}{100}{220 , angle =${ ROTATION }}{ $SCALEFACTOR \ linewidth }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED echo "\ graphic { albert & tineke . jpg }" >> $TEXGENERATED echo " {0}{0}{200}{300 , angle =${ ROTATION }}{ $SCALEFACTOR \ linewidth }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED echo "\ graphic { albert & tineke . jpg }" >> $TEXGENERATED echo " {0}{0}{505}{300 $RANDOM , angle =${ ROTATION }}{ $SCALEFACTOR \ linewidth }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED echo " ROTTERDAM = HARD " >> $TEXGENERATED echo "{ ROTTERDAM = HARD }" >> $TEXGENERATED COUNT =‘expr $COUNT + 1‘ ROTATION =‘expr $ROTATION + 36 ‘ done exit 0; 43 1 blaaablabla hahahaha 7777777 ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROT- TERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD ROTTERDAM = HARD Birgit # !/ bin / bash TEXGENERATED = forgrid . tex COUNT =1 rm $TEXGENERATED echo "\ grid " >> $TEXGENERATED while [ $COUNT -lt 10 ] do DEZ =‘echo 000 $COUNT | rev | cut -c 1 -2| rev‘ SCALEFACTOR =‘echo $DEZ | cut -c 1 ‘. ‘echo $DEZ | cut -c 2 -3 ‘ for i in {1..9} do number1 =$[ ( number2 =$[ ( number3 =$[ ( number4 =$[ ( number5 =$[ ( $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM % % % % % 200 ) + 1 ] 200 ) + 1 ] 373 ) + $number1 ] 373 ) + $number2 ] 10 ) + 1 ] echo "{" >> $TEXGENERATED echo " \ graphic { broadwayy . pdf }" >> $TEXGENERATED echo " {${ number1 }}{ ${ number2 }}{ ${ number3 }}{ ${ number4 }}{ $SCALEFACTOR \ universalgrid }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED for j in {1.. ${ number5 }} do echo " \ graphic { broadwayy . pdf }" >> $TEXGENERATED echo " {${ number2 }}{ ${ number1 }}{ ${ number3 }}{ ${ number4 }}{0.5\ universalgrid }" >> $TEXGENERATED echo " {0 pt }" >> $TEXGENERATED done echo "}" >> $TEXGENERATED done COUNT =‘expr $COUNT + 3‘ echo "\ newpage " >> $TEXGENERATED done exit 0; 59 60 61 62 63 64 Dar 1 The Guide for the manual 3 Dosing and how to use The word “voda” (water) can, as a vocal inscription, be interpreted in endless ways, by varying specific sounds, rhythmically, by permutations, paying attention to the quality, length, intensity of the sound.... Only several possibilities will be questioned here. This manual should be used as a combined sheetriver and lake writing*, intended for verbal interpretation. Every single letter-voice lasts for 1 second. The pause lasts in accordance to the number of voices it stands instead of. The size corresponds to sound intensity, and in the case of more successive voices, a flow, fluid sound should be maintained. Naturally, virtuosity shines through and there is a great level of creative interpretation which can be witnessed through gestures, attitude, dramatic elements, melodiousness ... Screaming is allowed. Typos represent the parts which are to be emphasized. It is considered to have an immensely bigger effect on the younger population (i.e. if used from an early age). That doesn’t mean that it has no effect on adults, but it is less intense, due to some well constructed mechanisms of defense, prejudice, rejection of new methods, change of linguistic identity and habitual behavioral patterns. It showed interesting results in the field of breaking through some verbal regularities and limitations. The impact of that verbal flexibility on the thinking progress is being examined momentarily, because it is considered to have a beneficial effect in that field. There are also indications of a larger percentage of brain activity after longer use, which is certainly interesting, because humans use the minimum of their brain potential (2-3 percent, mostly passively). In the beginning it is necessary to read the manual several times a day, both silently and out loud, in order to adapt the vocal tract. Later, reading out fluently once a day is sufficient. It’s possible to read mutually (with one person), or collectively (with several persons), simultaneously or completely separately, hierarchically or anarchically, in agreement or entirely free, in improvisation (so-called jazz reading). 1 Effect The manual for reading the word “voda” has a beneficial effect on the lip region, throat muscles, verbal flexibility and diction, helps in the removal of rigidness in the vocal tract and potentially leads to creative forming of voices and sound units of a broad spectrum, starting from monosyllabic and polysyl4 Counter indications and side-effects labic, reaching complex sound units. In several cases it has even led to the successful elimination of dyslexia, None have been proven so far, except among peoamnesia and autism, awakening the primal urge for ple with obsessive-compulsive disorder that can be communication (which is in relation to the speaking triggered by use of the manual. It may also cause a patterns of the collective unconscious). The effect vigorous, overwhelming creative urge which can be can be felt immediately after the first reading. controlled by paralleled reading of tabloids. There were some cases of water on the and kidney gravel among people with a predisposition toward psycho2 Uses somatic diseases. There was one case of sea sickHabitual phraseology, uniform intonation, the spe- ness, but this is attributed to the domain of coinciech of merged vocals and mouth half open, stutter- dence (casus coincidentalis). It is recommended to ing, losing of the sensibility for sonority, construc- pregnant women, but it is necessary to know that the use of this manual, due to its acceleratory effect, can tions of emotional dullness. 65 lead to premature birth. Not to be mixed with neither alcohol nor psychoactive substances, because it can lead to paranoid aspirations, and in severe cases to verbal character separation of the personality. 5 Storage Keep in a dry place at temperatures ranging from 5 to the limit of combustion, although optimally it should be kept within moderate continental climate of the middle upper class of democratic societies in the post communist period. An issue for societies in transition hasn’t been made yet, because it wasn’t considered as a long term period. However, a new issue is under serious consideration at the moment, due to the movement of those societies on a path picturesquely named circulus vitiosus. Keep out of the reach of pets, on a shelf or a workspace. Naturally, it can be carried in a purse/briefcase, schoolbag, sports bag, grocery bag, backpack, pouch or sack, but the ambient for reading is of vital importance. 6 Best before : There is no expiration date, which means that the product can be used as long as eyesight and hearing permit. *rec̆ni is a homonym in Serbian meaning both something in relation to word, and river ... import sys , random voda = ’voda ’ # def space ( number ): # gap = "" # for i in range ( number ): # gap = gap + " " # return gap f = open (’ water .tex ’, ’w ’) header = """\ documentclass [8 pt ]{ scrbook } \ usepackage {i/a/ utils / latex / sty /LSI -191 x235 + crop } \ usepackage {i/a/ workshop / bag / Boxes_and_Glue } \ usepackage {00 _NEWCOMMANDS } """ f. write ( header ) f. write (" \\ begin { document }\ n") # def letterfill () : def pgfill (a ,b ,c): for i in range (a): f. write ("\ hfill ") for i in range (b): f. write (" \\ hspace {" + str ( random . random () +0.001) + " \\ textwidth }" + voda [ random . randint (0 ,c) ]* random . randint (0 ,50) ) m = i for j in range (m): if random . randint (0 ,10) == 1: f. write (" \\ vfill \n") m = i +1 # f. write ("\ scalefont {0.3}") pgfill (60 , 1, 3) pgfill (1 , 50 , 1) # for i in range (20) : # pgfill (i , random . randint (0 , i) * 2,i%3 ,i) f. write ("\n \\ end { document }") 66 vvv vv vv v vv vv vvv vvv vvvv vvv vvv ooo ooo ooo vvv oo oooo vv v vvv dddd vvv oooo vvv vvvv vvvvv vv vv vv vvvv vvvv vvvvv oo dd oo ddd ooo o o ddd vvvv vv vvvvv vvvvv vvvvvv oo vv vvvvvvv o o o oooo vvvv vvvv ooooo o oooo o ooo vv oooo vvvv ooooo ooo vvvvvvv vvvvv ooooo vvvvv vvvvv oooooo oooooo vvvvvv vvvvv vvvv ooooooo oo vvvvvv vvvvvvv vvvv vvvvvvv vvvvv vvvvvvv ooooo vvv vvvvvv vvvvvvv oooooo oooo vvvvv ooo ooo oo vvvvvv oooooo oo vv vvvvv vv vvvv oooo vvvvvvv vv oooooo ooooooo vvv ooo ooooooo vvvvvv vvvvv ooo o vv v vvvvv vv vvv oo vvvvvvv oooo oooo o vvvvvv ooo oooooo vvv vvv o vvvvvvvv vvvvvvv vvvvvvv ooo ooooooo vvvvvvv dd ooooooo v ddd oo vvvv ddd ooooooo dddd vvv v vvvvv dddd dddddddd dddddd vv dddddd ooooooo vvvvvvvvvv vvv oooooo vvvv vvvvvvvvv vv vvvvv oo vvvvvvvvv v oo oooooooooo oooo dd d v vv vvv aaa aa aaa aaaa dd aaa oooo o vvvv aaa a oo ddd dd dd dd aaaa dd v a dd aa ooo vvvv vvv vvv vvv d ooo ddd aaaa dddd d v aaaa ddd dddd aa ooo o oooo aaaa vvv a vvvv vvvv vvv vvvvvvvvvvv dddddd vvvvvvv oooooooooooooo vvvvvvvvvvvvvv ooooooo ooooooooo vvvvvvvv oooooooooooooo ooooooooooooo ooooooooooooooooooo oooooooooooooooooo o v vvvvvvvvvvvvvvvvv oooooooooo vvvvvv vvvvvv o ooo ooooooooooooo vvvvvvvvvvvvvvvvvvv vvvv vvvvvvv oooooooooooooooo oo vvvvvvvvvvv oooo ooooooooo vvvvv oooooooooooooooo vvvv vvvvvvvvvvvvvvvvv vvv vvvvvvvvvvvvvv v vvvvvvvvvvvv ooooo o vvvvvvvvvvvvvvvvvv oooooooooooooooooo vvvvvvvvvvvvv oooo oooooooo vvvvvvvvvvvvv vvvvvvvvvvvv vvvvvvvvvvvvvvv vvvvvvvvv oooooooooo vvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvv vvvvvvvvvvv ooooo vvvvvvvvvv vvvvvvv vvvvv vvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvv oooo oooooooo v vvvvvvvvv oo vvvvvvvv vvvvvvvvvvvv oooooo vvv vvv vvv vvv ooooo ooooooooooo vvvvvvvv vvvvv oooooooo oooooooooooooooo vvvvvvvvvvvvvv oooooooooooooooo vvvvvvvvvvvvvvvvvv oooooooooo vvvvvv vvvvvvvvvvvvvvvvvvv vvvvvvvv vvvvvvvvvv ooooooo oooooooooo vvvvvvvvvvv ooooooooooooooooo vvvvvvvvvvvvvvvv oooooooooooooooooo vvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvv ooooooooooooo vvvvvvvvvvvvvvvv oooooooooo vvvvvvvvvvv vvvvvvvvvvvvvvvvv ooooooo vvvvvvvvvvv vvvvvvvvvvvvv vvvvvvvv oooooooo Emanuele import random numpage =10 for i in range ( numpage ): print " \\ section { square }" print " \\ begin { picture }(0 ,0) " for c in range ( random . randint (1 , 50) ): print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 , 100) /100.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/a/ utils / graphics / blank / black . pdf }" print "}" print " \\ end { picture }" print " \\ newpage " 73 import random numpage =10 for i in range ( numpage ): print " \\ section { square }" print " \\ begin { picture }(0 ,0) " for c in range ( random . randint (1 , i +1) ): print " \\ put ("+ str ( random . randint (0 , c +1) /10.0) +" ,"+ str ( random . randint (0 , c +1) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 ,10) /10.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/a/ utils / graphics / blank / black . pdf }" print "}" print " \\ end { picture }" print " \\ newpage " 74 import os import random numpage =10 colors = [’red ’,’ pink ’,’ purple ’] for i in range ( numpage ): print print print print print " \\ section {} " " \\ Huge \\ textbf { dT (Y) Tb }" " \\ newline " " \\ Huge \\ textbf { Feed The Bears !} " " \\ begin { picture }(0 ,0) " for c in range ( random . randint (1 , 50) ): randomop = str ( random . randint (1 ,10) /10.0) randomcolor = colors [ random . randint (0 ,2) ] os . system (’ convert - size 100 x60 xc : transparent - fill ’+ randomcolor +’ - stroke white - draw " polygon 0 , ’+ str ( random . randint (0 , 60) )+’ ’+ str ( random . randint (0 , 100) )+ ’ ,0 60 , ’+ str ( random . randint (0 , 60) )+’ 100 , ’+ str ( random . randint (0 , 60) )+’" flatten draw_polygon ’+ str (c)+ ’. gif ’) os . system (’ autotrace -corner - threshold 1000 draw_polygon ’+ str (c) + ’. gif -output - file draw_polygon ’+ str (c)+ ’. pdf ’) print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale =1 , angle ="+ str ( random . randint (0 ,360) )+" ]{ draw_polygon "+ str (c)+". pdf }" print "}" print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 , 100) /100.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/a/ utils / graphics / blank / black . pdf }" print "}" print " \\ end { picture }" print " \\ newpage " 75 import os import random numpage =10 for i in range ( numpage ): print print print print print " \\ section {} " " \\ Huge \\ textbf { dT (Y) Tb }" " \\ newline " " \\ Huge \\ textbf { Feed The Bears !} " " \\ begin { picture }(0 ,0) " for c in range ( random . randint (1 , 50) ): randomop = str ( random . randint (1 ,10) /10.0) os . system (’ convert - size 100 x60 xc : transparent - fill black - stroke black - draw " polygon 0 , ’+ str ( random . randint (0 , 60) )+’ ’+ str ( random . randint (0 , 100) )+ ’ ,0 60 , ’+ str ( random . randint (0 , 60) )+’ 100 , ’+ str ( random . randint (0 , 60) )+’" - flatten draw_polygon ’+ str (c)+ ’. gif ’) os . system (’ autotrace -corner - threshold 1000 draw_polygon ’+ str (c) + ’. gif -output - file draw_polygon ’+ str (c)+ ’. pdf ’) if (c %2==0) : print " \\ put ("+ str ( random . randint (0 , 30) / -10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale =1 , angle ="+ str ( random . randint (0 ,360) )+" ]{ draw_polygon "+ str (c)+". pdf }" print "}" print " \\ put ("+ str ( random . randint (0 , 30) / -10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 , 50) /100.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/ a/ utils / graphics / blank / black . pdf }" print "}" else: print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale =1 , angle ="+ str ( random . randint (0 ,360) )+" ]{ draw_polygon "+ str (c)+". pdf }" print "}" print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 , 50) /100.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/ a/ utils / graphics / blank / black . pdf }" print "}" print " \\ end { picture }" print " \\ newpage " 76 1 dT(Y)Tb Feed The Bears! 77 2 dT(Y)Tb Feed The Bears! 78 3 dT(Y)Tb Feed The Bears! 79 4 dT(Y)Tb Feed The Bears! 80 5 dT(Y)Tb Feed The Bears! 81 6 dT(Y)Tb Feed The Bears! 82 7 dT(Y)Tb Feed The Bears! 83 8 dT(Y)Tb Feed The Bears! 84 9 dT(Y)Tb Feed The Bears! 85 10 dT(Y)Tb Feed The Bears! 86 Loredana import os import random numpage =10 for i in range ( numpage ): print print print print print " \\ section {} " " \\ Huge \\ textbf { dT (Y) Tb }" " \\ newline " " \\ Huge \\ textbf { Feed The Bears !} " " \\ begin { picture }(0 ,0) " for c in range ( random . randint (1 , 50) ): randomop = str ( random . randint (1 ,10) /10.0) os . system (’ convert - size 100 x60 xc : transparent - fill black - stroke black - draw " polygon 0 , ’+ str ( random . randint (0 , 60) )+’ ’+ str ( random . randint (0 , 100) )+ ’ ,0 60 , ’+ str ( random . randint (0 , 60) )+’ 100 , ’+ str ( random . randint (0 , 60) )+’" - flatten draw_polygon ’+ str (c)+ ’. gif ’) os . system (’ autotrace -corner - threshold 1000 draw_polygon ’+ str (c) + ’. gif -output - file draw_polygon ’+ str (c)+ ’. pdf ’) if (c %2==0) : print " \\ put ("+ str ( random . randint (0 , 30) / -10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale =1 , angle ="+ str ( random . randint (0 ,360) )+" ]{ draw_polygon "+ str (c)+". pdf }" print "}" print " \\ put ("+ str ( random . randint (0 , 30) / -10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 , 50) /100.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/ a/ utils / graphics / blank / black . pdf }" print "}" else: print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale =1 , angle ="+ str ( random . randint (0 ,360) )+" ]{ draw_polygon "+ str (c)+". pdf }" print "}" print " \\ put ("+ str ( random . randint (0 , 30) /10.0) +" ,"+ str ( random . randint (0 , 50) / -10.0) +"){" print " \\ includegraphics [ scale ="+ str ( random . randint (1 , 50) /100.0) +" , angle ="+ str ( random . randint (0 ,360) )+" ]{ i/ a/ utils / graphics / blank / black . pdf }" print "}" print " \\ end { picture }" print " \\ newpage " 87 88 89 90 91 Megan [ import random , sys visual poetry of was still header = is’’’\ documentclass [8tends pt ]{ scrbook } \ usepackage {i/a/ utils / latex / sty /LSI -191 x235 + crop } \ usepackage {i/a/ workshop / bag / Boxes_and_Glue } \ usepackage {00 _NEWCOMMANDS } is ’, ’ important ’, ’in conveying ’, ’the intended ’, ’ effect of ’, ’the work ’, ’it is ’, ’ sometimes ’, ’ referred to ’, ’as concrete ’, ’poetry ’, ’a term ’, ’ that predates ’, ’ visual poetry ’, ’and ’, ’at one time ’, ’was synonymous ’, ’ with it ’ ’ visual poetry ’, ’was ’, ’ heavily influenced ’, ’by Fluxus ’, ’ which is ’, ’ usually ’, ’ described ’, ’as ’, ’ being intermedia ’, ’ intermedia ’, ’ work ’, ’tends ’, ’to blur ’, ’the distinctions ’, ’ between different ’, ’media ’, ’and visual poetry ’, ’blurs ’, ’the distinction ’, ’ between art ’, ’ and text ’, ’ whereas ’, ’ concrete poetry ’, ’is still ’, ’ recognizable ’, ’as poetry ’, ’ being composed ’, ’of ’, ’purely ’, ’ typographic ’, ’ elements ’, ’ visual poetry ’, ’is generally ’, ’ much less ’, ’text - dependent ’, ’visual ’, ’poems ’, ’ incorporate ’, ’text ’, ’but ’ ’ the text ’, ’may have ’, ’ primarily ’, ’a visual ’, ’ function’, ’visual ’, ’poems ’, ’ often incorporate ’, ’ significant ’, ’ amounts ’, ’of non - text ’, ’ imagery ’, ’in addition ’, ’to ’, ’text ’, ’there ’, ’ remains some ’, ’debate ’, ’ regarding ’, ’the distinction ’, ’ between concrete ’, ’poetry ’, ’ and visual ’, ’poetry ’, ’there ’, ’are ’, ’ three dominant ’, ’ views regarding ’, ’the issue ’, ’one view ’, ’is ’, ’ that visual ’, ’ poetry is ’, ’ synonymous with ’, ’ concrete ’, ’poetry ’, ’a second ’, ’view ’, ’is ’, ’that ’, ’visual ’, ’poetry ’, ’is ’, ’a type’, ’( or sub - category ) ’, ’of concrete ’, ’poetry ’, ’and ’, ’ the last ’, ’view ’, ’( adopted in ’, ’ this article ) ’, ’is that ’, ’ visual poetry ’, ’has ’, ’ evolved into ’, ’a visual ’, ’ form distinct ’, ’ from concrete ’, ’poetry ’, ’this ’, ’view ’, ’ is supported ’, ’by work ’, ’ identified ’, ’as visual ’, ’ poetry ’, ’in which ’, ’ typographic ’, ’ elements ’, ’are ’, ’ secondary ’, ’to visual ’, ’ elements ’, ’are minimal ’, ’or in some ’, ’cases ’, ’are absent ’, ’ altogether from ’, ’the work ’, ’!’, ’?’, ’!’, ’?’, ’!’, ’? ’] as by Fluxus it is in which with itvisual poetry described usually important the distinctions or arrangement which isconcrete poetry purely the visual being composed sometimes the work art whereas \\ begin { document } referred to as concrete effect of a term between different at one time \ setlength {\and unitlength }{.5\ paperwidth blurs intermedia heavily influenced } images and symbols visual poetry being intermedia \\ newcommand {\\ tib }[1]{ \ colorbox { black }{\ color { white }# 1} } ’’’ f = open (’ mypage .tex ’, ’w ’) poetry f. write ( header ) is and visual poetry is poetry that predates f. write ( ’\\ begin { picture }(0 ,0) \n\n ’) of text # These words are from poems from Shakespeare , Sir William Scott and Sappho in conveying # let = [’ blow ’, ’thou ’, ’winter ’, ’ wind ’, ’art ’, ’not ’, ’so ’, ’ unkind ’, ’as ’, ’mans ’, ’ ingratitude ’, ’thy ’, ’tooth ’, ’ is ’, ’not ’, ’keen ’, ’oh !’, ’ young ’, ’ Lochinvar ’, ’is ’, ’ come ’, ’out ’, ’of ’, ’the ’, ’ west ’, ’ through ’, ’all ’, ’the ’, ’wide ’, ’border ’, ’his ’, ’ steed ’, ’was ’, ’the ’, ’best ’, ’ and ’, ’save ’, ’his ’, ’good ’, ’ broadsword ’, ’he ’, ’ weapons ’, ’ had ’, ’none ’, ’he ’, ’rode ’, ’ all ’, ’ unarmed ’, ’and ’, ’he ’, ’ rode ’, ’all ’, ’alone ’, ’ without ’, ’ warning ’, ’as ’, ’a ’, ’ whirlwind ’, ’swoops ’, ’on ’, ’an ’, ’oak ’, ’love ’, ’shakes ’, ’my ’, ’heart ’ ] # These words are from the Wikipedia page on Visual Poetry let = [’ visual ’, ’poetry ’, ’is poetry ’, ’or ’, ’art ’, ’in which ’, ’ the visual ’, ’ arrangement ’, ’of text ’, ’ images and symbols ’, ’ to blur work was synonymous the intended 93 for i in range (50) : pos = random . randint (0 ,8) letter = let [ pos ] del let [ pos ] # print letter , f. write (" \\ put ("+ str ( random . random () ) + " , "+ str ( random . random () -1) + ") {\\ tib {" + letter + " }}\ n") f. write ( ’\n \\ end { picture }\n ’) f. write ( ’\\ end { document }\n ’) 94 import random , sys header = ’’’\ documentclass [8 pt ]{ scrbook } \ usepackage {i/a/ utils / latex / sty /LSI -191 x235 + crop } \ usepackage {i/a/ workshop / bag / Boxes_and_Glue } \ usepackage {00 _NEWCOMMANDS } \\ newcommand {\\ tib }[1]{ \ colorbox { black }{\ color { white }# 1} } \\ begin { document } \ setlength {\ unitlength }{.5\ paperwidth } ’’’ f = open (’ mypage .tex ’, ’w ’) f. write ( header ) f. write ( ’\\ begin { picture }(0 ,0) \n\n ’) # These words are from poems from Shakespeare , Sir William Scott and Sappho # let = [’ blow ’, ’thou ’, ’winter ’, ’wind ’, ’art ’, ’not ’, ’so ’, ’unkind ’, ’as ’, ’ mans ’, ’ ingratitude ’, ’thy ’, ’tooth ’, ’is ’, ’not ’, ’keen ’, ’oh !’, ’young ’, ’ Lochinvar ’, ’is ’, ’come ’, ’out ’, ’of ’, ’the ’, ’west ’, ’ through ’, ’all ’, ’ the ’, ’wide ’, ’border ’, ’his ’, ’steed ’, ’was ’, ’the ’, ’best ’, ’and ’, ’save ’, ’his ’, ’good ’, ’ broadsword ’, ’he ’, ’ weapons ’, ’had ’, ’none ’, ’he ’, ’rode ’, ’all ’, ’ unarmed ’, ’and ’, ’he ’, ’rode ’, ’all ’, ’alone ’, ’ without ’, ’ warning ’, ’as ’, ’a ’, ’ whirlwind ’, ’swoops ’, ’on ’, ’an ’, ’oak ’, ’love ’, ’ shakes ’, ’my ’, ’heart ’ ] # These words are from the Wikipedia page on Visual Poetry let = [’ visual ’, ’poetry ’, ’is poetry ’, ’or ’, ’art ’, ’in which ’, ’the visual ’, ’ arrangement ’, ’of text ’, ’ images and symbols ’, ’is ’, ’ important ’, ’in conveying ’, ’the intended ’, ’ effect of ’, ’the work ’, ’it is ’, ’ sometimes ’, ’ referred to ’, ’as concrete ’, ’poetry ’, ’a term ’, ’ that predates ’, ’ visual poetry ’, ’and ’, ’at one time ’, ’was synonymous ’, ’ with it ’ ’ visual poetry ’, ’was ’, ’ heavily influenced ’, ’by Fluxus ’, ’ which is ’, ’ usually ’, ’ described ’, ’as ’, ’ being intermedia ’, ’ intermedia ’, ’work ’, ’tends ’, ’to blur ’, ’the distinctions ’, ’ between different ’, ’media ’, ’and visual poetry ’, ’blurs ’, ’the distinction ’, ’ between art ’, ’and text ’, ’ whereas ’, ’ concrete poetry ’, ’is still ’, ’ recognizable ’, ’as poetry ’, ’ being composed ’, ’of ’, ’purely ’, ’ typographic ’, ’ elements ’, ’ visual poetry ’, ’is generally ’, ’ much less ’, ’text - dependent ’, ’visual ’, ’poems ’, ’ incorporate ’, ’text ’, ’but ’ ’the text ’, ’may have ’, ’ primarily ’, ’a visual ’, ’function ’, ’visual ’, ’poems ’, ’ often incorporate ’, ’ significant ’, ’ amounts ’, ’of non - text ’, ’ imagery ’, ’in addition ’, ’to ’, ’text ’, ’there ’, ’ remains some ’, ’debate ’, ’ regarding ’, ’the distinction ’, ’ between concrete ’, ’poetry ’, ’ and visual ’, ’poetry ’, ’there ’, ’are ’, ’ three dominant ’, ’ views regarding ’, ’the issue ’, ’one view ’, ’is ’, ’ that visual ’, ’ poetry is ’, ’ synonymous with ’, ’ concrete ’, ’poetry ’, ’a second ’, ’view ’, ’is ’, ’that ’, ’visual ’, ’ poetry ’, ’is ’, ’a type’, ’( or sub - category ) ’, ’of concrete ’, ’poetry ’, ’and ’, ’the last ’, ’view ’, ’( adopted in ’, ’ this article ) ’, ’is that ’, ’ visual poetry ’, ’has ’, ’ evolved into ’, ’a visual ’, ’ form distinct ’, ’ from concrete ’, ’poetry ’, ’this ’, ’view ’, ’is supported ’, ’by work ’, ’ identified ’, ’as visual ’, ’poetry ’, ’in which ’, ’ typographic ’, ’ elements ’, ’are ’, ’ secondary ’, ’to visual ’, ’ elements ’, ’are minimal ’, ’or in some ’, ’cases ’, ’are absent ’, ’ altogether from ’, ’the work ’, ’!’, ’?’, ’!’, ’?’, ’!’, ’? ’] for i in range (50) : pos = random . randint (0 ,8) letter = let [ pos ] del let [ pos ] # print letter , f. write (" \\ put ("+ str ( random . random () ) + " , "+ str ( random . random () -1) + ") {\\ 95 tib {" + letter + " }}\ n") f. write ( ’\n \\ end { picture }\n ’) f. write ( ’\\ end { document }\n ’) 96 [ was is still visual poetry of as tends by Fluxus it is described usually important the distinctions in which with itvisual poetry or arrangement which isconcrete poetry purely the visual being composed sometimes the work art whereas referred to as concrete effect of a term between different and at one time blurs intermedia heavily influenced images and symbols visual poetry being intermedia poetry is of text in conveying and visual poetry is poetry that predates to blur work was synonymous the intended 97 Reneeom # !/ bin / bash TEXGENERATED =o/ scalefontXtimes . tex TEXTTOFILLIN =" fill this page " COUNT =10 rm $TEXGENERATED while [ $COUNT -lt 3000 ] do DEZ =‘echo 0000 $COUNT | rev | cut -c 1 -4| rev‘ SCALEFACTOR =‘echo $DEZ | cut -c 1 -2 ‘. ‘echo $DEZ | cut -c 2 -4 ‘ LINEWIDTH =. ‘expr 1000 \/ $COUNT ‘"\ linewidth " LINEWIDTH =" \\ linewidth " if [ $COUNT -eq 10 ]; then LINEWIDTH =" \\ linewidth " fi # echo "\ scalebox {" $SCALEFACTOR "}{" >> $TEXGENERATED echo " {\ scalefont {" $SCALEFACTOR "}" >> $TEXGENERATED CNT =0; while [ $CNT -lt 1 ] do echo " \\ vspace {${ COUNT } pt }" echo "\ letterspace to " $LINEWIDTH "{" echo $TEXTTOFILLIN " }} " echo " \\ vfill " >> >> >> >> $TEXGENERATED $TEXGENERATED $TEXGENERATED $TEXGENERATED CNT =‘expr $CNT + 1‘ done # echo "}" echo "\ newpage " COUNT =‘expr $COUNT + 50 ‘ >> $TEXGENERATED >> $TEXGENERATED done exit 0; 99 f i l l t h i s p a g e f i l l t h i s p a g e f i l l t h i s p a g e f i l l t h i s p a g e f i l l t h i s p a g e f i l l t h i s p a g e fill this page fill this page fill this page fill this page fill this page fill this page fill this page fill this page fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage fillthispage filtlhispage filthispage filthispage filthispage filthispage fitlhispage fitlhispage fitlhispage fitlhispage fitlhipsage fitlhipsage fitlhipsage fitlhipsage ftihlipsage ftihlipsage ftihlipsage ftihlipsage fthilipsage fthilipsage fthilpisage fthilpisage fthilpisage fthilpisage tfhilpisage tfhilpisage tfhilpisage tfhilpisage thfilpisage thfilpisage thfilpisage thfilpisage Appropriation and Type – Before and Today Ricardo Lafuente Appropriation has been a recurring and accepted strategy in defining typography as an activity and a business. We can pinpoint four cases where appropriation has been key in defining landmarks in the history of type, not only aiding the breaking of technical and creative boundaries but also helping to question legal and moral ones. A brief analysis of the current situation in typography will follow, focusing on the approach to the subject by corporations, users and designers. The current business model (digital foundries, font files with copyrights) is, as we’ll argue, a remnant of a time where a typeface filled a whole drawer and fails to account for the necessary changes that the information age demands. Finally, we’ll conclude with the definition of an essentially contradictory business model that has a very strong stance against “font forging” and copyright issues, although it has historically – and now, more than ever – thrived on constant, and often uncredited, appropriation of ideas and designs. 1 Appropriation in Type through History We could certainly identify many more instances of inspiration or downright copying of ideas in typography, but these four cases will suffice to demonstrate the different uses of copy, inspiration and appropriation in general. Our focus here will be on the issue of creative appropriation (inspiration) on one hand, and corporate business models and copyright issues (plagiarism) on the other. 2 The Gutenberg Press In 1450, Johannes Gutenberg produced the first commercially viable model of his printing press, which was widely used for centuries until the advent of the Linotype machine, the first way to automate, though only partially, the type setting and printing process. Gutenberg’s press was the result of the combination of five key methods and processes, three, possibly four, of which were not original: • The screw press, which was already used by the Greeks and Romans to process olive oil and wine. 161 • Block printing, present in China since 594 AD. Gutenberg’s innovation was to use metal cast types (instead of the Chinese traditional woodblock printing technique), although metal typecasting was already developed in Korea around 1230 AD. • Letter punches, which were a goldsmithing technique – Gutenberg was a goldsmith – used to engrave letters in metal pieces. • Letter replica casting, a method to quickly create new individual characters, along with a particular metal alloy that made for durable pieces. This method has been attributed to Gutenberg but recent studies shed doubts on this fact. • Metal-adherent ink, devised by Gutenberg. This shows that originality, in a time before copyrights and patents existed, is not a straightforward issue. It was not before 1700 that the first copyright statute appeared in Britain – the protection of ideas could have changed the fate of this invention and the combination of methods made. The point here is that they were combined in a way that made typography as we know it possible, and there seems to be absolutely no question regarding the legitimacy of this invention made possible by appropriating previous methods and processes. Gutenberg’s model of printing stood firm for centuries until the Linotype machine introduced partial automation of the printing process. 3 Stanley Morison and Monotype In 1886, the Linotype machine began to be produced by the Mergenthaler Printing Co. in the United States. This machine revolutionised the printing process by introducing a degree of automation, allowing for quick composition of lines of text. It wouldn’t take long (a year) for Lanston Monotype to begin production of their own fully automated typesetting machine, devised by Tolbert Lanston, which could typeset whole pages from a mechanical keyboard input. In 1922, Stanley Morison was appointed as typographic advisor of the Monotype Corporation (the British branch of the Philadephia company), a post he would keep until 1967. The Monotype Corporation built an extensive catalogue of cuts made by Morison from classic references, such as Bodoni, Bembo, Baskerville, and several others. These revivals helped bring general interest to the old masters” works They were also a key marketing strategy to try to push up the value of the Monotype machine – the faces available would definitely determine the decision of a buyer who fancies a particular style, and thus the Monotype Corporation had no qualms about recruiting all the classics, which were by then in the public domain. It is tremendously unfair, though, to portray Morison as a hijacker – he was one of the hallmarks of 20th century type, being responsible for the creation of the Times typeface and hugely influencing the field of typography to the present day through the efforts he dedicated to bringing the classics to the general public – legitimately appropriating other designs. Without Morison’s endeavour, our legacy would no doubt be poorer today. 162 4 Arial, Monotype and Microsoft 1982 is the year in which the Arial typeface was released by Monotype Typography, Monotype Corporation’s type design division. Designed by Robin Nicholas and Patricia Saunders, this typeface had a remarkable impact. Not only does it have obvious similarities to other modern sans serifs (sharing features with Helvetica, Univers and Akzidenz Grotesk), it exactly mirrors the glyph width tables from Helvetica, which is the data included in a font file that describes each character’s dimensions – an exact match that gives little chance of coincidence. Microsoft licensed Arial from Monotype instead of the more expensive Helvetica, and in 1990 it was bundled with Microsoft Windows 3.1. It has been a staple of Windows systems until today. This is a specific case where a typeface was chosen not for its genuine creative and/or practical value but based upon external reasons, in this case driven by financial motives. Type designers are almost unanimous in shunning Arial as a lesser typeface: it is notably absent from Robert Bringhurst’s typeface selection in The Elements of Typographic Style (the current all round reference on type design from the designer’s perspective), and is also only mentioned as a passing remark on Robin Nicholas’s entry on the typographic encyclopaedic survey by Friedl et al. 14 p.409 This is pretty much a clear indication of type designers’ consensus on the Arial issue; it’s also worth noting that there has been, to date, no attempt to replace Arial as a standard font in operating systems.1 In strict law and copyright terms, it’s appropriate to compare the Arial case to a cheating student who argues that the fact that his exam has exact passages from his nearest classmates” exams owes to coincidence. It is equally reasonable to argue that borrowing from three sources rather than just one does not make the situation more acceptable. So Arial stands in mixed principles: the type community is almost unanimous in calling shenanigans, but it has still made its way into our current operating systems despite that fact – it didn’t face any legal actions as of 2008. 5 Segoe In early 2006, Microsoft announced a significant effort to dignify type design in their upcoming Vista operating system: six type designers – Lucas de Groot and Robin Nicholas figuring among them – were commissioned to design appropriate typefaces for screen and print. The result was six very attractive fonts that not only could appeal to general uses by less savvy people for simple word processing tasks, but also suit the type designers” fancy. Another font included in Vista is Segoe, a revival of Frutiger Next (which in turn is a revival of Frutiger) that Microsoft licensed from Monotype and altered. It’s not the first case in which Adrian Frutiger’s work has been remade, Adobe’s Arial is now a ‘ standard” font of web typography, being part of a very limited set of fonts that most browsers can read. 163 Myriad and Apple’s Podium Sans also bear a striking resemblance to Frutiger’s structure. When Microsoft registered Segoe in Europe in 2004, Linotype sued for copyright infringement since European law, unlike the American one, recognises the rights to font designs (although patent law is often used to circumvent this legal void in the U.S.). The most significant fact is that Microsoft based their defence not on the issue of originality – stating the differences between Segoe and Frutiger Next, but on the fact that Linotype wasn’t selling its typeface in Europe when the request was filed. This situation could very well be interpreted as an admission by Microsoft’s part that the font in fact owes credit to Frutiger’s design. This case becomes all more revealing in that it is both a high profile and current example of an attempt to settle the authenticity of a type design in courts. Unlike Arial, it didn’t sneak past the critics and found serious hurdles while Microsoft tried to implement it in its Windows OS. The EU ended up rejecting Segoe’s application, prompting the release of a modified version that bore less resemblance to the Frutiger typeface. The plaintiff, Linotype, was acquired by Monotype Imaging – the designers of Segoe – in 2006. 6 The Digital Typography Paradigm Typography, and type design in particular, is historically defined by a constant recursion of past themes and trends, be it as inspiration, revivals, or as a way to question them – as in postmodern type examples, such as Emigre’s or David Carson’s work. Nevertheless, modern designs still owe heavily (with or without credit) to a tradition of arts and crafts spanning five centuries. Meanwhile, during the last two decades, the type world hasn’t ceased discussing the issue of rights and plagiarism, a discussion that was sparked by the digital revolution and the introduction of the personal computer as an all purpose design and production tool. This shift implied that the tools used in typography and book production ceased to be the sole domain of type makers, printers and book publishers – the only ones who could afford the initial investment of a type foundry, workshop or printing press and manage it effectively. Designing type soon became cheaper and cheaper, as the physical and financial burden of the new tools gradually became less and less significant. Nowadays, a computer and a printer can do in minutes what a huge phototypesetting equipment would have taken a lot of time, effort and money to produce ten years ago. The key effect of the digital revolution in type design is that typefaces became fonts – a radical change in that they were no more lead blocks but data – files that describe how each glyph should be drawn on screen or on a printer. A free software solution to type design, FontForge, was released in 2004, doing away with any software costs involved in font creation and editing, meaning the only overhead for a type design business would be a PC, paper, drawing tools, an image capture device (scanner or camera) and eventually an internet connection. This change has serious repercussions in the whole typography market: now type design wouldn’t, in theory, require any kind of intermediaries between the typographer/designer and its audience. Reality developed otherwise, as we will see from three standpoints in typography usage and creation. 164 7 Corporate Type The digital revolution made a deep redefinition of most areas of study possible. We will show, though, that the field of typography has been lagging behind when it comes to taking advantage of the digital medium. Moreover, the corporate business model has failed to account for the specific needs and features of information technology, sticking to an artificial market sustained by an inflated value attributed to digital files as if they still were physical objects that are owned. Nowadays, there are three major players in the type business: Microsoft, Adobe and Monotype Imaging. Apple Computer hasn’t been a key figure in the type market (concentrating on developing font technology for its operating system), but it had an essential role in developing the actual playing field. Apple heralded the personal computer era in with their original Macintosh and has intermittently collaborated and competed with Microsoft and Adobe, being responsible for the development of the TrueType font format along with Microsoft as a response to Adobe’s expensively priced PostScript Type I font description format. The release of TrueType in 1991 forced Adobe to gradually reduce prices and eventually follow suit, releasing the PostScript specifications so that software developers could implement it in their programs without limitations. Adobe Systems Inc., besides being responsible for a highly successful suite of imaging and DTP software, has a very strong position in the type market: not only is it a type vendor (through its typography division, Adobe Type) but also the most influential company in the sense that it owns most digital design solutions, especially after acquiring its main rival Macromedia in April 2005 and facing no significant competition in its market. Microsoft is responsible for creating the most widely used operating system in personal computers, as well as the most popular office suite. Along with Adobe, Microsoft developed the currently dominant OpenType file format, which is freely available to developers as long as they agree to its rather restrictive licensing terms. Adobe converted its entire type collection to OpenType in a move to spread the new standard. Monotype Imaging is now a distant remnant of Tolbert Lanston’s original creation. It has adjusted technical breakthroughs in the 20th century and claimed a staunch position in today’s digital type market. It was acquired by Agfa in 1999 forming Agfa Monotype, which in turn was acquired by T. A. Associates, a North American investment firm, changing its name to Monotype Imaging and developing a position in font software and rendering engines. It also secured a strong standpoint in the font vendor market after acquiring its rival Linotype, along with the rights to their entire type collection. 8 User Type Most people get introduced to digital type by means of text editors. The digital revolution would be the perfect reason to finally open typography to everyone and make it a mainstream subject instead of a limited access craft. Things have 165 happened otherwise, though, and the inability to create a suitable interface for allowing basic experimentation with type has severely crippled the possibilities of the new medium. The font selection paradigm has changed little during the years, offering a whole collection of typefaces in a drop down menu. Such is the immediateness of digital type: It’s just there, no need to open drawers with thousands of lead characters. Users are encouraged, by means of a simple GUI, to just pick their font and get to work on their document. Even more: you don’t even need to choose, just stick with the default choice the software maker has made for you. Word processing interfaces also assume the user doesn’t want to be bothered with layout choices such as margins, structure – and they also make the choice for us (incidentally, they also made it quite awkward to change these defaults). In short: the standard word processing interface tells users not bother to with type. This paradigm helps to build the general perception that a font is a finished, shrinkwrapped and untouchable product – pretty much like pre-packaged software. Although font files can be opened and edited as long as we have an appropriate editor, most typeface editors are either crude or catering exclusively to the type designer market. The user usually isn’t able to reach the underpinnings and intricacies of type, instead being expected just to understand that the default template is more than enough. Such an approach to software designing effectively discourages any kind of interest in typographic issues by the general public, and helps to fuel the thought that fonts are “just there”. It’s worth noting that there is still no easy and streamlined way to buy, install and use fonts, unlike most other digital markets – iTunes would be a good example of that kind of market strategy. There’s an obvious reluctance to develop alternative business models for type design. 9 Designer Type The type designer community is centred on the study of classical and modern examples and making attempts to postulate theory and practical guidelines for the craft of type design, sitting somewhere between the methods of architecture and those of poetry. Fred Smeijers, a highly regarded Dutch type designer, analyses the type designer’s duty quite straightforwardly in his manifesto Type Now. On the issue of the responsibilities of type designers and commitment to specific guidelines, he states that a type designer cannot escape this responsibility of judgement (...). In the end, people – the society – either accept it or they don’t 15 p.25 Society, it seems, would be the ultimate judge of whether a typeface is a hallmark of craft or doomed to failure. On the other hand, we find a curious account on Smeijers’s description on Fontana, a typeface by Ruben Fontana inspired by Meta: he describes it as “uncomplicated”, “tres sympathique”, “sunny” and “open minded”. 15 p.40 This certainly sounds more like a description of a person or a song than of an object, 166 and indeed sheds some doubt on the much touted objectiveness of good type design. It seems impossible to find serious and objective terms to classify a typeface’s features. Historical categorisations of design tendencies vary from author to author, and although there are some widely used terms to describe historical periods and typeface features, such as “transitional type” or “slab serifs”, there’s a tendency to borrow from poetry and music to identify a type family’s “soul” (which, though relevant from an artist or a historical point of view, is rather unscientific). This is not a contradiction, though, since we can distinguish between type as a creative activity (in which there would be no problem with this kind of analogy) and type as an industry and commodity (where profit, market tendency, shareholder demands and legal requirements imply that things have a definite value and purpose). Naturally, Smeijers’s interest is in the craft and art of typography, and not the market and the economic relationships that it spawns. On the other hand, our interest is definitely that which Smeijers doesn’t care for. We must assert that defending the status of type as a functional solution to practical problems requires an objective set of rules that derive from the way we read and write. We cannot yet account for matters of objective legibility while we do not possess all information on our mental processes and the mechanisms in the brain involved in acquiring and processing written information – this is the responsibility of cognitive psychology and neuroscience. We know, from history, that a text with generous line spacing will certainly read better than other with no line spacing at all. The German blackletter used by Gutenberg in his Bible, however, is almost unreadable to a contemporary westerner’s eyes and definitely alien to someone from a non-Western background. In the fifteenth century, though, it was certainly the norm. History can help to avoid repeating our mistakes, but it also shows the relative importance of our current standards. In short, we still cannot objectively define type, and won’t be able to before a major breakthrough in neural science. However, copyright issues and legal matters impose formal specifications on what a font is and what it is not. Whether a typeface is a tweak, a revival or a work of art is left to the courts. 10 Tweaking and Reviving In order to explain the type designer’s first reluctance to embrace the digital alternative, and also to understand how design processes are not as straightforward as they are presented to us, we’ll concentrate on Fred Smeijers’s account on the current state of events in typography. Specifically, we’ll borrow his term font tweaking. 15 p.32 This process consists of loading a font, “tweaking” it – altering small details – and releasing it with different names, thereby circumventing copyright laws, since U.S. Law protects font names as trademarks, but not font designs. Smeijers is clear in pointing that font tweakers have nothing to do with type design at all, reinforcing the distinction between doing type as a labour of love and doing it for a profit. Font revivals, on the other hand, are reinterpretations of existing designs, and our best example would be Morison’s effort in bringing the classical designs into the Monotype type library. Revivals matter to us because they aren’t original 167 productions (as they draw inspiration from existing designs) but aren’t copies either (because no rights over them could be warranted otherwise, since there would be no original idea). Digital type foundries and vendors still maintain the tradition, digitising and redoing the old masters” work. It’s worth noting that even if a certain typeface, such as those with expired copyrights, resides in the public domain, anyone can make a digital version – a revival – and claim the rights to it. Digital type catalogues are rife with revivals: In Bringhurst’s inventory of digital foundries, we can find 14 that issue revivals, and 4 that only release original designs. 16 p.309 This interest in resuscitating previous designs also has motives that stand apart from simple typographic archaeology. Revivals are routinely issued by vendors and foundries to protect the rights of the rights holder when a typeface’s copyright is about to expire. Such is the case with Avenir LT, Adobe Garamond and Frutiger Next – which is what allowed Linotype to retain the rights to the original design and be able to sue Microsoft in the Segoe case. Revivals reside in a kind of legal no man’s land – some, like Arial (which is more a tweak than a declared revival), manage to stick around while others, like Segoe, raise copyright lawyers” eyebrows. Given these two aspects, one cannot but wonder that a type designer wouldn’t be thrilled with this perspective. One has also to question why there is such a rift in reactions between font tweaking and font revivals, which can be interpreted as no more than corporate font tweaking. A practical example of this is MyFonts.com’s description of the Avenir LT font (link, down the page) – a “recut version of Avenir”, stating that “The “LT” was added to the name as the metrics differ from the original version”. This definitely corresponds to Smeijers” description of font tweaking, despite the fact that the name change wasn’t intended to avoid legal troubles, but to assert the brand of the author of the revival. What is a revival, then, other than a corporate sanctioned font tweak? 11 Free software and Type Design So far, we’ve kept our focus on corporate approaches to type design. As of 2008, the digital design tools field is dominated by Adobe Systems Inc. with its Creative Suite bundle of applications targeting photo, video, vector and sound editing. Adding to that the fact that Adobe software is the staple in most design courses in Europe and the United States, it can be stated that we are, indeed, faced with stifled possibilities when choosing digital creative tools, a monoculture of sorts. Although there have been parallel efforts from the free software and open source world to create alternatives, Adobe’s sole dominance in this market remains unquestioned. Going back to type design, we could point Donald Knuth’s TEX and METAFONT as the best examples of an alternative approach to designing type on computers. Having come from the UNIX crowd, and hailed as one of its most highly regarded representatives, Donald E. Knuth reflected this background in his efforts to create a simple system for dynamic typesetting. TEX was first released in 1989, with several new versions being introduced during the ’90; its most recent 168 update was released on 2002. It is still very popular among the academic and scientist audience for typesetting papers, since TEX excels at accurately setting and displaying mathematical formulae and including them in book layouts. For an Adobe software user, TEX will definitely look alien, not least because of its lack of a graphical user interface, instead relying on command line input for operating. Instead of the mainstream point and click, drag and drop way of laying out and manipulating text and image boxes, TEX is meant for processing specifically crafted plaintext files, in turn outputting a printer-ready, typeset document. While requiring a rather steep learning curve, TEX introduced a model of digital typesetting that would be mostly put aside by the software houses that produced GUI page layout editors. METAFONT was designed to be the font handling backend for TEX . It is based on a modular method of generating letterforms, based on instructions fed to the METAFONT processor, which outputs valid font files for use in TEX documents. Computer Modern, the hallmark font of TEX , was created by Knuth using METAFONT, and sports variable parameter such as stroke thickness, serif dimensions and shape contrast. Thus, by tweaking the parameters, one could create endless variations on letterforms, treating them as data to be manipulated, in contrast with the commercial model of fonts as unique authored pieces. Due to its lack of a GUI – an absence that a seasoned hacker would see as a good feature – TEX and METAFONT presented little appeal for business opportunities. As such, these two programs remain largely unknown to the noncomputer scientist audience since, among other reasons, you won’t easily find a book introducing TEX as you would a book on Adobe InDesign. Still, the METAFONT model can be the foundation of a new model of regarding typography and type design. Because of its simple input/output architecture, it is only missing a proper interface for easy operation, along with compatibility with existing formats. Other projects, such as MetaType1 or LiveType – not the Apple product, but a parametric approach to typeface construction, presented in 1997 at SIGGRAPH – show that a modular, open-ended approach to fonts is possible and has definite advantages over the manual creation process that’s the norm in applications such as Fontographer, FontLab or its comprehensive free software alternative, Fontforge. 12 Technology on Arcane Standards The current terminology used in typography is also a clear signal of how it still depends on former traditions instead of adapting to its new medium. Digital typography’s rules and terminology have been determined by its physical counterparts, and that still hasn’t changed. For example, we still talk about “leading” – a term for the spacing between lines that takes its name from the lead strips used for that purpose – although the term “line spacing” is gradually replacing it in user oriented applications such as Microsoft Word. Another example – while type foundries got that name because of their heavy use of metal, single person studios with Macs are still referred to as “foundries”. And fonts are described as being “cut” or “cast”, more than “digitised”. We talk about “digital versions” instead of digital copies, perhaps to preserve their history 169 and soul and not treat them as just another file in a user’s computer. Although we can forgive this persistence in using traditional typesetting terms, it also is a symptom that the type activity and business have failed to redefine themselves for the digital medium. On the other hand, these examples can actually be interpreted as quite an artificial and linguistic way to value the work of the typographer, probably with the aim of distinguishing between “true” type designers and mere font tweakers, and not let “true” typography be contaminated by the creeping tweaker threat. 13 What Now? Given that digital type has been hanging around for thirty years, the progress in improving on font technology and taking advantage of the digital medium has been rather low. On the other hand, type designers in general (with the exception of rare cases such as Emigre or Letterror) have not tried to get to grips with font technology, rather limiting themselves to drawing and tracing their designs in Fontographer and selling them on major font vendors (MyFonts, Monotype) or independent ones (such as T26 and Veer). Worse still, issues of originality and plagiarism have been discussed in type design circles, but corporate entities break them routinely while trying, at the same time, to assert their rights in courts. The difference between major and minor vendors is not substantial: though distributors like Veer try to create a community and improve on the users” and designers” experience through research, designer spotlights and support. Despite these efforts, digital typefaces are still regarded in an esoteric limbo between metal characters and abstract data. And though the price tags have steadily declined (and recently stabilised around the 20 dollar range in general), it is revealing that despite business models such as iTunes or Flickr, collaborative methods in producing typefaces (many typographers are still lone workers) haven’t yet developed, and file formats have changed so little in the face of recent, sleeker solutions like XML and SVG. There’s little hope for innovation: the AdobeMacromedia and Monotype-Linotype mergers have paved the ground for a corporate monoculture ruled by software and typeface vendors and distributors, with very little margin for competition. We can also point a mutual apathy between commercial developers and designers as a possible reason – type designers try to adapt to outdated ways – file formats and type tools – to create their works, while developers lag in keeping up to date to new breakthroughs. Limiting the tools is limiting the imagination. On the other hand, font vendors have an incredibly contradictory stance regarding font rights, using copyright law to protect their products while violating it to borrow from others”. The different fate of Arial and Segoe begs the question: are the vendors and distributors handling this as it should be handled? This model’s obvious contradictions definitely invite serious questioning as to the legitimacy and validity of the current type market and business model, which cannot effectively release its standards and technology because of the threat of competition. It is therefore left to users, designers and independent developers to shape a new way of defining type and creating effective communication channels between providers and users, be it through online communities or real world 170 discussion in type designer’s circles and colleges. If type design takes the free/open source route – and the wheels are already in motion – how can type vendors sustain their profit margins and their markets? With open fonts and free font editing software around, there would be little doubt that typography can take a very interesting turn. Could we also see the open approach and the business approach coexist, catering to specific users’ needs, whether amateur or professional? And, finally, will the type world come to terms with the fact that appropriation and use of other’s ideas have defined the activity since its beginnings, and that it implies a serious rethinking of concepts such as authorship, plagiarism and author’s rights? 171 The METAFONT Tutorial Christophe Grandsire 1 preface METAFONT is the dark but indispensable brother of TEX , the well known typesetting program written by Donald E. Knuth. Where TEX (most often through its son LATEX ) works in the light, putting your words together in beautifully typeset documents, fully justified, with automatically generated tables of contents (and so many other features), METAFONT works in the shadows, doing the dirty work of generating the fonts your documents are typeset with, and without which you wouldn’t get anything but empty pages. But METAFONT is much more than a blue-collar worker under the orders of Manager TEX ! It is a true programming language, as much as TEX and LATEX (and even more so!), devoted to the generation of entire families of fonts using a single program and judiciously chosen sets of parameters. Uh-oh! I already see the questioning looks in the audience, everyone is wondering what the heck I am talking about! ^ đ OK, so let’s go back to the beginning. Once upon a time (read: in the late 1970s), there was a High Mage at the Stanford School of White Magic (read: a Professor of Computer Science at Stanford University) named Donald Ervin participants/reneeom/scalefontXtimes.shKnuth (read: Donald Ervin participants/reneeom/scalefontXtimes.shKnuth). This High Mage was revising the second volume of his Book of White Magic Spells (read: the second volume of his multivolume opus The Art of Computer Programming). He had received the galleys, made using the new magical-aided scribes (read: the new computer typesetting system) and was so horrified by the result that he immediately cast a Fire Spell on them, reducing them to ashes (read: he was not happy by the result). The quality was far lower that of the first edition of this second volume. Being himself a High Mage, he thought that he ought to be able to do better than that. So he set out to learn as much as possible about the Art of Scribes (read: the rules of typesetting and good typography) and, because he could find no scribe whose style was good enough for writing the Hermetic symbols he used daily (read: he couldn’t find symbol fonts with the characters he needed), as much as he could about the Art of Calligraphy (read: type design). He figured that it would take about six months. It eventually took more than ten years, and the help of plenty of other mages and wizards who had suffered from the same problem and saw the High Mage participants/reneeom/scalefontXtimes.shKnuth as their Saviour (read: they were too lazy to begin the 173 work by themselves and figured that it would be easier to help someone who had already begun the job than do it all by themselves). But at the end of those ten years, our High Mage had in his power the two best White Magic Spells ever created (read: the two best programs ever written): TEX and METAFONT. TEX was the Scribe Spell, able to put together words and symbols on the parchment, in Good Position and Alignment (read: TEX is the high-quality typesetting program). METAFONT was the Calligrapher Spell, able to create the wonderful Hermetic shapes that TEX would align together, according to the best Rules of the Art of Calligraphy (read: METAFONT is the high-quality type designer program). And because our High Mage was of Good Alignment (read: he made enough money from his books already that he didn’t have to make any more with those programs), he released those spells and their components for free for anyone to use and enhance (with a minimum of control, of course)! In a world where Spells had mostly been proprietary and expensive, this was a revolution which ensured a mass following, making eventually TEX (and its companion spell LATEX , later created by the Wizard Leslie participants/reneeom/scalefontXtimes.shLamport to simplify the use of the basic TEX Spell and release its true power) the spell used by the majority of Mages around the world for the writing of their Books. The METAFONT Spell, on the other hand, wasn’t as successful. Lacking helping spells like the ones that grew around the TEX Spell, it was commonly seen as too Hermetic to be mastered, and thus was confined to a helping role, being cast indirectly through the TEX Spell when needed to produce beautiful Calligraphy. Now, I hope this fairy tale has helped you understand the situation. ^ đ METAFONT is a type designer system whose power is wasted by being used only as a helper program for TEX and LATEX . Being seen as too complicated for the common user, it has been ignored by most type-designers, whether amateurs or professional, despite having proved its qualities by its use by participants/reneeom/scalefontXtimes.shKnuth to create the Computer Modern font family, recognised as one of the best for typesetting mathematical and scientific documents. This tutorial is intended as a first step to correct this situation, by showing that METAFONT is actually nothing to be scared of, and that it is actually an easy-to-learn programming language, usable by anyone with a basic computer knowledge to create high-quality fonts. After following this tutorial, anyone with originally no knowledge of font design will be able to create simple fonts that they will be able to include in their TEX documents, but also in any type of documents they want, provided that a little more work is put into converting the fonts in a format usable by other programs. This tutorial is organised into lessons. Each lesson is divided into “descriptive” and “imperative” parts. The “descriptive” parts are the meat of the lessons, they introduce and describe the commands and features you need to learn to use METAFONT. The “imperative” parts appear generally in the form of exercises, which involve solving problems using the commands and features you’ve been introduced to. Since this is not an official course, and that no diploma will sanction it (although we can always dream, can’t we? ^ ¨ ), the solutions to those exercises are available in Appendix ??. You are of course allowed to look at them whenever you want, but for the exercises to have any use, you are encouraged to 174 try the exercises a while before checking the solutions, and to check them at the very last resort, when even after a good night of sleep and re-reading the lesson you are unable to find a working solution. You can of course also check the solutions even if you have a working solution yourself, if only to check whether your solution is different from the author’s. In order to prevent you from looking too fast at the solutions, the exercises are not hyperlinked to their solutions (the solutions, on the other hand, are hyperlinked to their respective exercises). At first, you’ll probably have the impression that the lessons are pretty heavy and long. This is done on purpose and reflects the nature of the METAFONT programming language. For this reason, you needn’t complete one lesson per day. Take your time, and don’t hesitate to spend a few days on each lesson. Don’t jump to the next lesson if you haven’t mastered completely the present one. Finally, I’m talking here to fellow METAFONT experts. Don’t jump at my throat if this tutorial introduces small lies and oversimplifications. The approach here is the same as the one taken by Donald E. participants/reneeom/scalefontXtimes.shKnuth in The METAFONTbook, page viii: When certain concepts of METAFONT are introduced informally, general rules will be stated; afterwards you will find that the rules aren’t strictly true. In general, the later chapters contain more reliable information than the earlier ones do. The author feels that this technique of deliberate lying will actually make it easier for you to learn the ideas. Once you understand a simple but false rule, it will not be hard to supplement that rule with its exceptions. A final word before I let you all begin to read the lessons in this tutorial: enjoy! Despite the rather mathematical approach METAFONT takes for font design, it is actually fun to create fonts with METAFONT! 2 Copyright Notice Copyright © 2003–2004 Christophe Grandsire1 and all the Contributors to The METAFONTtutorial. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no FrontCover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”. 3 Thank you! Some of the material from Lesson (including the example) comes from the first two chapters of the METAFONT – guide pratique,2 by Bernard participants/re- mailto:[email protected] http://www.vuibert.com/livre515.html 175 neeom/scalefontXtimes.shDesgraupes, which are available online here.3 Other material that helped me write this tutorial can be found here4 and here5 (two different “here”s ^ đ ). And of course the main source of information I used for this tutorial is The METAFONTbook6 by Donald E. participants/reneeom/scalefontXtimes.shKnuth, the METAFONT bible from the very creator of METAFONT. I would also like to thank all the members of the (La)TeX/METAFONT-forConlangers7 mailing list for their support and especially for their patience (Sorry to have kept you waiting for so long!). I couldn’t have written this tutorial without them. Naturally, all mistakes in this document are mine. If you ever find anything correct, it must have been one of them dropping me a line. 4 Changes v. 0.33 Corrected the bug that prevented some solutions to be linked to their correct respective exercises. v. 0.32 Changed the license to the GFDL and added it as an appendix. v. 0.31 Slight changes in the description of the pk files and in the example in Lesson ; some more corrections. v. 0.3 Addition of Lesson . v. 0.2 Even more corrections; change of the incorrect reference to RiscOS as an unsupported operating system to a reference to TOPS-20, a truly unsupported operating system; modification of some internal references; addition of Lesson . v. 0.12 More corrections of style (again thanks to Tristan participants/reneeom/s- calefontXtimes.shMcLeay); change of the style of the smilies; modifications of the code to make it more robust; addition of Vim as text editor with METAFONT syntax highlighting as default, and addition of links to the sites of Vim and Emacs. v. 0.11 Various corrections of style and contents (thanks to Tristan participants/re- neeom/scalefontXtimes.shMcLeay); addition of a note about the new Adobe Reader 6.0; addition of a “Changes” page. v. 0.1 First appearance of The METAFONTtutorial. http://www.vuibert.com/DOC/24-metafont_chap12.pdf http://cgm.cs.mcgill.ca/∼luc/metafont.html http://tex.loria.fr/english/fontes.html http://www.amazon.com/exec/obidos/tg/detail/-/0201134446/103-1864765-6700651 http://groups.yahoo.com/group/latex-for-conlangers/ 176 The Name of the Game So, here it is, the very first lesson of The METAFONTtutorial. As its numbering indicates, this is quite a special lesson, which lays the foundations for the rest by explaining the nasty little technical details like what METAFONT actually is and what you actually need to be able to use it. As such, it needs a basic knowledge of computers. But don’t worry, when I say basic, I mean really basic. If you know what a file, a program, a folder (also called directory) are, as well as what an operating system is and which one you have on your computer, then you know enough (knowledge of what it is to download something from the Internet and of how to install programs on your platform is a plus ^ ¨ ). The rest will be explained here. If you don’t know what those things are, then you first need to buy a computer, and how the heck have you managed to come here in the first place?! ^ ¨ Seriously, although you needn’t be a rocket scientist to understand this tutorial, computer font design stays a specialised subject, and while this tutorial is meant to bring METAFONT to the masses, you still need to understand a bit about computers to fully appreciate its capacities. So, now you’re warned, so let’s wait no longer and begin to work! 1 What does METAFONT mean? I think the best way to understand what METAFONT is about is by understanding what its name means. So let’s do a bit of etymology (not much, don’t worry đ ). ^ Let’s begin with the end, and we see that in METAFONT, there is FONT. What a font is is a more difficult question than it seems at first. If you check this online glossary,1 you’ll see a lot of terms that look very familiar and yet have different definitions from what you’re used to. But since you’re interested in font design (otherwise why are you reading this? ^ ¨ ), you probably know already some of this special vocabulary, don’t you? So let’s simply say that a font is a collection of characters of similar “style”, or rather typeface in typographer’s speech. Or rather, a font is a particular realisation of a certain typeface (in a physical—wood, lead, alloy—or electronic—a computer file usually simply called a “font”—medium), according to some parameters such as size, width, weight (normal and bold are two examples of weight), contrast (the difference between the thin parts and the thick parts of characters), style (normal, italic, monospace or typewriter etc.) and the presence or absence of serifs (those little http://nwalsh.com/comp.fonts/FAQ/cf_18.htm 177 decorative strokes that cross the ends of the main character strokes) and their shapes. But you are not limited to this list and can make up your own parameters too. And that’s where the META- part comes in. “Meta-” is a prefix of Greek origin which originally meant simply “after”, but due to a strange turn of events (read about it here2 ) came to mean “of a higher order, beyond” in Latin and later in all modern languages (except Greek where it kept its original meaning). So you have metalanguages (languages used to describe languages), metahistory (the study of how people view and study history), metatheorems (theorems about theorems), metarules (rules about rules) etc. Indeed, you can “meta-” about anything, making it quite a hype. ^ đ But there is one other place where “meta-” is actually useful, and that’s font design. Conventional font design means that for each value of the parameters I’ve listed before (and all the parameters that you can invent yourself), you have to separately design a full font (i.e. a few hundred characters), and that just for one typeface (the existence of scalable fonts, i.e. fonts which can be used at any size, helps a little by taking care of the parameter “size”, but that’s only one out of a lot of parameters). Even with the help of modern tools like font design programs, this is a tedious and boring job. It would be so much nicer to do meta-design instead, i.e. design that is independent of the parameter values. Instead of designing a font for each and every combination of parameter values, you would describe a typeface once, and by entering separately a list of parameters, let the computer automatically create all the fonts you need with all the combinations of parameters you want, and if you forget one combination, instead of having to redesign the whole font again, you’d just have to change some parameters and let the computer do the tedious job again. This way would spare you a lot of work, and would ensure the unity of looks of each of your typefaces, since you would describe them only once. And yes, as you must have guessed by now, METAFONT is exactly about font meta-design. METAFONT is a system that allows you to describe a typeface once, and create as many fonts as you like of this typeface by just changing a set of well chosen parameters separately. How it is done is explained in the next section. 2 How does METAFONT work? So METAFONT is a system that allows you to create hundreds of related fonts easily and with a minimum (which can be quite a lot nonetheless) of work from the human creator. How does this work? Well, it may surprise you, but METAFONT is actually a single command-line application (called mf on most platforms, and mf.exe on Windows platforms). In short, it has no graphical interface (no fancy windows and such!). It must be called from a command line or by a helper program. So, how can you create fonts with such a program if you cannot draw figures and such? Simple: this program is an interpreter. It takes a series http://lists.tunes.org/archives/review/2000-April/000062.html 178 of instructions as input, and executes them one at a time, as it receives them. In other words, METAFONT is also a programming language, like C, BASIC, Pascal (in which the source of METAFONT was originally written), Perl, and of course TEX . So, how do you enter your programs so that mf can interpret them? Well, there are various ways, but the most common is to make a file containing your instructions, and to give the file’s name to mf. The file itself must be plain text, and must have the extension .mf. mf will then read this file and give back (if everything’s okay) two other files with the same name but different extensions (the process is called compilation). One file will have the extension .tfm. It’s called the font metrics file. It contains information like the size of the characters. The second file will have an extension of the form .<number>gf where <number> is a certain value with usually three figures. It contains the actual shapes of the characters (or glyphs, as they are usually called). Both files form the font, and both are necessary to have a working font. So, is that it? Well, it would be too simple if it was. ^ ¨ For historical reasons, the gf file is not the one which is actually used. You need first to transform it into a smaller file, containing the same information but in a packed way. You do it with a second program called GFtoPK (GFtoPK.exe on Windows platforms of course), and the resulting file has the same name as the original one, except that its extension has become .<number>pk (with the same number as the gf file3 ). The pk and tfm files form the actual font, and the last thing you have to do is to put them in a place where they will be recognised by TEX and LATEX . Once done, you can happily use your fonts in LATEX . Does it look complicated? Well, like many things, it’s actually more complicated to explain than to do. And don’t worry if you don’t understand yet, the method will be repeated at various times in the course of this tutorial, and you will quickly get the hang of it. For now, here is a summary of the method: 1. Write one (or more) plain text file containing METAFONT instructions (a METAFONT program thus) and save it (or them) with a .mf extension. 2. Call mf on this file. The result will be two files, ending respectively in .tfm and .<number>gf. 3. Pack the gf file by calling GFtoPK on it. You will get another file ending in .<number>pk or .pk. 4. Move your tfm and pk files to some place where they can be recognised by TEX and LATEX . 5. Enjoy! On some platforms, like Windows, the actual extension of the pk files must be .pk, without number. You need to check the pk files already installed on your computer to find out which style you must adopt for your own files. 179 3 What do I need? Well, I hear you saying now: “Well, that’s very nice, but how do I get those programs in the first place?” Look no further, all the answers you need are here. ^ ¨ But before looking for where you can get the programs you need and how to set them up, let’s list what you need first: • A computer, with some operating system on. OK, this may sound so obvious that it is painful, but the point here is that almost any computer will do. LATEX and METAFONT have been ported to probably all the platforms that are still in use today, including those that are not supported anymore (like TOPS-20, a cousin of the WAITS operating system on which TEX was originally developed). Those ports are more or less up-to-date, but since TEX and METAFONT’s developments have been stopped (the versions existing today are final, except for the possible correction of a bug once in a while—an extremely rare event, those two programs are nearly completely bug-free), you will probably never experience the difference, and your source files will compile in exactly the same way with exactly the same results on every platform where METAFONT is installed. • A plain text editor. It’s the simplest kind of text editor there is, and normally all platforms come with at least one included (like Notepad for Windows and vi for Unix). But nothing prevents you from using a fancier editor with syntax-highlighting and project-tracking if you feel like it! ^ ¨ • a LATEX distribution. Why LATEX if we’re interested in METAFONT? Well, as I already said in the preface of this tutorial, TEX (and thus LATEX ) and METAFONT are essential to each other. TEX cannot work without METAFONT, and METAFONT is useless without TEX . So METAFONT comes in full glory with every LATEX distribution and installing a LATEX distribution will automatically install METAFONT on your computer. Other needed programs like GFtoPK and GFtoDVI (necessary to make proofsheets of your fonts) are also part of any LATEX distribution and will be installed along with it. • This tutorial! Otherwise you’ll have difficulties trying to learn the METAFONT language by yourself. ^ ¨ As you see, the only thing you really need to get METAFONT up and going is a LATEX distribution. So let’s see where you can get one suited for your platform.4 Many platforms are still missing from this list. If you know how to install LATEX and METAFONT on a platform not yet listed, I would be glad if you could send the information at [email protected], so that I can update the list. Of course, the information will be properly attributed to you in this tutorial. 180 1 Unix and clones If you have a Unix platform of any flavour (Linux, Sun Solaris, BSD etc.), there’s a big chance that you already have a full LATEX distribution installed, and a big chance that this distribution is te TEX . In such a case, you have nothing special to do and can safely skip this section. If you are unlucky enough not to have LATEX already on your computer, then you must install it yourself, and of course I advise you to install te TEX , as it’s the most up-to-date and easy-to-install distribution for Unix systems. You can download it at the te TEX Homepage.5 But before running there, I also advise you to check whether your particular Unix flavour has some specific system or LATEX distribution tailored to its specificities. This will probably save you some work (for instance, in Debian GNU/Linux and other “apt-enabled distributions”, the simple command “apt-get install tetex-base” will do all the work of downloading and installing te TEX for you). And if you want a text editor with syntax-highlighting for METAFONT, no problem: both Vim6 and Emacs7 have a METAFONT mode in their standard releases. 2 Windows Windows doesn’t come with any LATEX distribution, so you have to download and install one yourself. The best one is without any doubt MiK TEX , available for free at http://www.miktex.org/ for all Windows versions (except Windows 3.1 and NT versions under 4.0). It includes a Package Manager and an Update Wizard which allow you to easily manage and update your LATEX distribution with a graphical interface. And since Windows users are usually rather uneasy with the command-line (the MS-DOS), I also advise two other free programs which will provide you with a good graphical interface for LATEX and METAFONT. The first one is Winshell,8 a text editor specialised for LATEX , which is made to work automatically with MiK TEX , so that you only have to download and install it and you can immediately work with it. It’s simply a text editor which allows you to write your TEX sources (with syntaxhighlighting) and compile them with a click of the mouse, so that you needn’t use the command-line anymore. The second one is the Crimson Editor,9 a customisable programmer’s editor. I advise it because it is easy to configure it to run command-line programs, and also because I wrote syntax highlighter files for it. You can get the custom highlighter files as well as instructions on how to customise the Crimson Editor for use with METAFONT in Appendix ??. http://www.tug.org/teTeX/ http://www.vim.org/ http://www.gnu.org/software/emacs/emacs.html http://www.winshell.de/ http://www.crimsoneditor.com/ 181 3 Macintosh If your operating system happens to be Mac OS X, then it’s your lucky day! Since Mac OS X is based on the BSD flavour of Unix, porting Unix software is easy and a lot of free software is available for Mac OS X this way. This includes TEX , and the te TEX distribution is available for Mac OS X through the iInstaller10 or the fink11 package management tools. To use it, it seems a frontend is necessary, and my research pointed out i TEX Mac12 , which seems to be a very good front-end for the te TEX distribution. However, I am not a Mac user, and have never seen Mac OS X in function, so I cannot really tell if the good reviews I’ve read about i TEX Mac are well-deserved or not. If you know more than me, I’d be very happy to have your opinion! If on the other hand the operating system on your Macintosh is an older version of Mac OS, then I am probably going to disappoint you, but there seems to be no free Mac implementation of TEX for non-X Mac. Good implementations seem to be CMac TEX 13 and Oz TEX ,14 but they are both shareware (CMac TEX costs $35, Oz TEX $30, both for single user licences). They both come with their own front-ends (basically replacing the command-line programs with menu commands), but you still need a text editor to write your sources. More information is available at http://www.esm.psu.edu/mac-tex/default9.html. Note also that those distributions have their little quirks. For instance, in the implementation of METAFONT for Oz TEX , called OzMF, the actual fontmaking command is not called mf but Make TEX PK. 4 Other programs The lists I’ve given here are only for a basic installation of TEX / LATEX and METAFONT. Depending on your platform, you may need some other program (like a Postscript viewer and/or a PDF viewer of some kind). But since those concern strictly TEX and LATEX and not METAFONT, instead of explaining everything here, I simply advise you to read completely the links I’ve provided. Each implementation’s webpage usually explains very well what additional programs you may need to enjoy the full power of LATEX .15 http://www.rna.nl/ii.html http://fink.sourceforge.net/ http://itexmac.sourceforge.net/ http://www.kiffe.com/cmactex.html http://www.trevorrow.com/oztex/index.html From now on, I’ll refer mostly to LATEX rather than TEX , since it’s the former rather than the latter which is used by most people. 182 4 METAFONT’s proof-mode Rome wasn’t built in a day. Genius is one percent inspiration and ninety-nine percent perspiration. You’ve probably heard those quotes at least once in your life16 if you’re lucky, thousands of times if you’re not. ^ ¨ Despite the overuse they have been subject of, they are quite valid here. Even when using METAFONT which does everything with equations, good typography stays an art, and it’s highly unlikely that your first shots will be exactly what you want, even if you know all the intricacies of the METAFONT programming language, and even if you’re a genius in typography! As with any art, you will have to train a lot, so that your understanding will become wider, your hand firmer, and your style more accomplished. In other words, you will have to go through a long period of trial and error (also called proofing) to create your first fonts. However, with what you know right now, proofing is tedious with METAFONT. As it is, you would need to, for each modification or new character you’ve put in your font: • compile the whole font with the right parameters to get the gf and tfm files; • transform the gf file into a pk file; • move the pk and tfm files where they can be found by TEX ; • write a small TEX file to check how your font looks like. This is due to the non-WYSIWYG17 nature of METAFONT (which is rather WYGIWYW18 ). Moreover, font characters are usually small, and thus difficult to check, and you have no way to check the position of the different points and strokes you’ve put to make the characters. So what is needed here is some kind of proofing capabilities that would bypass the usual font creation method and provide us with more information than just the shapes of the characters. Luckily, participants/reneeom/scalefontXtimes.shKnuth was well aware of the necessity of proofing, and provided METAFONT with a built-in way to do that. Actually, METAFONT’s default working mode is the proofing mode, so unless you specify otherwise (Lesson 3 will explain how to do that) you will always work in proofing mode. In this mode, METAFONT doesn’t produce a tfm file, and the gf file it creates will have the extension .2602gf. You needn’t know anything about this file, except that it contains all the information a font file usually For your edification, the second one is often attributed to Albert participants/reneeom/scalefontXtimes.shEinstein but it seems it would actually be from Thomas A. participants/reneeom/scalefontXtimes.shEdison. What You See Is What You Get. What You Get Is What You Want. 183 contains, and is also fit for making proofsheets, by applying to it the program GFtoDVI (GFtoDVI.exe on Windows). The result will be a DVI file (with the same name but the .dvi extension), which you can view with the DVI viewer that came with your LATEX distribution. On this file, each page is a proofsheet devoted to a single character, printed very large (about 20 to 30 times the normal size of font characters) and accompanied with some important information (at least if you made your METAFONT program so that this information appears). Section 5 will show an example of proofsheet and explain the information you can find on it. So, is that it? Well, that would just be too easy. Unfortunately, although METAFONT’s default mode is the proof-mode, you usually cannot use it immediately. That’s because the proofsheets use a font called gray to show the characters in large size and this font is usually not available in directly usable form in LATEX distributions. Luckily, the METAFONT source for this font is always included, so it is easy to compile it yourself to get a working font. Since the compilation of this font is a technical problem which depends slightly on the characteristics of your distribution, it is best left out of this lesson, and you can find it in Appendix ??. 5 An example So, now you have a LATEX distribution with METAFONT working and a compiled gray font for your proofsheets. You are now ready to jump to Lesson . But before you do that, maybe it’s a good idea to get a taste of METAFONT programming, just so as to help you digest what has been said until now. It will also allow you to check whether your METAFONT installation works correctly. xEXERCISE .1: Note that although this is presented as an exercise, there is no solution as there is no real problem to be solved. The only thing you need to do is follow the instructions and admire the results. ^ ¨ Now open the text editor you have chosen to use to write METAFONT sources with, and write the following 26 lines (without the line numbers): Save the resulting file under the name beta.mf. Then open a command-line window,19 go to the directory where you saved the beta.mf file, type the following line: I consider here that you will run METAFONT through the command line. If you do it differently on your platform (for instance you’re on a Mac or you use the Crimson Editor configured for use with METAFONT as explained in Appendix ??), just use the corresponding actions. You shouldn’t have any trouble finding out what you must do. 184 mf beta.mf and hit the “ENTER” key. If everything’s working correctly (and if you didn’t make a mistake when copying the program), you should get an output close to this: and possibly (on a Unix or Unix-like platform) some graphics of a letter looking like a Greek beta. If you check your directory, you will see that indeed, a beta.2602gf file has appeared, as well as a beta.log file, which just contains the same text as above. Carry on and enter now the following line: gftodvi beta.2602gf The resulting output is uninteresting, but you should find that you now have also a beta.dvi file in your directory. View it with your DVI viewer, and you should get something similar to Figure .1. To understand how METAFONT drew this figure out of the program you fed it with, let’s have a closer look at the program itself:20 • Line 1 defines an algebraic parameter with which all the dimensions of the glyph will be defined. By doing so, you will make it much easier to produce variants of your fonts, by changing the values of a few parameters, rather than having to look through a full complicated source where all the dimensions have been directly specified (one says “hard-wired”), and as such multiplying the chances you will make a mistake or will forget to change one value. Working with parameters is the key ingredient to meta-design. This tutorial will slowly teach you to think with parameters rather than direct values. • As you can see, in the first line the parameter ends in #. However, in the rest of the program, the parameter is simply called u. What is happening here is that “true” lengths (i.e. device-independent values) in METAFONT are always specified with parameters ending in # (called “sharped” variables). However, to get the same values on all devices (i.e. screens, different kinds of printers etc.), you need to specify which device you create your font with, and then convert your “sharped” values into “soft”, device-dependent, values. That’s what the define_pixels command on Line 2 does. It converts a “sharped” parameter into a “soft” one, of identical name but without a # sign at the end. This feature of METAFONT, related to the modes you will learn about in Lesson 3, is very much a sign of METAFONT’s age, created This is the reason why the program lines were numbered here. have numbered lines. METAFONT sources must never 185 • • • • • • • • at a time when printing devices were far less flexible than they are now. Still, it is necessary to learn how it works, and it is still useful for meta-design. Line 3 indicates that we start now creating a character in the font. It defines the position of the character in that font, as well as its dimensions (or rather the dimensions of an abstract “box” around the character called the bounding box, which is what TEX actually manipulates when it puts characters together on a page. This line also defines a label for this character (put just after the beginchar command between double quotes), which appears on the proofsheets for this character. It is a good idea to always label your characters, as it facilitates navigation in your programs. Lines 4 to 11 define the positions of various points through which the “pen” will go to draw the glyph. For now, just observe how all point positions are defined only in terms of the parameter u or of other points, rather than in terms of actual length values. This makes the character easily scalable by just modifying the value of u# once. Lines 12 to 21 define pen positions, i.e. the width of the pen at the position of the point, and its inclination. This is what defines the looks of the character, compared to similar characters using the same point positions. Line 22 instructs METAFONT to take a certain pen (here with a thin round nib). It’s with this pen that METAFONT will draw the glyph. By changing the pen, you can achieve different kinds of effects. Line 23 is the actual (and only) drawing instruction. Its relative simplicity shows the strength of METAFONT, which is able to interpolate the positions the pen has to go through between two points without needing help from the user. Simply speaking, the command instructs METAFONT to draw through all the different points in order, following the positions given by the different penpos instructions, and creating the shape you can admire on Figure .1. Line 24 instructs METAFONT to show, with their numbers, the points used for the construction of the shape on the proofsheet. It is very good practice to do so as much as possible. Line 25 tells METAFONT that it has finished drawing the character, and that it can get ready to draw another one, or to stop. Line 26 instructs METAFONT that the job is finished and it can go home. Don’t forget it, as without it METAFONT will think there is still work to do and will wait patiently for you to feed it with new instructions (METAFONT is a very obedient servant). Once again, don’t worry if you don’t understand everything which is explained here. The goal of this tutorial is after all to teach you 186 what it means. ^ ¨ Now, you probably fell in love with the shape you just produced, and want to make a true font out of it, in order to sprinkle your documents with eautiful etas.21 To do so, go back to your command line, and enter the following line: mf \mode=ljfour; mode_setup; input beta.mf Some command lines give a special signification to the backslash character, and for them the above line will probably result in an error. If you get this error, just put quotes around the arguments of the mf command, like this: mf ’\mode=ljfour; mode_setup; input beta.mf’ In the rest of this tutorial, I won’t use quotes around such arguments, but feel free to add them at need. For now, just remember that the backslash indicates to METAFONT that it must expect instructions on the command line rather than a filename, that the first two instructions put METAFONT in true fontmaking mode22 (rather than proof-mode), and that the last one causes METAFONT to finally load and compile beta.mf. The output you will get should look like this: It is slightly different from the output you got the first time around, and indicates that two files have been created this time. And indeed, if you check your directory, you should see that a beta.tfm file and a beta.600gf (or similar with another number) file have appeared. Now you still need to pack the gf file into a usable format. You do so with this command: gftopk beta.600gf beta.600pk or this one: gftopk beta.600gf beta.pk if your platform needs unnumbered pk files. A beta.600pk or beta.pk file should appear in your directory. And that’s it! Your Don’t worry if the doesn’t look good when you’re viewing this PDF document on screen. It is the fault of the PDF viewer you use, which does a poor job displaying bitmap fonts like the ones METAFONT creates (they will print beautifully, though). Luckily, Adobe®, the creators of the PDF format, have now released a new version of their PDF viewer which solves this problem and displays bitmap fonts on screen as well as on paper. So go and download the Adobe Reader 6.0 at http://www.adobe.com/products/acrobat/readstep2.html, you won’t be disappointed! Depending on your installation, you may need to choose a mode different from ljfour. Basically, you should choose the same that you used to compile the gray font as explained in Appendix ??. 187 font is now available to every LATEX document whose source is in the same directory as the font files23 and you can test it with the following LATEX program: Just compile it and check the result with your DVI viewer. ^ ¨ I said: “There is NO solution to this exercise!!!” ^ ¨ 6 Before you carry on. . . Phew! This lesson is finally finished! You may have found it informative, challenging, just boring, or completely unintelligible. In any case, you have probably found it extremely technical (and with reason). So before jumping to the real beginning of this tutorial, turn off your computer! Go out, do something else, some sports, watch TV, read a book, do whatever you want as long as it isn’t related to METAFONT. Have at least a full night of sleep before going back to this tutorial and start the real work. This will help you understand things you may not have fully grasped while reading this lesson, or will help you realise what you didn’t understand, and will have to look at again. And once again, don’t feel bad because you didn’t understand everything that was explained here. This tutorial will teach you everything in time, and you will come back to this lesson and be surprised at how much more you understand after a few lessons. But for now, go and rest! ^ ¨ You will have to wait until Lesson 4 to learn how to make your font available to all LATEX files whatever their location on your hard drive. 188 Figure .1: The Greek letter . 189 My First Character 1 Before we begin Before we actually start the lesson, let’s just give some remarks about the typographic conventions used to write METAFONT commands and programs. As you may have guessed from the example in Section 5, there are two different typographic conventions used in this tutorial, both of which are taken straight from the conventions in The METAFONTbook. Sometimes I’ll refer to METAFONT commands and variables using a typewriter-like style of type, e.g. ‘z5=(10u,12u);’, ‘penpos9(1.5u,-180);’ or ‘beginchar(66,13u#,16u#,5u#);"Letter bet Other times, I’ll use a fancier style where main commands and macros will appear in bold face or roman type, while variables, user-defined macros and less important macros will appear in italic types. In this style, subscripts and superscripts will also be used. In this style, the same examples as given before will appear respectively as ‘z5 =(10u, 12u);’, ‘penpos9 (1.5u,−180);’ and ‘beginchar(66, 13u# , 16u# , 5u# ); “Letter beta”;’. The typewriter style will be used when I talk about what you will have to actually type on your keyboard, and how it will likely appear on your screen (without taking a possible syntax highlighting into account). It will also be used when referring to the output the different programs you will run will give you back, as well as to refer to filenames. The fancier style will be used rather when I want to emphasize the logical structure and the meaning of a program rather than its representation. Yet you will usually be able to directly type what’s given to you in fancy style and obtain a correct program. You will just have to pay attention to subscripts and superscripts as they may hide the actual order of the characters as you have to type them (for instance, a variable like ‘z01 ’ must by typed as ‘z1’’, not as ‘z’1’. 2 The command line This section, as well as most of this lesson, will make use of the METAFONT command line, and thus will be inaccessible for people with an OS without a command line (users of MacOS until version 9 for instance). Those people can solve this problem by writing programs containing the commands I will describe, run them through METAFONT, and check the resulting logfile, however impractical that process is. But for the purpose of this lesson, I will suppose that you have a command line. Thus open your command line, go to a directory where you want to save your METAFONT files, and then enter the command “mf”. You will receive a message which should look like: The “**” prompt indicates that METAFONT is expecting a filename. But since in this case we don’t want to give it one, just type 191 “\relax” instead. The prompt will change to “*”, indicating that METAFONT now expects to receive instructions directly from the keyboard. Go ahead and type the following (admittedly useless) line: 1+1; You will get the following output: >> 2 ! Isolated expression. <to be read again> ; <*> 1+1; ? Don’t worry about the error (type “s” at the “?” prompt to enter scrollmode and never have to worry about errors again. They will appear, but the normal prompt will reappear afterwards). The important thing is that METAFONT calculated the result of the addition (as you can see on the first line of output). Besides the addition, you can of course make subtractions (“-”), multiplications (“*”) and divisions (“/”). And as you’ll see later, METAFONT has a lot more mathematical abilities. But right now, METAFONT is nothing more than a glorified calculator. So let’s get to the second step, the one which makes METAFONT so different from other programming languages. 3 Some simple algebra What? What’s happening? Why are you all running away? Is the word ‘algebra’ so frightening? I see, it reminds you of the nightmarish days at school and the endless maths classes. Well, don’t worry, I’m not going to give an algebra class here. But it is important to know at least a little about algebra in order to use METAFONT to its full potential. So there. But what is algebra anyway? Simply put, algebra is the idea that if we have a set of related unknown quantities, we can label them using letters, and write the relationships between those unknown quantities, which from now on will be referred to as variables, using the language of mathematics, forming what we call equations. And if we have enough of those equations, we can even, using a process called solving, use our equations to obtain the values of the different variables. Well, that is exactly how METAFONT works: you write the equations, and it takes on itself the job of solving them. But an example is better than theoretical talk. Take back your METAFONT command line, and type: tracingequations:=tracingonline:=1; Don’t worry about what it means. It simply asks METAFONT to show you how it works in the background when you give it equations to solve. Now enter the following equation: 192 a+b-c=0; METAFONT will reply: ## c=b+a * It just means that METAFONT has recognised that you have given it a relationship between some unknown quantities, and it has rearranged it in a way it likes it. Then enter: c=2a; Note that METAFONT knows enough about mathematical notation to recognise that ‘2a’ simply means ‘2*a’. Unlike many programming languages, it understands this kind of abbreviations, and will reply: ## b=a In the process of solving the equations you have given to it, it has replaced in the first equation the value of c that you gave with the second equation, thus making a simpler equation depending only on a and b. Finally enter: a=5; METAFONT will reply: ## a=5 #### b=5 #### c=10 METAFONT is saying here that by giving it the actual value of a, it was able, thanks to the other equations, to compute the value of b and c as well, so that now all your variables are known. You have entered a system of equations to METAFONT, and it has solved it, giving you back the results. Since METAFONT is doing all the dirty job, isn’t algebra looking much easier now? ^ ¨ But now type in the following line: c=0; METAFONT won’t like it and will reply: ! inconsistent equation (off by -10). <to be read again> ; <*> c=0; What does this mean? Simply that unlike in other programming languages, “=” is not an assignment but a relation operator. It means that when you write a line like “c=0;”, you are not telling “give to c the value 0”, but “I give you an equation which poses a relationship of equality which between the variable c and the value 0”. So if through other equations, the variable c has already been found to have another specific value (here 10), the equation you add contradicts 193 previous results, and thus is inconsistent with the rest and causes an error. This, with the ability to solve equations as they come, is the main difference between METAFONT and other programming languages: while other languages are by nature imperative, i.e. you order them to accomplish some tasks through different commands (so that in those languages “c=0;” can mean “discard the previous value of c and assign it the value 0”), METAFONT is by nature declarative, i.e. you don’t order it around, but you describe things to it, in possibly complex ways, yet simple to type, and let it find its way around all the relations you’ve given it. As such, you let it do the dirty work, and you don’t have to bother with the details. METAFONT does have some imperative commands, but I won’t talk about them right now. Why? Because otherwise people used to an imperative programming style would try to do the same with METAFONT, and would not only make very inelegant programs, but would also prevent themselves from using the full power of METAFONT, and would without realising it do much too much work where METAFONT could have done it by itself, and faster. Do try to remember the difference between declarative and imperative programming, even if you don’t understand very well yet what it means. With the examples and exercises in this tutorial, you will soon find out how to program declaratively. xEXERCISE .1: Here is a system of equations, presented in a mathematical way: a + b + 2c = 3 a − b − 2c = 1 b+c = 4 1. Is this system consistent (before you begin to feed the equations directly to METAFONT, try to solve that question by yourself, and use METAFONT only to check your results. It’s often easier to use a tool when you understand how it works)? 2. If you were to enter the first equation as is in an imperative programming language, what could be a problem? 1. Yes, the system is consistent, as no equation contradicts another. It is even completely solvable and leads to the solution: a=2 b=7 c = −3 2. Entering the first equation as is means entering the following sequence: “a+b+2*c=3’ (note that I wrote “2*c” because unlike METAFONT, most programming languages don’t know about those abbreviations), or something similar. The problem that would happen is that for most imperative languages, ‘=’ is an assignment operator, and assigning a single value 194 to a sum of variables is something impossible to do (the language cannot guess what value each variable must receive). Writing the equation as “a=3-b-2*c” would only be marginally better, because for most imperative languages you cannot put on the right of an assignment operator an unknown quantity, and both b and c are unknown at this stage. Thus you see one of the advantages of descriptive programming over imperative programming: you have much more freedom in entering the relationships between variables, and are not restricted to the rigid syntax imperative programming requests. 4 Coordinates and curves Until now we have worked only with variables, equations and numbers. But isn’t METAFONT about drawing characters? Indeed it is, so it is time we learn how it does this. But first, how does METAFONT know where to draw things? It uses coordinates. You probably already know about coordinates. For instance, you probably know that the position of a person or a place on Earth or on a map can be described using 2 coordinates: the latitude and the longitude. You may also have played games of Battleship, where each point on the board is located through the combination of a letter (for the columns) and a number (for the rows). The principle behind coordinates in METAFONT is the same: take a piece of graph paper (with horizontal and vertical lines), and choose some point that you will call the reference point. Once you’ve chosen this point, you can locate any other point on the paper by counting the number of units to the right of the reference point, and the number of units upward from the reference point. And if you need to go to the left of the reference point, or downward, just use negative numbers, i.e. count the number of units you need, and add a minus sign in front of them. This way, you can uniquely locate each point on the paper relatively to the reference point using a set of two coordinates: the x coordinate, which is the number of units to the right of the reference point, and the y coordinate, which is the number of units upward from the reference point. And the notation used to write down this pair is to put them in parentheses, separated by a comma, with the x coordinate first: (x, y). So, for instance, the point located at the coordinates (5, 10) is the point at 5 units to the right of the reference point, and 10 units upward from the reference point, while the point located at the coordinates (25, −10) is located at 25 units to the right of the reference point, and 10 units downward from that same point. xEXERCISE .2: True or false: all points that lie on a given vertical straight line have the same y coordinate. False. Check yourself on a piece of graph paper. To reach two different points on the same given vertical straight line from a given reference point, you need to go up or down from different amounts, 195 but for both points the number of units to the right or the left of the reference point is the same. So all the points that lie on a given vertical straight line have the same x coordinate. In the same way, all the points that lie on a given horizontal straight line have the same y coordinate. xEXERCISE .3: Here are the coordinates, relative to the same reference point, of four different points, called A, B, C and D: A: (10, 10) C: (0, 10) B: (0, 0) D: (10, 20) 1. Explain where each point is located. Draw them on graph paper. 2. Which is the top-most point? 3. Which of the four example points is closest to the point of coordinates (7, 5)? 4. Explain where the point (−2, 6) is located. Which of the four example points is it closest to? 5. (for the ones who still know a bit about geometry) How would you call the figure ABCD? 1. In this case, a drawing is better than a long speech, so there! Note that B is actually also the reference point. 2. D. It is the point with the highest y coordinate. 3. A. See Figure .1 for more details. 4. The point of coordinates (−2, 6) is located at two units to the left of B, and 6 units upwards. It is closest to C. See Figure .1 for more details. 5. The shape ABCD is called a parallelogram. METAFONT has its own internal graph paper, consisting of a grid of square “pixels”. So the unit it naturally uses for its coordinates is the pixel. As for the position of the reference point, it is also an absolute in METAFONT. We will see later where it is located on the “internal graph paper”. So take again your METAFONT command line, and type the following instructions: drawdot (35,70); showit; If your installation allows for online displays, you will see a circular dot appear on your screen. Otherwise, just wait for a few more lines. So now add the instructions: drawdot (65,70); showit; You should see a new dot appear, at the right of the previous one (more exactly at 30 pixels to its right). Finally, type: 196 Figure .1: Positions of the different points. draw (20,40)..(50,25)..(80,40); showit; shipit; end This should draw a curve, show it if possible, and then ship the whole drawing to an output file and stop METAFONT. The output file is called mfput.2062gf and you should find it in the directory you were located at when you started METAFONT. Now even the people who cannot have online display will be able to see what they did. To do so, take your command line (with METAFONT stopped, it should show again its normal prompt) and type: gftodvi mfput.2602gf This should create a mfput.dvi file which contains the result of your drawing instructions. Display it to see METAFONT smile at you, as in Figure .2! But wait a minute. The last line I made you type made a curve appear, and we haven’t talked about curves yet! Well, here it comes! ^ đ Curves are collections of points. Indeed, any curve, whatever its shape or length, contains an infinity of points, and as such is much more complicated to describe than points, which just require two numbers to describe their position. But luckily for us, METAFONT is quite intelligent and can do most of the job for us. The main instruction to draw lines and curves in METAFONT, as you’ve seen, is the draw instruction. It is incredibly powerful, while quite innocent-looking. Indeed, all it needs is to receive a series of point coordinates to draw a curve which will go through all the points you indicated, in the order 197 Figure .2: Smile! you typed them in. So if you simply want to draw a vertical straight line, 100 pixels long, beginning at the reference point, just type: draw (0,0)..(0,100); showit; shipit; end Go ahead and try it (to go back to the METAFONT prompt, type directly “mf \relax” on your command line. Don’t forget to make the resulting output file into a DVI for people without online display). Don’t worry yet about the “..” between the two pairs of coordinates. We will come back to it in another lesson. For now, just remember that the draw command needs to have those two dots between coordinate pairs. So to draw a straight line, just give draw the location where it starts and the one where it ends, and it will find out how to draw it by itself (this is also descriptive programming). We will come back to the abilities of the draw command in the next lesson. For now, we know enough for what we want to do. xEXERCISE .4: Describe the line which would be drawn by the following instruction: draw (−100, 50)..(150, 50); This instruction draws a 250-pixel-long horizontal line, beginning at 100 pixels to the left of the reference point, and ending at 150 pixels to the right of that same point, and constantly at 50 pixels above the reference point. 5 Just a remark Before we carry on, let’s have a look at METAFONT’s syntax. As you have probably seen by now, all instructions in METAFONT are followed with a semicolon ‘;’.1 This is mandatory. The semicolon in METAFONT, as in C, Java or Except end and input instructions at the end of a program. Since end is used to end a program, it doesn’t need anything after it (indeed, anything after it won’t be seen by METAFONT anyway). As for the 198 Pascal (which happens to be the language the METAFONT source is written in), is used to indicate the end of a statement. For now, just remember that it means that each instruction in METAFONT must end with a semicolon, otherwise METAFONT will complain or act strangely. 6 What has Descartes got to do with METAFONT? Descartes was a French philosopher and mathematician of the 17th century. Despite all the criticism he received during his life and after his death, he is in many ways the father of the modern scientific thought. He left his mark even when his theories were proved wrong while he was still living (for instance, his theories about the weather, as presented in his treatise Les Météores, were completely wrong, but it doesn’t change that we still call the study of the weather meteorology). But his main work was on geometry, from which we now have Cartesian geometry. The coordinate system we’ve been using until now is usually called Cartesian coordinates. We don’t call it that way because Descartes invented the idea of using coordinates (indeed, he didn’t), but because he got the idea of applying algebra to geometry through the use of those coordinates! Indeed, by treating coordinates as unknowns, i.e. as variables, and apply equations to them, he discovered that he could describe various lines and curves, and even easily prove theorems of geometry through simple calculus, when until now all that had been available was complex geometric methods. His work was to revolutionise both physics and geometry, by providing a good base to describe geometric features through numbers. And that’s where we come back to METAFONT! Indeed, METAFONT uses the full power of Cartesian geometry by allowing calculus to be done using point coordinates. And so that’s where all this discussion about algebra using METAFONT and declarative programming comes back, because by using the power of algebra and the ability to just describe a few features through equations that METAFONT will be happy to solve itself, you can easily tell it where to locate points without having yourself to know exactly where they are, just where they are compared to other points! The gain is vital, as we are going to see in the rest of this lesson. 7 Coordinates as variables How do we refer to a point with unknown coordinates? We could of course take two unknown variables a and b and use them as coordinates, defining a point of coordinates (a, b). But if you needed a lot of points, you’d end up losing track of what variable is associated to which coordinate of which point. Luckily, METAFONT helps you out in this case (again!). If you label your point with the number input instructions we have seen until now, they all asked METAFONT to load a program which contained an end command itself, and as such didn’t need a semicolon after them either. 199 1 (for instance, any other value will do), its x coordinate will automatically be x1 , and its y coordinate will automatically be y1 .2 Note that you don’t have to declare any point to be labelled as ‘1’. As soon as you refer to x1 or y1 , METAFONT knows that it refers to a point labelled ‘1’. So you can now define points using their coordinates and always keep track of what belongs to what. See for instance: (x 1 , y 1 ) = (0, 0); (x 2 , y 2 ) = (50, 0); (x 3 , y 3 ) = (100, 0); (x 4 , y 4 ) = (0, 50); (x 5 , y 5 ) = (50, 50); (x 6 , y 6 ) = (100, 50); Whatever the number of points you will have, you will never lose track of which variables are associated to each of them. Also, as you see, you can define directly pairs of coordinates by using the ‘=’ instruction, as long as on both sides of the equal sign you have a pair of coordinates (otherwise you have a type mismatch, and thus an error). However, for how nice the use of x1 and y1 may be, if you have to write twenty times the sequence “(xa , ya )”, with different values for a, it can get pretty long and boring. Luckily, METAFONT provides a convenient shortcut. The notation “z1 ” is completely equivalent to “(x1 , y1 )”, and can be used whenever the pair is used. So the previous series of definitions could have been written: z1 z2 z3 z4 z5 z6 = (0, 0); = (50, 0); = (100, 0); = (0, 50); = (50, 50); = (100, 50); However, if you still have to define your points like that, you are likely to wonder what we have gained with all those conventions, apart from a little more clarity. Well, the true advantages of those conventions are yet to come. ^ ¨ 8 Doing algebra with coordinates Now that we have defined special variables for the x and y coordinates of points, nothing obliges us to define them at the same time. Indeed, as long as you don’t use a point in some drawing instruction, METAFONT will never complain, even if the x coordinate of such point is defined 100 lines before its y coordinate! Also, the coordinates are variables in their own right, which can go into all kinds of Note that in METAFONT , x 1 is a shortcut for x[1]. This will be useful later. 200 equations, and can thus be defined by solving those equations, what METAFONT can do in your place. Figure .3: An upright rectangle Here is an example. Imagine you want to draw an upright rectangle (i.e. a figure with opposite parallel sides, with one pair of horizontal sides and one pair of vertical ones). You don’t know yet the exact lengths of the sides, just that it will definitely be a rectangle. Indeed, the lengths of the sides may depend on an equation which will be solved only later in the program. In any other programming language, you would just have to remember that you need a rectangle, and make sure you don’t make a mistake at the end when you can finally define where the corners of the rectangle will be. But METAFONT is not any programming language, and instead of leaving you the chore of remembering that you want an upright rectangle, it can do it by itself. How? Well, just look at Figure .3, which represents such a generic upright rectangle. What general features does it have that don’t have to do with the lengths of its sides? What about corner alignment? Indeed, in such an upright rectangle, the points 1 and 2 are horizontally aligned (as well as 3 and 4), and the points 1 and 4 are vertically aligned (as well as 2 and 3). How does it translate in terms of coordinates? You just need to remember that horizontally aligned points have the same y coordinate, while vertically aligned points have the same x coordinate. When you remember that, you will realise that you only need 4 simple equations to tell METAFONT that the figure formed by the four points 1, 2, 3 and 4 is a rectangle: y 1 = y 2; y 3 = y 4; x 1 = x 4; x 2 = x 3; 201 And that’s all! From now on, METAFONT will remember that the figure 1234 is a rectangle, and you will only need to finally get the coordinates of two opposite points (either 1 and 3, or 2 and 4) to have your whole rectangle perfectly defined. You can also give indications of distances. For instance, if you want to indicate that whatever their exact positions, you want point 1 to be always at 100 pixels to the right of point 2, you just have to write: x 1 = x 2 + 100; This last equation can also be written “x1 − x2 = 100;”, which shows that you can specify the horizontal distance between two points by subtracting their x coordinates (in the same way, you get the vertical distance between two points by subtracting their y coordinates). You can also say that point 1 will always be twice higher than point 2 by specifying: y 1 = 2y 2 ; You can even make the coordinates of some point dependent on other parameters, that you can define as you wish. For instance, you can say: x 1 = 12 a; which means that the x coordinate of point 1 will be equal to half the value of a certain named a. As you see, thanks to the use of algebra, the possibilities are infinite! xEXERCISE .5: Translate the following equations into “simple English”: 1. 2. 3. 4. 5. 6. x1 = x2 − 20; y1 = 3y2 − 100; 2x1 = a; x2 − x1 = b; x2 − x1 = y1 − y2 ; b − y2 = y1 − a; 1. Point 1 is at 20 pixels to the left of point 2. 2. Point 1 is at 100 below a point which is three times higher than point 2. 3. The parameter a is twice the value of the x coordinate of point 1. In other words, it is identical to “x1 = 12 a;”. 4. The horizontal distance between point 1 and point 2 is equal to the parameter b, and point 2 will be to the right of point 1 if b is positive. 202 5. The horizontal distance between point 1 and point 2 is equal to the vertical distance between those same points. And if point 2 is to the right of point 1, then point 1 is above point 2. 6. This is more complicated to describe, and the best way is to consider the parameters a and b to refer to y coordinates as well. They can be said to refer to horizontal lines, one at height a, the other one at height b. Once said, you can describe this equation by saying that it means that point 2 is below the line of height b by the same distance that point 1 is above the line of height a. Here’s another example. Now you have two vertically aligned points 1 and 2, and you want to find the point exactly in the middle. Since they are vertically aligned, said point will be vertically aligned with them: x 3 = x 1 (= x 2 ); What is the condition on the y coordinate of 3 then? Since it’s in the middle, exactly between 1 and 2, its y coordinate will be the mean of the y coordinates of 1 and 2, i.e.: y 3 = (y 1 + y 2 )/2; Try this formula by drawing yourself some lines on graph paper and find their middle to convince yourself that it is indeed correct. xEXERCISE .6: What if you would like to define an isosceles triangle rather than a rectangle (reminder: an isosceles triangle is a triangle with at least two equal sides). To simplify, such an isosceles triangle is represented in Figure .4, and you will just have to describe it in terms of corner coordinates. OK, even with the figure, it is slightly more complicated than describing a rectangle. Well, what do you expect? It’s an exercise, it’s supposed to challenge you. ^ đ The solution is actually simple. As you have probably seen already, the points 1 and 2 are horizontally aligned, thus: y 1 = y 2; As for the point 3, the fact that the isosceles triangle has two equal sides indicates that it must be at equal distance from both 1 and 2. In other words, its y coordinate stays unspecified, but its x coordinate is known: it must be exactly between the x coordinates of the two other points, i.e. their mean. Translated into an equation, it gives: 203 Figure .4: An isosceles triangle x 3 = (x 1 + x 2 )/2; And that’s all! Those two equations are enough to describe this isosceles triangle. So we know that we can do algebra using coordinates. But what would really be nice would be to be able to do algebra using pairs of coordinates directly! After all, we can already use the equal sign between pairs of coordinates, so why not other operators? Well, that’s what we are going to see in the next section. 9 Vectors We already know that we can add x and y coordinates. “x1 + x2 ” and “y1 + y2 ” are both clearly defined. So it’s not a big surprise to define “(x1 , y1 ) + (x2 , y2 )” as “(x1 + x2 , y1 + y2 )”. This way, we have defined an addition operation on coordinate pairs (and since the notation “z1 ” stands for “(x1 , y1 )”, we can also write “z1 + z2 ” for the pair addition). But what does such an operation mean? How does it translate on the graph paper? To answer this question, we have to go back at how we defined coordinates. 204 We said that the coordinates of a point are the amount of units we move to the right of and upwards from some reference point. Because of this definition, this reference point always has the coordinates (0, 0). But now let’s take any point of coordinates (x, y). Because adding 0 to things doesn’t change anything, we can also say that its coordinates are (0 + x, 0 + y). And because of the definition of the addition of pairs we gave earlier, this can also be written as (0, 0) + (x, y)! Isn’t it familiar? Yes, we see the reference point appearing, and this addition suddenly looks quite similar to the description of coordinates I gave at the beginning of this paragraph. It’s not surprising. After all, we already know that adding a certain amount to the x coordinate of a point means “move to the right by this amount”, and that adding a certain amount to the y coordinate of a point means “move upwards by this amount”. So adding a pair simply means doing both additions at the same time, and thus moving both to the right and upwards by both specified amounts. In other words, pairs of coordinates can describe not only point locations, but also displacements. Depending on what we do with it, the pair (5, 10) can mean “the point located at 5 units to the right of and 10 units upwards from the reference point” or “move to the right by 5 units and upwards by 10 units”. This second meaning appears as soon as you add this pair to another pair of coordinates. So now we know what an equation like “z2 = z1 + (5, 10)” means in simple English: to get to point 2, start from point 1, move to the right by 5 units and upwards by 10 units. Try that on graph paper if you need to by convinced that it’s really what the addition of pairs mean. Displacements defined through pairs of coordinates are called vectors. You can picture a vector as an arrow pointing to where the displacement leads, and whose length is the actual amount of displacement. Vectors and points are completely equivalent, because the coordinates of a point are also the displacement necessary to get from the reference point to the point in question. Note that just like points can have negative coordinates, vectors can have negative coordinates too, indicating displacement to the left and downwards rather than to the right and upwards. Also, the pair (0, 0) is also a vector, namely the vector “don’t move at all!” (also called null vector). ^ ¨ xEXERCISE .7: Just like we have defined an addition for pairs, we can easily define a substraction, through the following definition: (x1 , y1 ) − (x2 , y2 ) = (x1 − x2 , y1 − y2 ). By defining it this way, the substraction of pairs works exactly like the substraction of numbers, especially in conjunction with the addition. So, now that you know what substraction means, can you describe what “z2 − z1 ” is? The solution is easier than it may look. Since the substraction of pairs works exactly like the substraction of numbers, you can write: z1 + (z2 − z1 ) = z1 + z2 − z1 = z2 (because z1 − z1 = (0, 0), the null vector). If you compare the resulting equation “z2 = z1 + (z2 − z1 )” to the explanation of the addition we have given earlier, it becomes clear that z2 − z1 is the displacement needed to go from point 1 to 205 point 2, i.e. the vector that describes the displacement necessary to go from point 1 to point 2. Please remember this result, it will be quite useful in the future. We have now defined both the addition and the substraction. But we can also multiply coordinates with some value. So can we do that with pairs? Of course! Simply define it this way: a(x1 , y1 ) = (ax1 , ay1 ), where a is some numerical value. METAFONT allows you to use all those definitions, and treats pairs of coordinates as points and vectors according to their use, so that you can directly use what you’ve learned here in METAFONT. xEXERCISE .8: Translate the following equations into “simple English”: 1. 2. 3. 4. z2 = z1 − (30, 50); 3z2 = z1 ; z2 − z1 = (100, −100); 2(z2 − z1 ) = z4 − z3 ; 1. Point 2 is at 30 pixels to the left of and 50 pixels downwards from point 1. 2. Point 2 is 3 times as far from the reference point as point 1 (if this explanation surprises you, check it on graph paper). 3. The vector describing the displacement between point 1 and point 2 has the coordinates (100, −100). It also means that point 2 is at 100 pixels to the right and 100 pixels below point 1. 4. The vector describing the displacement between points 3 and 4 is twice the vector describing the displacement between points 1 and 2 (it points to the same direction but is twice as long). It also means that the lines 12 and 34 are parallel, but that point 4 is twice as far from point 3 as point 2 is from point 1. We have already seen that we could find the y coordinate from a point halfway between two vertically aligned points by calculating the mean of their y coordinates: y = (y 1 + y 2 )/2; In the same way, the point half-way two horizontally aligned points has the following x coordinate: x = (x 1 + x 2 )/2; But how do you do it when the two points are neither vertically nor horizontally aligned? In this case, you need to use both equations to define both coordinates of 206 the middle point. Indeed, the point half-way two other points 1 and 2 (whatever their positions) has for coordinates the means of their x and y coordinates. Do you need to specify both equations then? Of course not! Thanks to the definitions that METAFONT uses for the addition and the multiplication, you can simply write: z 3 = (z 1 + z 2 )/2; You can check yourself that the formula is correct. However, calculating the middle point between two points is a little limited. What if we want to specify a point on the line defined by points 2 and 3, but at one-third of the distance between those points (closer to point 1 thus)? Or at nine-tenths of this distance (and thus closer to point 2)? Or even a point on this same line, but not between 1 and 2, like for instance a point aligned with points 1 and 2, as far from point 1 as point 2, but in the other direction? Or 3 times as far from point 1 as point 2, and in the same direction? It may sound like a complicated problem, but actually it is quite simple. Remember that z2 − z1 refers to the vector between point 1 and point 2. It has the direction of the line made by those points, and its length is the distance between points 1 and 2. And if you multiply it by a certain value, you will get a new vector, of same direction, but with a different length. So if you add this new vector to z1 , you will get a point on the line formed by 1 and 2, but depending on the chosen multiplicative value you can reach any point on this line! Let’s see a few examples so that you can understand what I mean: • z1 + 0*(z2 − z1 ) = z1 . So if you take as value 0, you get point 1. • z1 + 1*(z2 − z1 ) = z2 . So value 1 corresponds to point 2. • z1 + .5*(z2 − z1 ) = .5(z1 + z2 ). This is the definition of the point half-way between those two points, which is thus associated to the value .5. • z1 − (z2 − z1 ) = 2z1 − z2 . You can check on Figure .5 that it corresponds to the point as far from 1 as 2 but on the opposite direction. • z1 + 2(z2 − z1 ) = 2z2 − z1 . You can check on Figure .5 that it corresponds to the point twice as far from 1 as 2 and in the same direction. What we have done here is called a parametrisation of the line defined by the points 1 and 2. That’s because if we take a parameter t, we can define all points of the line defined by the two points 1 and 2 through the formula z1 + t(z2 − z1 ). It is a very important and useful formula in METAFONT (aligning points together is one of the main things you’ll do when trying to find where to put points to draw something with METAFONT). However, it is also a formula difficult to remember. So METAFONT provides a practical shortcut for it: the syntax “t[z1 , z2 ]” corresponds exactly to the formula “z1 + t(z2 − z1 )”. So you can easily define any point aligned with points 1 and 2 by using this formula with the correct parameter (which can be unknown). And note that this shortcut works for coordinates separately too: “t[y1 , y2 ]” stands for “y1 + t(y2 − y1 )”. xEXERCISE .9: 207 Figure .5: The points on the line and their parameters Redo Exercise .6, but this time using the “t[a, b]” notation (extremely easy). The only difference from the first solution of this exercise is that you can now simply write that the x coordinate of point 3 follows this equation: x 3 = .5[x 1 , x 2 ]; xEXERCISE .10: Translate the following equations into “simple English”: 1. z3 = 74 [z1 , z2 ]; 2. z3 = .5[z1 , z2 ] − (0, 100); 3. z3 = (.2[x1 , x2 ], .8[y1 , y2 ]); 1. Point 3 is aligned with points 1 and 2, and between them at 47 of the distance between those two points (closer to 2 than to 1). 2. Point 3 is situated at 100 pixels below the middle point between points 1 and 2. 3. A drawing will give you a good idea of the situation, so check Figure .6. As you can see, point 3 is vertically aligned with the point at .2 of the distance between 1 and 2 (same x coordinate) and horizontally aligned with the point at .8 of the distance between 1 and 2 (same y coordinate). 208 Figure .6: Position of point 3 compared to points 1 and 2 xEXERCISE .11: True or false: t[z1 , z2 ] = (1 − t)[z2 , z1 ]. True. You can check it by replacing the expression with its definition: (1 − t)[z2 , z1 ] = z2 + (1 − t)(z1 − z2 ) = z2 + z1 − z2 + tz2 − tz1 = z1 + t(z2 − z1 ) = t[z1 , z2 ] So, we can now define any point which is aligned with two other points. But what if we just want to indicate that a point is aligned with two other points, but you don’t know yet exactly where it is located? Of course, we could use the formula “z = t[z1 , z2 ]” with an unknown t, and only later define the value of this variable. This works perfectly, but only if we can eventually define t. Indeed, you may want to finally define your point through alignment with other points (thus finding the intersection between two lines), or through one of its coordinates. In those cases, finding the actual value of t would be at best uneasy, at worst impossible. Luckily, METAFONT provides a special variable exactly for this purpose called whatever. The whatever variable means exactly what its name says: “I don’t care what that actual value is”. ^ ¨ So you can now specify that a point will be aligned with the points 1 and 2 without having to specify where exactly it will be found by using the equation: z = whatever[z1 , z2 ]. This way, you will be able to define the actual position of this point through another equation while you will always be sure that the point will always be aligned with points 1 and 2. This whatever variable is very powerful and can be used in plenty of situations, not only with the bracket notation, wherever you have to add a parameter but don’t know yet its actual value, or that value is irrelevant at the moment. We will encounter it quite often in the course of this tutorial (and you will use it very often in your programs). xEXERCISE .12: 209 What does the system of equations: z 5 = whatever [z 1 , z 2 ]; z 5 = whatever [z 3 , z 4 ]; mean? Is it possible for such a system to be inconsistent? If you read carefully the paragraph introducing the whatever variable, you should find the solution already written. ^ ¨ The first equation says that point 5 is aligned with points 1 and 2 (without specifying exactly where it is). The second equation says that it is also aligned with points 3 and 4. So point 5 is simply the intersection of the lines defined by points 1 and 2 and points 3 and 4. And yes, such a system may be inconsistent. If the two defined lines happen to be parallel, they can never intersect and point 5 cannot exist. That’s why for as powerful as it may be, try to make sure that your lines do intersect before trying to find their intersection with such a system of equations. 10 Finally, let’s draw a character! So, we have learned about the command line of METAFONT, the basics of its syntax, its descriptive rather than imperative nature, and have had a long (but necessary) lesson about algebra and Cartesian geometry. Because of the theoretical nature of this lesson, you are probably wondering now whether it is actually useful to know so much about algebra to draw characters. Well, let’s show that by applying our newly acquired knowledge to the drawing of a character. In order to be simple but at the same time challenging, let’s draw a simple capital E, of the kind you find in the name METAFONT. An example of what we want is available in Figure .7. But since we don’t want to be that simple, we’re going to add a little something: we are going to base our character on the golden number, a number which is supposed to be indicative of “perfect” proportions. Some people see it everywhere, as you can check in this site.3 The golden number is usually written Φ (Phi) and its value is: √ 1+ 5 Φ= ≈ 1.6180339887 . . . 2 So let’s take our METAFONT command line again (once again, type “mf \relax” on your command line to obtain it), and begin with defining a variable which will contain the value of Φ. Don’t worry about the square root, METAFONT provides us with a command called sqrt which calculates it. So just enter: http://goldennumber.net/ 210 Figure .7: A simple E character Phi=(1+sqrt5)/2; Note that METAFONT is case-sensitive, so that Phi and phi are two different variables for it (be aware of it if you don’t want to make mistakes) and that you needn’t put a space between sqrt and its argument (nor put its argument in parentheses, as necessary in many other programming languages). METAFONT commands can never contain figures, so METAFONT has no problem reading that (but if you want to put a space “sqrt 5” or parentheses “sqrt(5)”, go ahead! METAFONT is flexible enough to handle all those different syntaxes). Now we are going to define the general dimensions of the character, namely its width, and its height (we’ll see later that characters have two other dimensions, but for this one two are enough). Let’s say that we want a character with a width of 100 pixels. Let’s put that into a variable called w, by entering: w=100; As for its height, since we said this character should be based on the golden number which is based on proportions, let’s define it by saying that it’s the width multiplied by the golden number: h=Phi*w; So that the ratio height/width will be equal to the golden number. Now let’s define the basic points needed to draw the character. The only points we need are the extremities of the four strokes (1 vertical, 3 horizontal) necessary to draw this character. So we only need six points, and we are numbering them as in Figure .7. The E character contains three horizontal lines, which means that 211 those points must be horizontally aligned two by two. Indeed, points 1 and 6 are aligned at the bottom of the character, points 3 and 4 are aligned at the top of the character, and points 2 and 5 are aligned in between. Let’s enter the equations that translate those alignments: y1=y6=0; y3=y4=h; y2=y5; As you see, we have not only translated the alignments, but also indicated that points 1 and 6 are at the bottom of the character and points 3 and 4 at the top (note how we concatenate equations to win space. METAFONT is happy to allow those kinds of shortcuts ^ ¨ ). We’ve not explicitly defined the y coordinates of points 2 and 5 because we don’t know exactly yet where they are going to be located at. The E character contains also a vertical stroke, which is translated by saying that points 1, 2 and 3 are vertically aligned: x1=x2=x3=0; The vertical stroke is at the very left of the character, so we could also define precisely those coordinates. Now, we still have a few coordinates to define. First, we want the bottom and top horizontal strokes to be both as long, and as long as the full width of the character. But we don’t want the middle stroke to be as long, or the E character would look a bit too wide. So we are going to make the middle stroke smaller, so that the ratio of the width of the character over its width is again the golden number (or that the width of the smaller stroke multiplied by the golden number is the width of the character). We achieve that by writing: x4=Phi*x5=x6=w; So finally all that is left is to find how high points 2 and 5 must be. Since they must have the same height according to the equations we already typed in, we can work with a single point, 2 for instance. To put the golden number in there too, we are going to define the height of point 2 so that the ratio of the area above the middle stroke and the area under that same stroke is equal to the golden number. If you remember that the substraction of coordinates allows to calculate the distance between two points, you should agree that the two areas in question have the following values: w*(y3 − y2 ) and w*(y2 − y1 ). Since the width w appears in both formulae, it will disappear completely when you take the ratio of those areas, and we can finally type in the right equation: (y3-y2)=Phi*(y2-y1); Now METAFONT has all the information it needs to locate all the points, so that we can begin drawing. The four strokes are easy to draw, just type in: draw draw draw draw 212 z1..z6; z2..z5; z3..z4; z1..z3; The first three instructions draw the horizontal strokes, the last one the vertical stroke. Let’s now label our points so that they’ll appear on the proofsheet we are going to make (we will see in another lesson how the labels command works. For now it’s unimportant): labels(range 1 thru 6); And let’s finish by displaying our beautiful job (if online display is available), send it to the file mfput.2602gf and stop METAFONT: showit; shipit; end Now if you transform the resulting mfput.2602gf file into a DVI file and display it, you should get a result identical to Figure .7. It’s done! You’ve created your first character!!!4 Let’s sum up this section by putting together all the instructions necessary to draw this E character: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Phi=(1+sqrt5)/2; w=100; h=Phi*w; y1=y6=0; y3=y4=h; y2=y5; x1=x2=x3=0; x4=Phi*x5=x6=w; (y3-y2)=Phi*(y2-y1); draw z1..z6; draw z2..z5; draw z3..z4; draw z1..z3; labels(range 1 thru 6); showit; shipit; end xEXERCISE .13: Let’s check that you have understood how things work by creating another character by yourself, in this case a simple capital A as shown in Figure .8. Like the E character defined in this section, this character must be based on the golden number, so that: • the ratio of its height by its width is equal to the golden number; • its horizontal bar is at the same height as the horizontal bar of the E character we drew earlier. To make this character comparable with the E character, you can make it with a 100-pixel width. Note that in this form, it is not possible to make an actual font out of what we wrote. We will find out later in this tutorial what we are still missing to make that possible). 213 Figure .8: A simple A character To draw such a A character, we need five points, corresponding once again to the ends of the three strokes we need to draw it. We will label those points as in Figure .9. First thing first, we need to define the golden number, as well as the width and the height of the character. This part is identical to the beginning of the definition of the E character: Phi=(1+sqrt5)/2; w=100; h=Phi*w; Then we need to position the points 1 and 5 at the bottom of the character. They are horizontally aligned at the bottom of the character and on both sides of it, separated by a distance equal to the width of the character. We could of course first indicate that they are aligned, and then give their exact position, but we can actually define them completely by a single line: z1=z5-(w,0)=(0,0); Remember that z refers to the pair of coordinates of a point, and that you can add and subtract pairs as well as coordinates themselves. We use this here to define both points in a single line. The first equality on the line says that point 1 is at w pixels to the left 214 Figure .9: A simple A character, with labels of point 5 and at the same height (by subtracting 0 on the y coordinate). The second says that point 1 is at the coordinates (0, 0), which at the same time completely defines point 5 through the first equality. We still have three points to define. Point 3 is easy to define: it must be at the full height of the character, and horizontally it is exactly in between points 1 and 5. We have already seen how to use the “t[a, b]” notation for this kind of definitions: z3=(.5[x1,x5],h); Now only point 2 and 4 are left to be defined. Since they are used to define the middle horizontal stroke, we must indicate that they are horizontally aligned: y2=y4; Now, we also know that point 2 must be on the line defined by points 1 and 3, and point 4 on the line defined by points 3 and 5. But since those lines are neither vertical nor horizontal, we cannot do that through a direct equation on their coordinates. Luckily, we remember that we have a way to indicate alignment whatever the position of the aligned points: 215 z2=whatever[z1,z3]; z4=whatever[z3,z5]; Finally, we must indicate that we want this horizontal stroke at the same vertical position as the middle stroke of the E character we created earlier. Actually, this is just a matter of copying and pasting. Indeed, “same vertical position” means that the definition we’re interested in only involves y coordinates, and thus must be identical to the definition of the vertical position of the middle stroke of the E character! ^ ¨ (y3-y2)=Phi*(y2-y1); Since the definition involves only y coordinates, the fact that the line defined by points 1 and 3 is slanted in this case, while it wasn’t in the case of the E character, doesn’t change anything. Now we can actually draw the three needed strokes: draw z1..z3; draw z3..z5; draw z2..z4; And we can finish by labelling all the points and ship the result to mfput.2602gf: labels(range 1 thru 5); showit; shipit; end And we now have our A character exactly as we wanted it! To sum up this whole exercise, here is the whole list of instructions we used to define it: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 216 Phi=(1+sqrt5)/2; w=100; h=Phi*w; z1=z5-(w,0)=(0,0); z3=(.5[x1,x5],h); y2=y4; z2=whatever[z1,z3]; z4=whatever[z3,z5]; (y3-y2)=Phi*(y2-y1); draw z1..z3; draw z3..z5; draw z2..z4; labels(range 1 thru 5); showit; shipit; end 11 Before you carry on. . . Once again, this was a heavy lesson, introducing a lot of new concepts, and asking a lot from you. But you can now breathe again: the next lessons will be lighter and more focussed in contents, thus easier to follow for you. Also, thanks to the base this lesson has provided you, you should have little trouble following the rest of this tutorial. This is why you must make sure to have understood everything which has been introduced in this lesson. So don’t hesitate to come back to it after a night of sleep, and to work on it for several days. You can also try to draw a few more characters according to the same principles, to check your understanding of METAFONT. The capital F, H, K, L, N, T, V, X, Y and Z characters are good candidates for such a work. Take that as a sort of “homework”, to do if you feel like doing it (but I strongly urge you to actually do it. The best way to learn METAFONT is by using it, and you can never use it enough ^ ¨ ). And if you want a “correction” of this “homework”, just send me what you did at [email protected], and I’ll be happy to look at your programs and correct them if necessary. You can also contact me if you have any question at this same address (or through the (La)TeX/METAFONT-for-Conlangers5 mailing list). But for now, go and have some rest! ^ ¨ http://groups.yahoo.com/group/latex-for-conlangers/ 217 Pens and Curves 1 More algebra In Lesson , we defined what algebra is, and saw some of the operations that can apply to numerical values (like the addition, the subtraction, the multiplication and the square root operator sqrt), and to pair (vectors or points) values (addition, subtraction, multiplication by a numerical value and the “t[z1 , z2 ]” operation). If those were the only operations METAFONT allows, we would be rapidly very limited in what we can do. Luckily, METAFONT provides a wide range of operations, and we are going to see a few of them here. But first, in order not to drown in operations, we need to put some order into them. An obvious way to classify operators is by the type of values they can apply to. Let’s do it this way, and let’s put our operators in three categories: • operators which apply to numerical values, • operators which apply to pair values, • angle-related operators (this category may surprise you, but you’ll see soon enough why I put them in a separate category). Note that those categories are not exclusive. Some operators, like sqrt, can apply only to numerical values. Others (that we haven’t seen yet) can apply only to pair values. But many (like the brackets operator) can apply to both numerical and pair values, just like the addition, the subtraction and the multiplication by a numerical value do. As for the angle-related operators, they are also separated into operators which apply to numerical values and operators which apply to pair values, but they are put in their own category because they use a special kind of numerical values. 1 Numerical operators Before talking about operators, let’s see two more special numerical variables METAFONT defines that can be of some use. We have already seen the special variable whatever which is used when you don’t want to specify a value. METAFONT has two other interesting variables. The first one is epsilon, which corresponds to the smallest positive value different from zero METAFONT can handle. As such, it’s also the precision of calculations with METAFONT, and 1 its value is 65536 . The second one is infinity, which despite its name is not really 219 infinite. Rather, it’s the highest value METAFONT can handle without complaining. By definition, infinity is equal to 4096 − epsilon.1 We have already seen that sqrt takes the square root of a numerical value. How about the reciprocal operation, i.e. to take the square of a value? METAFONT provides the “**” operator here, with “a**b” meaning: “a to the power of b”. So to take the square of a, just write: “a**2”. If you rather want the cube of it, simply write “a**3”. Other powers are as easily available with this operator. xEXERCISE .1: What is the value of “2**12;”? Feed METAFONT with such an expression and look at the result. Is it surprising? The value of “2**12” (of 2 to the 12th power) should be 4096. However, if you feed it to METAFONT, you will rather get 4095.99998 as a result, which happens to be the value of infinity. This is due to the definition of the “**” operator, which is defined in a way that allows non-integer powers (i.e. METAFONT allows things like “2**(1/3);”, which happens to compute the cubic root of 2) and even negative ones, but loses precision at high values. METAFONT provides the “/” operator for exact division. But sometimes you’d rather want to do an integer division. You can do that with the “div” and “mod” operations. “a div b” gives the result of the integer division, and “a mod b” its remainder. xEXERCISE .2: How would you use those operations to ensure that a number will be a multiple of another one (very easy)? You only need the mod operator for that. If a number is a multiple of another, the integer division of the first number by the other will be exact, and the remainder will be zero. So we will have the equality: “a mod b = 0”. Other practical operators are “abs”, “max” and “min”. “abs” gets rid of possible minus signs (i.e. it leaves positive numbers alone and takes the opposite of negative numbers, thereby making them positive). So for instance “abs(-7)” is 7. “max” takes a list of values between parentheses and gets the highest value in the list. ‘min” takes the lowest value instead. For instance, “max(2, 5, 8)” is 8, while “min(2, 5, 8)” is 2. xEXERCISE .3: METAFONT can handle higher values during calculations, but the final result should always be inferior or equal to infinity, otherwise it will strongly complain. 220 Give the results of the following operations: 1. 2. 3. 4. 5. 6. abs(12). 1. 2. 3. 4. 5. 6. 12. 15. 2. −5. 5. 5. abs(−15). max(−5, 2). min(−5, 2). max(abs(−5), 2). abs(min(−5, 2)). 3.1416 −3.1416 1.5 1.49 floor 3 −4 1 1 ceiling 4 −3 2 2 round 3 −3 2 1 Table .1: Comparison of the effects of “floor”, “ceiling” and “round”. Finally, despite the fact that METAFONT works happily with non-integer values, you will sometimes want to round things up (or down ^ đ ). METAFONT provides three different operators for rounding: “floor”, “ceiling” and “round”. Their differences are illustrated in Table .1. “floor” rounds numbers to the closest integer inferior to them. “ceiling” rounds them to the closest integer superior to them. As for “round”, it rounds numbers to the integer absolutely closest to them (and for numbers whose fractional part is exactly one half, like 1.5 or −2.5, it rounds them to the integer immediately superior). xEXERCISE .4: The following cases define two variables a and b. In each case, find out which of a and b has the highest value. 1. 2. 3. 4. 5. a = floor(5.8) and b = round(5.8). a = floor(−5.2) and b = round(−5.2). a = max(floor(2.8), ceiling(3.2)) and b = round(min(3.2, 2.8)). a = abs(floor(−6.1)) and b = ceiling(abs(−6.1)). a = round(.5) and b = round(−1.5) + 1. 1. a = 5 and b = 6. Thus b has the highest value. 221 2. 3. 4. 5. a = −6 and b = −5. Thus b has the highest value. a = 4 and b = 3. Thus a has the highest value. a = 7 and b = 7. Thus a and b are equal. a = 1 and b = 0 (remember that for values with a fractional part exactly equal to one half, “round” behaves exactly like “ceiling”). Thus a has the highest value. 2 Pair operators Just like with numerical values, METAFONT predefines a few practical pair values. Those are called up, down, left, right and origin, and their respective values are (0, 1), (0, −1), (−1, 0), (1, 0) and (0, 0). In other words, origin always refers to the reference point (indeed, the reference point is often called “origin”, and I will often call it that way in the rest of this tutorial), and the four other variables are best described as vectors indicating the four simplest directions (indeed, adding up to any pair simply means “move one pixel up”, and similarly with the other variables). We have already seen the “t[z1 , z2 ]” operator. This operator treats pair variables as points (it returns the coordinates of a point aligned with the two points it took as operands). Another operator also important, but treating pair coordinates as vectors rather than points, is “length”. As its name indicates, the operator “length” returns the length (a numerical value thus) of a vector. It is particularly useful because it allows you to compute the distance between two points. Indeed, remember that if you have two points labelled 1 and 2, z2 − z1 is the vector connecting the two points. So if you take “length(z2 − z1 )”, the length of that vector, you will have computed the distance between those two points. It can be very useful when you want to define a point according to its distance to another point. xEXERCISE .5: Try to guess the value of “length up”, “length down”, “length left” and “length right”. What about “length origin” (easy)? The solution should be obvious: all those vectors have for length 1. Indeed, they correspond to a movement of only 1 pixel at a time, which must correspond to a distance of 1 (if you are not convinced yet, check it on some graph paper or by running METAFONT). As for the length of origin, remember that (0, 0) can also be considered to be a vector meaning “don’t move at all”. When you don’t move, the distance you make is obviously 0. And indeed, the length of origin is 0. xEXERCISE .6: “length(z2 − z1 )” is the distance between two points labelled 1 and 2. What about “length(z1 − z2 )”? Whether you begin at point 1 to 222 reach point 2 or at point 2 to reach point 1 doesn’t change anything, if you always go in a straight line. So “length(z1 − z2 )” is also the distance between points 1 and 2. We have already seen that it’s possible to define the product of a vector by a numerical value. But is it possible to define a product between vectors? Well, not really. There is such a product, but the result of it is a numerical value rather than another vector. Such a product is called the scalar product, usually noted with a dot, and with the following definition: (a, b) · (c, d) = ac + bd In METAFONT, the scalar product is done using the operator “dotprod”, which is put between its operands. In other words, the expression above would be written in METAFONT as “(a, b) dotprod (c, d)”. Now you probably wonder what use such a strange definition could have. Well, it happens that with this definition, the scalar product of two vectors is equal to 0 when they are orthogonal, i.e. when there is a right angle between them. It means that with this product, you can easily define perpendicular lines. Imagine that you have a line defined by two points 1 and 2, and that you want to define another line, passing by two other points 3 and 4, and perpendicular to the first line. All you need is to enter the equation “(z2 − z1 ) dotprod (z4 − z3 ) = 0”, and you will be sure that there will always be a right angle between those two lines. 3 Angle operators All the operations we have seen until now refer to numerical values taken as lengths and distances. But in geometry, another important kind of numerical values are angles, and many geometrical operations involve angles rather than distances. In METAFONT, angles are just numerical values. They are not formally differentiated from length values. However, they are treated differently by operators which expect to receive angle values. The main difference is that METAFONT measures angles in degrees, so a numerical value used as an angle value will be taken to be degrees rather than pixels. What it basically means is that you shouldn’t mix length and angle values, and thus shouldn’t use the same variable as an angle value and as a length value at the same time. You will only create confusion, for yourself and for anyone reading your code. The basic operators involving angles are of course the cosine and the sine. They are called “cosd” and “sind” respectively in METAFONT (the ‘d’ is there to remind you that angles in METAFONT are measured in degrees, rather than radians for instance). However, you will probably hardly ever use them in a METAFONT program. That’s because METAFONT provides two other operators which will usually be enough for any font designer. Those operators are called “dir” and “angle”. “dir” takes as value an angle, and returns a vector of length 1 which is at the angle you defined with a horizontal line (note that angles in METAFONT are measured positively counterclockwise, and that 0 corresponds to the horizontal position pointing to the right. It means that with a positive angle—at least one between 0 and 180◦ —the vector will point upwards, and 223 downwards with a negative angle). So for instance, up can be alternatively defined as “dir 90”. “angle” is the reciprocal operation: it takes a vector as operand, and returns the angle this vector makes with horizontality, with angles once again measured positively counterclockwise. So the expression “angle up” will return 90. xEXERCISE .7: Try to guess the results of the following expressions: 1. dir 25 dotprod dir 115. 2. angle (1, 1). 3. angle (0, 0). 1. 0. Indeed, angles can be added and substracted, and if two vectors make respectively an angle of 25 and 115 degrees with horizontality, it means that the angle between those two vectors is 115 − 25 = 90, i.e. those vectors are orthogonal. So their scalar product must be 0. 2. 45, i.e. exactly half a right angle. 3. This is a trick question. Indeed, since (0, 0) has a zero length, it cannot make an angle with anything! ^ đ METAFONT recognises that by returning the value 0, but with an error message. So if you want to use the “angle” operator with a vector, you should try to make sure this vector is not (0, 0). 2 Transformations Until now, we have only seen algebraic operations, i.e. operations which apply to values, whether numerical or pairs, but have no other meaning then that. Transformations are something different. Transformations are geometric operations, i.e. operations whose purpose is to modify the shape and/or position of a figure. As such, they cannot apply to numerical values at all, but only to pair values, whether those are to be taken as points or vectors. Transformations can of course be described as algebraic operations (that’s after all the main point of Cartesian geometry to describe everything geometric in algebraic terms), but this is only a description. Transformations have mainly a geometrical definition, and it’s best to introduce them that way. Indeed, the way they work in METAFONT allows you to concentrate on the geometrical meaning of those transformations rather than their algebraic details. All transformations in METAFONT have a similar syntax: “pair value transformed some parameter(s)”. It means that the transformation must always be put behind the pair value it applies to. There are two transformations you have actually already been introduced to without realising it. Those are called “shifted” and “scaled” in METAFONT. “shifted” takes a vector as parameter and, when applying to a pair value, moves it by the amounts defined by the vector. As such, it is in fact completely identical to the addition of pairs. Indeed, we have: “(x, y) shifted (a, b) = (x + a, y + b) 224 = (x, y) + (a, b)”. As for “scaled”, it takes a numerical value as parameter, and multiplies both coordinates of the pair it applies to by this value. As such, it is identical to the multiplication of pairs by a numerical value: “(x, y) scaled s = (sx, sy) = s(x, y)”. A reason why it is preferable to use the transformations rather than the simple operations is that their syntax makes it clearer which kind of geometric transformation we are talking about. Other reasons will become clear in the rest of this tutorial. (a) (b) Figure .1: Examples of (a) “shifted” and (b) “scaled” transformations. “scaled” multiplies both coordinates of a pair by the same value. As such, it effectively scales figures with the same coefficient in both the horizontal and the vertical direction. But sometimes, you want to stretch or shrink a figure only horizontally, or only vertically, or in both directions but with different coefficients in each direction. METAFONT provides the transformations “xscaled” and “yscaled” for this job. They work like “scaled”, but they apply only to one coordinate of a pair, the one in their name. So “(x, y) xscaled s = (sx, y)” and “(x, y) yscaled s = (x, sy)”. And if you want to apply two different coefficients to the coordinates at the same time, just put the two transformations one after the other. It’s one of the advantages of the syntax of transformations that you can concatenate them as you wish: “(x, y) xscaled s yscaled t = (sx, ty)”. xEXERCISE .8: When you concatenate “xscaled” and “yscaled” together, you can do that in any order without changing the result (“xscaled s yscaled t” is the same as “yscaled t xscaled s”). But is it true in general? Is the result of two transformations always independent of their order? The solution in one word is: no. It’s easy to find a example: (x, y ) shifted (a, b) scaled s = (x + a, y + b) scaled s = (s(x + a), s(y + b)), 225 Figure .2: Examples of “xscaled” and “yscaled” transformations. but: (x, y ) scaled s shifted (a, b) = (sx, sy ) shifted (a, b) = (sx + a, sy + b), obviously two quite different results! As you see, the order in which the transformations are given is important to understand their final result. You just have to read the transformations as they are given, step by step from left to right, to understand their result. With concatenations of shifts and the different kinds of scaling you have been introduced to, you can accomplish quite a lot already. But you will always be quite limited in what you can do unless you introduce rotations. Rotations, which consist in turning a figure (while keeping all its dimensions equal) around some point, are one of the most important and practical transformations there are. Of course, METAFONT provides rotations. Actually, it provides us two rotation instructions. The first and simplest one is “rotated”. It takes an angle as parameter and means: “rotate the point around the reference point (the point of coordinates (0, 0)) by the given angle”. As usual, angles are measured positively counterclockwise. The second instruction is “rotatedaround”. It takes two parameters: a pair and an angle. They must be separated by a comma and put in parentheses (as such: “rotatedaround (z1 , 90)”). The angle has still the same meaning, while the pair gives the coordinates of the point around which the rotation has to be done. In other words, “rotated” is actually a special case of “rotatedaround” (indeed, “rotated angle” can be simply defined as “rotatedaround ((0, 0), angle)”). Nevertheless, it’s a practical shortcut. 226 Figure .3: Examples of “rotated” and “rotatedaround” transformations. xEXERCISE .9: Guess the result of “right rotated 90”. What about “right rotated −90”? By rotating right by 90° counterclockwise around the reference point, you simply reach up. Similarly, by going clockwise (which is the meaning of using a negative angle), you just reach down. Last, but certainly not least, a very important transformation, very useful when you create shapes with mirror symmetries, is the reflection, which consists in taking a point directly opposite to another point on the other side of a line (see Figure .4 to understand how it works). It is so important that the general term “symmetry” is usually used by people to refer exclusively to reflections, and objects are called “symmetric” when they are unchanged through reflection about a certain line. For this purpose, METAFONT provides us with the “reflectedabout” transformation, which takes as parameters two pair variables, which represent two points defining the reflecting line. Those two variables must be separated by a comma and between parentheses. xEXERCISE .10: List all the possible transformations which would transform a point of coordinates (x, y) into a point of coordinates (−x, −y). The two most obvious solutions to this problem are “(x, y) rotated 180” and “(x, y) scaled −1”. Of course, you can also choose inefficiency and write “(x, y) rotatedaround ((0, 0), 180)” and “(x, y) 227 Figure .4: Examples of “reflectedabout” transformation. xscaled −1 yscaled −1”, which are just longer ways to write the same things as above. ^ đ But that’s not all! Nothing says that your transformation cannot depend on the coordinates of the point! In that case you can also write “(x, y) shifted (−2x, −2y)”! And if you are not afraid of letting METAFONT make a few calculations, you can even transform (x, y) into (−x, −y) through a reflection! Indeed, remember the “dotprod” operation, which can be used to define orthogonal vectors, i.e. perpendicular lines. And as it happens, by definition of the reflection, the reflection line must be perpendicular to the line defined by a point and its image by the reflection. So if you define a line perpendicular to a point and its image and passing exactly in the middle between those two points (in our case, passing by the origin), you will have the line necessary for your reflection. This can be done with the following instructions: z 1 dotprod ((x, y ) − (−x, −y )) = 0; y1 = y; Once done, as you can see in Figure .5, “(x, y) reflectedabout (z1 , (0, 0))” will indeed be (−x, −y). Of course, the last two possibilities, and especially the last one, are extremely contrived. Nobody in the right mind would want to 228 Figure .5: A reflection transforming (x, y ) into (−x, −y ). transform a point into its exact opposite around the origin through such complicated operations! So for actual use, you are of course urged to use the simple transformations given as first answers. They are quick to type, and they don’t depend on the actual coordinates of the point to work correctly! ^ ¨ With those transformations, you are now equipped to define point positions quickly and correctly by just translating into instructions the general characteristics of the characters you want to draw. It is thus time to learn a bit more about drawing with METAFONT. 3 Curved lines Curved lines, also simply called curves, are lines which are not straight. OK, this is a rather silly definition, but I just wanted to make sure that it was clear for everyone what I was talking about. In this tutorial, as you have probably guessed by now, I usually reserve the word “line” to refer to straight lines only, and use the word “curve” for curved ones. This is different from the usual use of the word “line”, which in common speech refers to any kind of line, bent or not.2 Let’s hope that with this paragraph the distinction I make between lines and curves will now be clear. ^ ¨ Until now, we have seen only how to draw straight lines (use the draw instruction with the coordinates of the extremities of the line separated by “..”). However, in Section 4, we have had a glimpse of how to draw curves. In the “Smile!” example, the actual smile was a curve drawn by the instruction: Note that my use of the words “curve” and “line” is strictly personal and in no way representative of some metaphysical distinction METAFONT would do between straight lines and bent curves. Indeed, METAFONT doesn’t make a distinction at all and treats all curves and lines identically. 229 draw (20, 40)..(50, 25)..(80, 40); As you see, draw is here followed by the coordinates of three rather than two points, also separated by “..”. This is the very secret of the powerful draw command of METAFONT. You can feed it with any number of coordinate pairs (always separated two by two with “..”), and it will draw a smooth curve passing by all those points (in the order you typed them in) as well as it can! Check Figure .6 to see the draw command in action. draw z 0 ..z 1 ..z 2 ..z 3 ..z 4 ..z 5 ; draw z 0 ..z 1 ..z 2 ..z 5 ..z 4 ..z 3 ; draw z 0 ..z 5 ..z 2 ..z 1 ; (a) (b) (c) draw z 0 ..z 5 ..z 4 ..z 2 ..z 0 ; draw z 0 ..z 5 ..z 3 ..z 4 ..z 2 ..z 1 ; draw z 0 ..z 2 ..z 4 ..z 3 ..z 5 ..z 1 ; (d) (e) (f) Figure .6: Examples of curves and the commands that drew them. As you see in those examples, METAFONT doesn’t mind bending the curve quite a lot to get a very smooth result. That’s because as it is used right now, it will always construct curves where bending is minimal at the positions of the given points (you can check on Figure .6 that when a curve passes by one of the labelled points, it will do that as straightly as possible). Another rule that METAFONT uses when it draws curves is that between two consecutive points given in the draw command, it will try to draw a curve without inflection point, i.e. a curve which bends in one direction only.3 METAFONT will break this rule only when it has no other way to keep the curve smooth (as in (b)). This explains why in (f), METAFONT drew such a large loop between points 0 and 2, and between points 5 and 1. A more direct curve between those points would have created an inflection point, and there was a better (in METAFONT’s point of view) way to keep a smooth curve. On the other hand, METAFONT has no problem creating an inflection point at the position of a point given in the draw command. Look for instance at point 5 of (d). Try to remember those two drawing rules. They will help you correctly translate the curves you want to draw into METAFONT instructions. an inflection point is a position on a curve where bending changes direction. The middle of the letter S is a good example of inflection point. 230 xEXERCISE .11: Check Figure .7. Where would you put the additional points necessary to draw such a curve? (hint: only 2 additional points are necessary) You only need to give a qualitative description of the positions of the additional points. Figure .7: A nice loop. Doesn’t it remind you of something? ^ đ Once you have chosen the additional points, write down the instruction that will draw the curve. It’s the perfect moment to remember the two principles METAFONT uses when it draws its curves. The first one is that it will draw curves which are flatest at the position of the points you gave in the draw instruction. To draw our loop as it is presented, you must thus choose points that are positioned at the flatest places on the curve. There are four such positions: • on top of the loop; • at both sides of the loop; • where the curve crosses itself. You may think the best idea would be to choose the positions on the sides of the loop. This way, by labelling the point most to the right 231 1 and the point most to the left 2, you could draw the curve with the simple instruction: draw z 0 ..z 1 ..z 2 ..z 3 ; However, by doing so you forget the second principle of METAFONT: it will avoid inflection points at other positions than the ones of the points you gave yourself at nearly any cost. As you see in Figure .7, there is an inflection point (or rather two, if you take the point of view of a small ant which would follow the curve starting from point 0 and ending at point 3): the position where the curve crosses itself. So if you chose the side points, METAFONT would not draw the curve as it was asked. Instead, you would end up with the curve of Figure .8. Figure .8: The wrong loop. So which points must we use instead? Well, the obvious choice, since we do want the inflection point, is to choose that point (let’s label it 1). Indeed, it’s a good design principle to remember: each time you want to draw a curve with an inflection point, choose it as one of the points you will put in your draw instruction. This is the only way to get the result you want. As for the second point, the only choice left is the top of the loop (choosing a side point would have resulted in an asymmetric curve, not what was intended). We will label it 2. And indeed, choosing those two points is the only 232 way to get the loop as it is drawn. You can check Figure .9 to see exactly the positions of those two points. Figure .9: The right loop, with all the necessary points labelled. Now for the exact instruction necessary to draw this loop, you have to remember that you want the curve to cross itself for sure at point 1. The only way to achieve it correctly is to mention point 1 twice in your drawing instruction. So the correct instruction (as you must have guessed by now) is: draw z 0 ..z 1 ..z 2 ..z 1 ..z 3 ; The draw instruction is very powerful. However, if you have tried your hand at a few curves, you have probably noticed that it is sometimes too powerful, in the sense that METAFONT makes decisions about the shape of the curve you want to draw which are against what you meant. That’s actually logical: giving just the position of a few points is quite little information, and METAFONT cannot read your mind! ^ ¨ From the positions of the points you gave, it will try to make a nice and smooth curve, but that will be according to its own criteria, since it has no way to guess yours. The result is that it will sometimes draw things differently from what you expected. 233 So does that mean that METAFONT is the boss and that we can only accept its ideas and hope that they sometimes look enough like ours? Of course not! METAFONT is just a computer program, and will do as we want, if we tell it to obey us. In other words, if you want METAFONT to draw exactly the curve you want it to draw, you’ll have sometimes to give it more information than just the positions of the points. How do we do that? Well, there are various ways, and we will see only two of them in this lesson. We will learn more about those methods of control in later lessons. The most obvious way to control the shape of a curve is to specify its direction (or slope) at some point(s). METAFONT allows you to specify the direction the curve will take when it passes by the points you use to define your curve (in other words, in order to control the slope of the curve at some position, you need to put the coordinates of that position in your draw command). Specifying the direction itself is easy when you remember that coordinate pairs aren’t only used to define point positions, but can also be used to define vectors, i.e. displacements. And since displacements are always done according to a definite direction, using vectors to specify directions is just natural. And indeed, to specify a direction at some point named z in your draw command, you just need to put a coordinate pair, which will be interpreted as a vector, in curly braces “{}”, and put the whole thing next to z (nothing can go in between, especially not “..”!). Here is how this syntax looks like: draw <something >..{(a, b)}z..<something else>; or draw <something >..z{(a, b)}..<something else>; where (a, b) is a coordinate pair defining a vector. For now, don’t worry about the position of the {(a, b)} part. It doesn’t change anything if you put it before or after the point coordinates (note, however, that if you put such a direction specification with the first point coordinates of your draw instruction, you can only add it after the point coordinates. A syntax like: draw {(a, b)}z..<something >; will result in an error). Now, you may think that it’s great, but defining directions with pair coordinates is not that simple. After all, you probably can’t see at first sight what direction corresponds to a vector of coordinates (−5.8, 12.3), and what vector corresponds to a direction at 13.5° up from the horizontal, pointing to the left. Well, it’s time then to remember Subsections 2 and 3, where you were introduced to a series of predefined pair values and operators which are there to take care of this job. If you need a simple direction, use the vectors up, down, left and right, whose names correspond exactly to the directions they define. Remember also that if you have two points labelled 1 and 2, z2 − z1 is the vector corresponding to the displacement between point 1 and point 2, in the direction of point 2. You can use this at your advantage if you want to force a curve to go in the direction defined by those two points. And finally, if you know the angle the direction you 234 want the curve to take has with the horizontal, don’t hesitate to use “dir” to create a unit vector defining that direction. As you see, you already have all the tools necessary to define directions without having to know exactly how to relate the coordinates of a vector to the direction it defines. xEXERCISE .12: Answer the following questions as precisely as possible: 1. What is the difference between the directions defined by {left} and {right}? 2. What direction is defined by {up + right}? 3. What is the difference between the directions defined by {up} and {10up}? 1. {left} and {right} both define a horizontal direction, and thus will force the curve to be horizontal at the point where they are specified. But {left} also indicates that the curve will have to go from right to left when it passes the specified point, while {right} forces the curve to go from left to right at that point. So {left} and {right} define both horizontal directions, but of opposite sense. Check Figure .10 to see what tremendous consequences the difference of sense can have for the overall shape of a curve. draw z 0 {up}..{left}z 1 ..{down}z 2 ; draw z 0 {up}..{right}z 1 ..{down}z 2 ; Figure .10: An example illustrating the difference between {left} and {right}. 2. up is a vector meaning: “move 1 pixel upwards”, while right means: “move 1 pixel to the right”. If you remember that the addition of vector is simply the addition of displacements one after the other, up + right means: “move 1 pixel upwards then 1 pixel to the right.” You can check on some graph paper that this corresponds to the direction exactly in between the 235 upwards and rightwards directions, i.e. at 45° from the horizontal, pointing to the right. In other words, writing {up + right} is exactly equivalent to writing {dir 45}. 3. None! The direction a vector defines is independent from its length (up and 10up both point exactly upwards, regardless of the fact that one is 10 times as long as the other), so {up} and {10up} both define exactly the same direction. This means that you needn’t worry about the length of your vectors when you define directions4 (at least the length of the resulting vector, when it results from a calculation. But inside the calculation the lengths of the vectors are meaningful: up + right defines a different direction from 10up + right). xEXERCISE .13: We have four points, labelled from 0 to 3, whose respective coordinates are given by the following lines: z0 z1 z2 z3 = (0, 0); = (100, 100); = (50, 60); = (120, 10); We want to draw a curve going from point 0 to point 1, passing exactly by the middle between points 2 and 3 and being at that point perpendicular to the line defined by those points 2 and 3. Write the instructions necessary to define the middle point between points 2 and 3 (that you will label 4) and to draw the wanted curve (hint: you only need to write two instructions). At first sight, this problem probably looks impossible to solve, especially with only two instructions. And with any other programming language, it would probably be unsolvable indeed. But we’re using METAFONT here, which has been designed to make such actually common problems easy to solve. Firstly, it’s very easy to define the middle point between two points. You just need to remember the brackets notation, which allows you to define any point on the line defined by two other points. In our case, we can define point 4 as the middle between points 2 and 3 through the instruction: z 4 = .5[z 2 , z 3 ]; Just make sure your vector does have some length. A vector of length 0 like origin cannot define any direction, and thus something equivalent to {origin} will just be ignored by METAFONT . 236 The second instruction we have to write is obviously the actual drawing instruction, which will be in the form “draw z0 ..{. . .}z4 ..z1 ;”, where . . . will have to be replaced with a vector indicating the actual direction the curve takes at point 4. How are we going to define this vector? Well, we want this vector to be perpendicular to the line defined by points 2 and 3. So a good place to start is with the vector z3 − z2 , which defines the direction of that line. You may be thinking of defining a vector orthogonal to that one using the “dotprod” operator. It is indeed a possibility, but you would have to write a few instructions more to implement it, and we don’t want that. So we need something simpler. And when you want to do things simple with directions, the first thing you should think about is. . . angles. Indeed, having perpendicular curves means having a right angle, i.e. an angle of 90°, between them. So if we could get the angle of the direction defined by z3 − z2 and add it 90, we would get the direction we want, and could transform it into a vector with “dir”. Well, that’s what “angle” is for! So “angle(z3 − z2 ) + 90” (Note the presence of parentheses. The “angle” operator doesn’t need them per se, but they are there to make sure that it will take the full expression z3 − z2 as operand, and not just z3 . Otherwise the expression would be interpreted as “(angle z3 ) + z2 + 90”, and would result in an error, since you can’t add together numerical values and pair values. We will see in a later lesson how METAFONT treats priority between operations, but for now don’t hesitate to add parentheses to make sure an expression will be treated as one by what’s around) is the angle of the direction we want the curve to take at point 4, and we can replace the . . . in the drawing instruction as follows: draw z 0 ..{dir(angle(z 3 − z 2 ) + 90)}z 4 ..z 1 ; Figure .11 was drawn using the two instructions we defined. You can check on it that the curve does indeed pass exactly between points 2 and 3 and perpendicularly to the line defined by those two points (which has been drawn too to make the orthogonality more obvious). Let’s sum up by giving together the two instructions solution of this exercise: z 4 = .5[z 2 , z 3 ]; draw z 0 ..{dir(angle(z 3 − z 2 ) + 90)}z 4 ..z 1 ; So, now you can control the shape of your curves, but you are still limited by the fact that whatever you do, your curves will always be open. Even when you make the curve end at the point where it began, like in Figure .6 (d), the resulting curve will usually not be smooth at that point. That’s because METAFONT doesn’t care if it goes more than once through the same point. Each time 237 Figure .11: The resulting curve. it will be treated independently from the other times. So how do you do to draw an O, or an 8, or for that matter any closed shape? Well, your first idea, based on what we’ve seen until now, could be to fix the direction the curve has to take on the point where the curve starts end ends (i.e. force the same direction on starting and ending). For instance, taking again the example of Figure .6 (d), if you write: draw z 0 {right}..z 5 ..z 4 ..z 2 ..{right}z 0 ; you will end up with a curve which looks smooth and closed (see Figure .12 for the result of that draw command). The problem with this approach is that it obliges you to control the direction of the curve at its starting point, something that you may not want to do (you may not even know how to describe the direction the curve should take). You could always, by a process of trial and error, find the right angle and use “dir”, but this would be bad programming, especially since if you decided to change the position of some points of the curve, you would probably have to change the angle you chose, again through trial and error. Not much meta-ness in this! ^ đ Of course you could always calculate that direction, but this would often ask you for a lot of work, and sometimes it would just be impossible to do.5 OK, so I’ve been thoroughly explaining why the previous approach is wrong and impractical, but I’ve not yet given an alternative. How on earth are we going to make closed curves then?! Well, METAFONT has a simple way to do that. Instead of mentioning twice the same point, at the beginning and the end of Moreover, METAFONT would still treat the curve as open, even if it looks closed. METAFONT doesn’t care what the curve looks like. It considers a curve with a starting point and an ending point as open, even if those two points are the same. For now, you needn’t care about it, but in later lessons you will learn that it’s important to know what METAFONT considers open and closed. 238 Figure .12: The resulting closed-looking curve. the draw command, replace the last mention with “cycle”. The presence of this word will tell METAFONT that we want to draw a closed curve, and it will automatically connect the last point mentioned before “cycle” with the first point of the curve, and in a smooth way.6 So if we take our example again, we will write: draw z 0 ..z 5 ..z 4 ..z 2 ..cycle; and we will get the shape you can see on Figure .13. It is quite different from the shape on Figure .12, because you let METAFONT decide the direction the curve would take at point 0, and since there was a symmetry in the positions of the points describing the curve, it drew it according to this symmetry. xEXERCISE .14: Use everything you have learned in this section to write a program which draws a vertical closed 8 shape. The only conditions are that the shape must be 200 pixels high and that you must try to use as few points as possible to define your curve. Check out Figure .9, as it nearly gives away a solution to this exercise. ^ ¨ Indeed, if you take points 0 and 3 of that figure and bring them together just under the two other points, the loop you have would close and look like an 8 shape. This means that you can define your curve with only three points: the bottom point, the middle point (where the curve crosses itself) and the top point. They have And METAFONT will internally treat the curve as closed. 239 Figure .13: The curve, as drawn using “cycle”. the same x coordinate (since they are vertically aligned), so you can just put it at 0 for simplicity: x 0 = x 1 = x 2 = 0; (don’t forget that you can define the two coordinates of a point separately). As for the y coordinate, let’s make the whole thing symmetric and put point 1 at the middle between point 0 and point 2: y 0 = y 2 − 200 = 0; y 1 = .5[y 0 , y 2 ]; Of course, this is only one way to define the point coordinates, and you could simply have defined them more directly than I did. Now comes the drawing instruction. Since we want a closed curve, we know that it will end in “..cycle”. And since we want the curve to cross itself at point 1, we will refer to z1 twice in the instruction. You might be tempted to write simply: “draw z0 ..z1 ..z2 ..z1 ..cycle;”. Unfortunately, the shape that would result from this instruction would only vaguely look like an 8 shape, and looking at it closely you would realise that it actually doesn’t cross itself at all (try it if you don’t believe me ^ ¨ ), merely comes in contact with itself at point 1. So how can we ensure that the curve actually crosses itself? Simply, by specifying the direction it takes at points 0 and 2. Indeed, if we force the curve to run from left to right (by giving it the “{right}” direction) both at points 0 and 2 (or from right to left, as long as both points receive the same direction), you will oblige the curve to cross itself, as it’s the only way for it to obey the slopes you im- 240 posed (try it yourself on a piece of paper. If you force yourself to draw a closed shape through two points vertically aligned while going from left to right at both points, the only way to do it is to make an 8 shape). So the correct drawing instruction is: draw z 0 {right}..z 1 ..z 2 {right}..z 1 ..cycle; And you can see the result on Figure .14. Figure .14: The resulting 8 shape. But wait a second! According to the previous paragraph, specifying the same direction on the bottom and top point should be enough to force the curve to take an 8-like shape. The middle point shouldn’t be necessary at all! So what would happen if we didn’t mention the point 1 in the drawing instruction, i.e. if we wrote instead: draw z 0 {right}..z 2 {right}..cycle; You can see the result of that instruction on Figure .15. This is indeed a curve which crosses itself exactly at the middle between the definition points, but its shape is a little less 8-like, and it looks a 241 little like a sandglass. Why the presence or absence of the middle point in the drawing instruction results in such different curves is a complicated matter which has to do with the mathematical definition of the curves as they are handled by METAFONT. You needn’t really worry about it. Just remember that METAFONT’s idea of the “best” curve following your instructions is not always what you expect, and that METAFONT is very sensitive to the curve definitions you give. Figure .15: A sandglass-looking shape. In any case, the 2-point solution to this exercise was not necessary to pass it. If you found its 3-point solution, you have correctly solved the exercise already. 4 Pens If you have been curious enough to try and reproduce some of the figures you’ve seen until now, you must have noted that your results, while correct in shape, are slightly different from what have seen in this tutorial. Namely, the curves you have produced are thicker. For instance, if you tried to reproduce the closed shape in Figure .13, what you have obtained was probably closer to Figure .16. And you have been especially unable to reproduce the figures using thin lines 242 that are present in this tutorial. Yet I have produced all those figures with METAFONT exclusively. So what have I done to get lines of a different thickness from what you get? Figure .16: A thick closed curve. If you know a little about how computers work, and especially how they do graphics, you probably have realised that the way I’ve been explaining how METAFONT handles graphics is a metaphor, namely the metaphor of drawing. Indeed, METAFONT is not a man behind a desk with a sheet of paper in front of him. It’s a program, and all it does when handling graphics is handle a grid of pixels, small units of space which have only two states: white or black. And what METAFONT does is tell which pixels are black and which ones stay white. However, the metaphor of drawing is very useful, because from our perspective it looks exactly as if METAFONT was actually a man behind a desk drawing on a piece of paper what we order him to draw. It’s not for nothing that the main drawing instruction is called draw. ^ ¨ For instance, just as when we are drawing by hand, METAFONT’s curves behave just as if they are drawn in a certain sense, from one point to the other (the order being of course the order of the points as given behind the draw instruction). This explains why adding a direction as a vector between braces works as we expect it, and why giving an opposite sense can modify a curve so strongly (just check again Figure .10), and exactly the same way as it would do if you draw the curve yourself by hand. But this metaphor of drawing can be further extended. Indeed, when you want to draw something, you need not only your hand and a piece of paper, but also a pen, without which you could never mark anything on the paper! And depending on the kind of pen you’re using (a pencil, a ballpoint pen, a fountain pen, or one of those fancy calligraphic pens with special tips), you will get different results, even if the shape you draw is always the same. Well, in METAFONT you just do exactly the same! METAFONT has a command called pickup that allows you to choose the pen it will use to draw the curves you ask it to draw with the draw command. By using it, you can specify a pen whose tip is more or less big, 243 more or less circular (or of some other shape) etc. The pickup command must simply be followed by the name of the pen you want to use. But to choose a pen, you need pens to choose from! Well, it’s no problem, because METAFONT has a few predefined pens ready for use, besides the default pen that it automatically uses when you don’t pick up another one, and that you’ve been using until now. The two main predefined pens, that you will mostly use, are called pencircle and pensquare. They correspond respectively to a pen whose tip is a circle of 1 pixel of diameter and a pen whose tip is a square of side 1 pixel. Check out Figure .17 to see a familiar shape drawn this time using those very thin pens. They were drawn by adding respectively “pickup pencircle;” and “pickup pensquare;” in front of the actual drawing instruction. (a) (b) Figure .17: The same loop as before, but drawn with (a) pencircle and (b) pensquare. Now, for how useful tiny pens can be, what we want usually is bigger pens, i.e. pens with a bigger tip, like the ones I’ve been using myself. But how can you get such pens when all you have is pens with very small tips? The answer is actually quite simple: transform them! Yes, you understood correctly. All those transformations that we’ve seen in Section 2 can apply not only to pair values, but also to pens! Or at least, the transformations that are meaningful in this situation can be applied here. Indeed, since our goal is to change the shape and/or size of our pens, a transformation like “shifted”, “rotatedaround” or “reflectedabout” is useless. However, “scaled” (to change the global size of our pentip), “xscaled” and “yscaled” (to stretch our pentip on one direction only) can be usefully used with pens. For instance, by specifying: 244 pickup pencircle scaled 10; you create a pen whose tip is a circle of 10 pixels of diameter. If you write: pickup pensquare xscaled 20; you will obtain a pen with a rectangular tip 20 pixels wide and 1 pixel tall. And you can of course concatenate transformations, like in: pickup pencircle xscaled 10 yscaled 35; which makes subsequent drawing done with a pen whose tip is ellipsoidal, with a horizontal axis 10 pixels long and a vertical axis 35 pixels long. Check out Figure .18 to see how different pens can really change how otherwise identical curves look like. xEXERCISE .15: List all the ways to pick up a 5-pixel-high, 20-pixel-wide, ellipsoidal pen. The most obvious way to pick up such a pen is of course to use the “xscaled” and “yscaled” transformations with a pencircle, as such: pickup pencircle xscaled 20 yscaled 5; It is the easiest (and most advisable) way to do it, but certainly not the only one! Indeed, you can also use “scaled” itself together with a combination of “xscaled” and “yscaled” to obtain the same result. For instance, since the smallest dimension of the wanted pen is 5 pixels, you can first scale pencircle by 5, and then stretch it horizontally by a factor of 4 to obtain the wanted ellipsoidal pen: pickup pencircle scaled 5 xscaled 4; You can also scale it first by the biggest dimension (here 20) and then shrink it vertically by scaling with a fractional factor: pickup pencircle scaled 20 yscaled .25; You could even go wild and make something strange like: pickup pencircle scaled 56 xscaled 5/14 yscaled 5/56; 245 Go ahead, make the calculations, and you’ll see that it does create a 5-pixel-high, 20-pixel-wide pen. Depending on the factor you first put with “scaled”, you actually have an infinity of possibilities which all result in the wanted pen. But if you find them silly, don’t worry: you’re not the only one! ^ đ The first three propositions were the only ones necessary to correctly solve this exercise. ^ ¨ However, if all you can do is scaling pencircle and pensquare, you’ll rapidly be limited in what you can do. Even when scaling with different factors horizontally and vertically, all you can get is horizontal or vertical pens. And if you know a little about calligraphy, you know that what influences most the looks of letters, besides the shapes of the curves, is the position of the thin and thick strokes. And what fixes their positions is the angle the pen nib makes with horizontality. Calligraphers will turn their pens differently depending on the result they want to achieve. And it’s something METAFONT can easily do by rotating its pens. Indeed, although the “rotatedaround” transformation cannot be used with pens, the “rotated” transformation can, and has the expected effect of putting the pen nib at an angle with horizontality. Figure .19 shows the effect the angle alone of a pen can have on the looks of otherwise identical curves. xEXERCISE .16: Imagine that you want to pick up a rectangular pen 20 pixels wide and 2 pixels high (a very thin pen thus). However, you want it tilted, so that its longest side will be perpendicular to the direction defined by two points 1 and 2. Note that we don’t give any condition on the positions of those two points, only that they have already been defined before you pick up the pen. How would you solve this problem? Defining a rectangular 20-pixel-wide 2-pixel high pen is easy. The line “pensquare xscaled 20 yscaled 2” solves that problem. However, you still have to add a “rotated” transformation to finish the job. But how do we find the correct angle of rotation? This problem is actually trivial if you remember the beginning of this lesson, where we defined the “angle” operator. Remember also that when you have two points labelled 1 and 2, the quantity z2 − z1 is a vector whose direction is the one defined by the two points, and that for this reason “angle(z2 − z1 )” is the angle this direction makes with horizontality. And in order to have your pen perpendicular to that direction, you just need to rotate it by that angle plus 90°. So you finally pick up the correct pen through the following command: pickup pensquare xscaled 20 yscaled 2 rotated (angle(z 2 − z 1 ) + 90); Note the use of parentheses to make sure that the addition is correctly interpreted. 246 5 Once more, with character! Okay, I guess you’re all anxious to use your new knowledge to draw more characters, so let’s stop here for now and let’s come back at our characters. Let’s first look back at our E from Section 10. It’s not bad, but it lacks something. So far, its shape has been based on the golden number, but it has been drawn with the dumb plain circular default pen. Let’s give it more class: let’s draw it with a pen whose nib is also completely based on the golden number! To do that, we simply need to add a pickup command somewhere before the first draw command used to draw the character. Since we are not doing anything special, we will put it just before that first draw command. Of course, this is the easy part. The difficult part is the actual definition of the pen we will pick up. First, we need to choose a predefined pen to start with. We want our strokes to have smooth ends, so we shall start with a pencircle. The first thing we need to do is to get it somewhat bigger, so we scale it: pencircle scaled 15 But we said we didn’t want a plain circular pen, and we want it to be in some way based on the golden number. We can easily fulfill both those conditions, if we make the pen wider, and have its ratio width/height to be equal to the golden number. Since we already scaled it equally in width and height, it’s easy to obtain that by scaling it horizontally with the golden number, by adding to it: xscaled Phi (remember that it’s what we called the variable containing the golden number). Finally, we can get a nice calligraphic effect if we rotate our pen a little. We can do that by using “rotated”, but first we need to define an angle. Defining an angle based on the golden number can be done in many ways, but we want something simple that doesn’t need an extra line of calculations. In this case, we are just going to define a simple vector with one of its coordinates being the golden number and the other being 1, and get its angle with horizontality through the “angle” operator. So we simply add: rotated angle (Phi, 1); Thus, when we add all those commands together, we finally get the following line: pickup pencircle scaled 15 xscaled Phi rotated angle (Phi, 1); and if we add this line to the original program used to draw our E character, we get: 1 2 3 Phi=(1+sqrt5)/2; w=100; h=Phi*w; 247 4 5 6 7 8 9 10 11 12 13 14 15 16 y1=y6=0; y3=y4=h; y2=y5; x1=x2=x3=0; x4=Phi*x5=x6=w; (y3-y2)=Phi*(y2-y1); pickup pencircle scaled 15 xscaled Phi rotated angle (Phi,1); draw z1..z6; draw z2..z5; draw z3..z4; draw z1..z3; labels(range 1 thru 6); showit; shipit; end The result of this program is shown in Figure .20. If you compare it with the original character in Figure .7, although the positions of the contruction points and the drawing instructions didn’t change, changing the pen has resulted in quite a different overall shape for our character. It now has vertical strokes slightly thicker than horizontal strokes, and the stroke ends have quite a different shape. But the effects of changing the pen shape are even more obvious on characters with oblique strokes like the A character you had to draw as an exercise. If you apply the pen we just defined to it (I won’t show the resulting program here, as adding a single line should now be obvious), you get Figure .21. If you compare it with Figure .8, the difference is striking. A letter that looked quite plain looks already much richer, and that only by drawing it with a different pen! ^ ¨ However, as you’ve seen in Figure .19, you can only truly measure the effects of calligraphic pens when your character contains curves rather than only straight lines. And since we saw how to draw those curves, let’s draw our first character with curves. The D is a good one to begin with. It is relatively simple, yet not as obvious as an O. Since we want it to fit well with the E and A we defined before, we begin with defining the same dimensions as we defined for them, and we will base the other points on them: Phi=(1+sqrt5)/2; w=100; h=Phi*w; The next step is to define the construction points. The first question to answer is how many points we need. The D is made out of a straight line and a curve, so we need at least two points (the strict minimum necessary to define a straight line). We could also, using directions, define the curve with those two points alone (since the curve of the D has the same ending points as its straight line), but then we would have difficulties to control the width of our character. So we need at least a third point to define our curve. That is enough! We are going to define our D using three points only.7 First we need to define the two points that It is always good policy to define your character with as few points as possible. Too many points is often 248 make up the straight line on the left of the D. We’ll call them points 1 and 3, to keep with the numbering on the E and A we already defined. They will be placed at the same positions as they were placed when we defined our E. But this time, we are not going to define them coordinate by coordinate. We are going to use what we learned in this lesson to define them in a quicker and at the same time clearer way. What is the relationship between points 1 and 3? As we’ve seen when we defined them for the character E, they are vertically aligned, at a distance h from each other, and point 3 is above point 1. In other words, z3 − z1 is a vertical vector, pointing upwards, and of length h. We already know a vertical vector pointing upwards: up. And we know its length is 1. So to get a vertical vector pointing upwards of length h, we just need to multiply up by h (you can check by writing “length(h*up)” that we indeed get a vector of the desired length). And we can finally write the full relationship between points 1 and 3 as: z 3 − z 1 = h*up or (identical equation but written a little differently): z 1 = z 3 − h*up But we also know easily how to position point 1 with a simple equation: we want to put it at coordinates (0, 0), which happen to be the coordinates of origin. So it’s enough to write “z1 = origin” to know exactly where point 1 is positioned, and by virtue of the relationship it shares with point 3, point 3’s position is now also fully known. And since we can concatenate equations, we can write the whole positioning of points 1 and 3 in a single, short, but also self-explanatory line: z1=z3-h*up=origin; See how using METAFONT’s predefined pair values shortens our program and clears it up?8 Now we only need to define point 2, and all our construction points will have been defined. Since point 2 doesn’t share any specific feature with the two other construction points, we will simply define it through its coordinates. Since we want to use this point to make sure that the D will have the same width as the already defined characters, it is obvious what its x coordinate will be: x2=w; As for its y coordinate, we are rather free here. But to keep the same look and feel for all our characters, we are going to place point 2 at the same height as the synonymous to a bad design. You could make the line look even more explicit by using a transformation instead of simple algebra, since as we’ve seen it “shifted” is equivalent to a simple addition for pairs. However, using transformations when simple algebra would be enough slows METAFONT down slightly, and the added explicitness is minimal is this case. 249 bars of the E and the A. And at this point the originally strange choice of point numerotation we made becomes fully justified, as it means we can simply copy the necessary line from the definition of E (or A): (y3-y2)=Phi*(y2-y1); without any change, and have our point 2 correctly placed!9 Now that the points are defined, we can draw the D shape. First, we need to choose the pen we want to draw it. We use the one we already defined in terms of the golden number: pickup pencircle scaled 15 xscaled Phi rotated angle (Phi,1); Next, we begin with the simple part, which is to draw the straight line of the D: draw z1..z3; Finally, we need to draw the curve that will close the shape of our D. We could of course simply write “draw z1..z2..z3;”. You can check the result in Figure .22, where you can immediately see that the resulting character is both taller and wider than the E we defined. Once again, that’s because of METAFONT’s idea of a “good” curve passing through defined points, and that idea doesn’t necessarily take into account considerations like the width and height of the character we want to make. So if we want a character following our specifications, we are going to need to give METAFONT some more information. Since we said (and we keep it that way) that 3 points would be enough to define our D, the only information we can add is in terms of directions at those points. To keep our character to the height we want, we need to make sure that METAFONT starts and ends the curve horizontally. We can do that using the predefined right and left, as such: “draw z1 {right}..z2 ..{left}z3 ;” (don’t forget that a curve has also a sense of drawing. From z1 to z2 it goes to the right, and from z2 to z3 it goes to the left. This explain why right and left are used as they are. If you switched them, the resulting curve would be very different). The result is shown in Figure .23. It is better, but still not exactly what we want: METAFONT likes curves to be as symmetric as possible, even when the points that define them are not symmetrically positioned, which is why the resulting curve overruns point 2 on the right. If we want our D to be w wide, we need to ensure that point 2 is the farthest to the right that the curve will get. You can simply do that by specifying that when the curve passes by point 2, it should do so in a vertical direction, using up. So that finally the correct line we need to write to draw our curve is: draw z1{right}..z2{up}..{left}z3; Just add a line to label our three points and another one to show up the character and end the program: Remember, by defining z 1 and z 3 , we also automatically define their coordinates, and thus also y 1 and y3. 250 labels(range 1 thru 3); showit; shipit; end And we’re done! Once again, just transform the resulting output file into a DVI file and you should get Figure .24. Well done! Let’s now sum it up by putting together all the instructions necessary to define our D character, and we’re ready for another exercise! ^ đ 1 2 3 4 5 6 7 8 9 10 11 Phi=(1+sqrt5)/2; w=100; h=Phi*w; z1=z3-h*up=origin; x2=w; (y3-y2)=Phi*(y2-y1); pickup pencircle scaled 15 xscaled Phi rotated angle (Phi,1); draw z1..z3; draw z1{right}..z2{up}..{left}z3; labels(range 1 thru 3); showit; shipit; end xEXERCISE .17: Once again, let’s check that you have understood this lesson by creating another character by yourself, this time a C as in Figure .25. Once again, it will be based on the golden number: • the ratio of its height by its width is equal to the golden number; • its leftmost point is at the same height as the horizontal bar of the E and A characters (or at the same height as the rightmost point of the D character we just drew); • its topmost and bottommost points are not horizontally centered. Rather, their horizontal position is simply the character width divided by the golden number; • its bottom end is vertically lower than its leftmost point, by a ratio of twice the golden number;10 • its endpoints are symmetrically positioned; • it is drawn with the pen we defined earlier in this section. Once again, just make the character 100 pixels wide to make it comparable to the other characters we already defined. Once again, we first need to choose our construction points. To draw the C character as we want it, we need of course to define Why such a ratio? Well, with other ratios the resulting character just didn’t look right to me. Your aesthetic sense may be different, and that’s not a problem. But here I want you to reproduce the same character as the one on the figure. ^ ¨ 251 its end points. And since we also need to position correctly its topmost, bottommost and leftmost points, we take them as construction points too. This adds up to five points, that we will label as in Figure .26. I will not insult your intelligence by repeating the reason for the first three lines of this program: Phi=(1+sqrt5)/2; w=100; h=Phi*w; Then, against all common sense, we are going to define point 3 first! ^ đ Being the leftmost point of our character, defining its x coordinate is obvious: x3=0; The next part may seem a little difficult: how can we define point 3 to be at the same height as the bars on the E and A characters, when no other point has been defined yet? If you think that, it means that you forgot that METAFONT has no problem working with unknown quantities! Although points 2 and 4 haven’t been defined yet, you can already use them in equations. As long as they are finally defined before we try to draw anything, METAFONT will be perfectly happy. So we can now take the line from the definition of point 2 in the E, A and D characters, adapt it to the point labels we have chosen here, and end up with: y4-y3=Phi*(y3-y2); Now let’s define point 1, which is defined to be below point 3 by a ratio of twice the golden number. It simply means that its y coordinate is equal to the y coordinate of point 3 divided by such a value. And since we want our C to be w wide, we can simply define both coordinates with one equation: z1=(w,y3/2Phi); People who know a little about programming languages may be surprised that writing y3/2Phi works as intended. Well, it does. ^ ¨ If you don’t trust it or are unsure, you can always put parentheses: y3/(2Phi).11 We can then define point 2, the bottommost point of Incidentally, although the meanings of the expressions “2Phi” and “2*Phi” are equivalent, if you had used the second one parentheses would have mandatory. That’s because “y 3 /2*Phi” corresponds mathematy y3 ically to 23 Φ, while “y 3 /(2*Phi)” (and “y 3 /2Phi”) corresponds to 2Φ . You can always try to remember that omitting the multiplication sign is like putting parentheses around its operands. We will see all this in more detail in a future lesson. 252 the character. This makes its y coordinate easy to define. As for its x coordinate, it is already completely described in the exercise as the width of the character divided by the golden number. We can thus now write: z2=(w/Phi,0); We now define point 5, the other end of our C. The exercise asks for both endpoints to be symmetrically positioned. Since it wasn’t explained further, we can take it to mean that point 5 should be the reflection of point 1. If you look at Figure .26, you can easily understand where the reflecting line is positioned: it’s a horizontal line cutting the character exactly in half (in other words, at h/2 height). Once you know that, you can easily define the transformation that will transform point 1 into point 5, using the “reflectedabout” transformation with two points defined to be at h/2 height. We could put them (horizontally) anywhere, but it’s just as simple to put them at horizontal position 0 and w. So we can now write: z5=z1 reflectedabout ((0,h/2),(w,h/2)); But the funny thing here is that if you look carefully at the figure and at the definition of point 4, you will see that it is the result of applying that same reflection to point 2, so that you can immediately write: z4=z2 reflectedabout ((0,h/2),(w,h/2)); and have point 4 correctly defined.12 Now the y coordinate of point 3 was defined in terms of points 2 and 4. Now that they are completely defined, point 3 is also completely defined, so that our point definitions are finished. We can now add the line that will choose the pen we use to draw our character: pickup pencircle scaled 15 xscaled Phi rotated angle (Phi,1); Of course, you could have strictly followed the definition and written “z 4 = (w/Phi,h);”, but keeping point 2 and 4 vertically aligned is a good idea, aesthetically speaking, and if you decided to move them a little you would have to change two lines in the program, while when using the reflection you need to change only one line: point 4 always follows point 2. In such a simple case it seems hardly worth the effort, but as your designs will get more complex so will your point definitions, and having as many point definitions be relative to other points rather than absolute will help you when you need to change things. It’s one of the things that define meta-ness, so let’s get used to it already. ^ đ 253 Once this is done, the only thing left to do is to actually draw it. Since the whole C character is made of one smooth curve, we need a single “draw” command, going from point 1 to point 5 in order (and explaining thus the numbering we chose here). Of course, in order to keep the curve from overrunning the limits we defined for our character, we do as we did with the D character and we specify the direction of drawing at points 2, 3 and 4 (it is not needed for points 1 and 5). I trust you understood how we did it with the D character and thus understand the following line: draw z1..z2{left}..z3{up}..z4{right}..z5; We can now end up with the usual lines of labelling and ending the file: labels(range 1 thru 5); showit; shipit; end and the result you will find in mfput.2062gf should be identical to the one in Figure .26. To sum up the whole exercise, here’s the whole list of instructions we used to define our C character: 1 2 3 4 5 6 7 8 9 10 11 12 13 Phi=(1+sqrt5)/2; w=100; h=Phi*w; x3=0; y4-y3=Phi*(y3-y2); z1=(w,y3/2Phi); z2=(w/Phi,0); z4=z2 reflectedabout ((0,h/2),(w,h/2)); z5=z1 reflectedabout ((0,h/2),(w,h/2)); pickup pencircle scaled 15 xscaled Phi rotated angle (Phi,1); draw z1..z2{left}..z3{up}..z4{right}..z5; labels(range 1 thru 5); showit; shipit; end 6 We’re done! Here we are! Lesson 2 has finally come to an end. OK, I might have lied a little in Section 11 when I said that lessons would be lighter from then on. You will probably have found this lesson rather heavy. However, it focussed strongly on contents and didn’t contain that many different topics, so it should be easier to understand than the previous one. However, I must insist once again that you must have truly understood the concepts presented in this lesson before carrying on with the next lesson. Next lesson we will finally see how to make true font files that can be used with TEX and LATEX , so it is really important that you 254 understand what has been explained until now. So don’t hesitate to try and make your own characters (now that you can make curves, you shouldn’t be limited anymore. You can even try numbers! ^ ¨ ), play with pens, and if you still don’t get something, you can always contact me at [email protected], or via the (La)TeX/METAFONT-for-Conlangers13 mailing list. But right now, go and do something else! Enough METAFONTing for today! ^ ¨ http://groups.yahoo.com/group/latex-for-conlangers/ 255 pencircle scaled 20; (a) pencircle xscaled 20 yscaled 5; (b) pencircle xscaled 5 yscaled 20; (c) pensquare scaled 20; (d) pensquare xscaled 20 yscaled 5; (e) pensquare xscaled 5 yscaled 20; (f) 256 Figure .18: Examples of the same loop drawn with different pens. pencircle xscaled 20 yscaled 5 rotated 30; pencircle xscaled 20 yscaled 5 rotated 45; (a) (b) pencircle xscaled 20 yscaled 5 rotated 120; pencircle xscaled 20 yscaled 5 rotated 135; (d) (e) pencircle x yscaled 5 r (c 257 Figure .19: Again the same loop drawn with pens of identical shape but tilted at pencircle x yscaled 5 ro (f Figure .20: A simple E character drawn with a calligraphic pen Figure .21: A simple A character drawn with a calligraphic pen 258 Figure .22: A simple but incorrect D character Figure .23: A better but still incorrect D character 259 Figure .24: The correct simple D character Figure .25: A simple C character 260 Figure .26: A simple C character, with labels 261 Index METAFONT, 168 TEX , 168 Adobe, 5, 165 Apple Inc., 165, 166 Appropriation, 161 Carson, David, 164 Code, 6 Design Education, 5 Designer, 5 Emigre, 164 Graphic Design Software, 6 GUI, 6 Gutenberg, 161, 162 Kittler, Friedrich, 6 Knuth, Donald E., 168 Lafuente, Ricardo, 161 Learning, 5 Linotype, 161, 162 Macromedia, 5, 165 Microsoft, 165 PostScript, 165 Truetype, 165 Typography, 161 Unix, 168 van Schaik, Michael, 5 Workspace, 5, 6 263 Bibliography 1 Nelson H. F. Beebe. Using boxes and glue in TEX and LATEX . 2009. 2 The Linux Information Project. Pipes: A Brief Introduction, 2010. [Online; accessed 21-February-2010]. 3 Friedrich Kittler. There is No Software, 1995. [Online; accessed 27January-2010]. 4 Wikipedia. Jodi (art collective) — Wikipedia, The Free Encyclopedia, 2009. [Online; accessed 27-January-2010]. 5 Microsoft Corporation. Windows Vista Features, 2010. [Online; accessed 27-January-2010]. 6 Free Software Foundation. BadVista, 2010. [Online; accessed 27January-2010]. 7 Marshall McLuhan. Marshall McLuhan Unbound, The Relation of Environment to Anti-environment. Gingko Press, London, 2005. 8 Arjen Mulder. Over mediatheorie. V2_NAi Uitgevers, Rotterdam, 20045. 9 Google Corporation. Google Investor Relations: Google Code of Conduct, 2010. [Online; accessed 27-January-2010]. 10 http://www.kde.me.uk/index.php?page=fosdem-interview-scribus, 2006. [Online; accessed 12-January-2006]. 11 Processing 1.0 (BETA), 2006. [Online; accessed 12-April-2006]. 12 Florian Cramer. The Creative Common Misunderstanding, 2006. [Online; accessed 5-March-2009]. 13 Le Corbusier. Städtebau. Deutsche Verlags-Anstalt DVA, München, 1979. 14 Ott Friedl and Stein. Typography: An encyclopedic survey of type design and techniques through history. Black Dog & Leventhal, London, 1998. 15 Fred Smeijers. Type Now. Hyphen Press, London, 2003. 265 16 Robert Bringhurst. The Elements of Typographic Style. Hartley & Marks, Vancouver, 2002. 17 Alan D. Sokal. Transgressing the Boundaries: Towards a Transformative Hermeneutics of Quantum Gravity. Social Text, 46(4):217–252, 1996. 18 Don Genter and Jakob Nielsen. The Anti-Mac Interface, 1996. [Online; accessed 27-January-2010]. 19 Marc de Bruijn. Designer Dictator, 2006. [Online; accessed 27-January2010]. 20 Jeff Raskin. Down with GUIs!, 1993. [Online; accessed 27-January2010]. 21 Open Source Publishing. Design Tools for Designers, 2006. [Online; accessed 27-January-2010]. GNU Free Documentation License Version 1.2, November 2002 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or BackCover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new frontmatter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements". 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (c) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.
Similar documents
The METAFONTtutorial
High Mage was revising the second volume of his Book of White Magic Spells (read: the second volume of his multivolume opus The Art of Computer Programming). He had received the galleys, made using...
More information