| 1 | /* |
|---|
| 2 | * TransFig: Facility for Translating Fig code |
|---|
| 3 | * Copyright (c) 1985 Supoj Sutantavibul |
|---|
| 4 | * Copyright (c) 1991 Micah Beck |
|---|
| 5 | * |
|---|
| 6 | * Permission to use, copy, modify, distribute, and sell this software and its |
|---|
| 7 | * documentation for any purpose is hereby granted without fee, provided that |
|---|
| 8 | * the above copyright notice appear in all copies and that both that |
|---|
| 9 | * copyright notice and this permission notice appear in supporting |
|---|
| 10 | * documentation. The authors make no representations about the suitability |
|---|
| 11 | * of this software for any purpose. It is provided "as is" without express |
|---|
| 12 | * or implied warranty. |
|---|
| 13 | * |
|---|
| 14 | * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
|---|
| 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
|---|
| 16 | * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
|---|
| 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
|---|
| 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|---|
| 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|---|
| 20 | * PERFORMANCE OF THIS SOFTWARE. |
|---|
| 21 | * |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | static char *texfontnames[] = { |
|---|
| 25 | "rm", "rm", /* default */ |
|---|
| 26 | "rm", /* roman */ |
|---|
| 27 | "bf", /* bold */ |
|---|
| 28 | "it", /* italic */ |
|---|
| 29 | "sf", /* sans serif */ |
|---|
| 30 | "tt" /* typewriter */ |
|---|
| 31 | }; |
|---|
| 32 | |
|---|
| 33 | /* The selection of font names may be site dependent. |
|---|
| 34 | * Not all fonts are preloaded at all sizes. |
|---|
| 35 | */ |
|---|
| 36 | |
|---|
| 37 | static char *texfontsizes[] = { |
|---|
| 38 | "Elv", "elv", /* default */ |
|---|
| 39 | "Fiv", "Fiv", "Fiv", "Fiv", /* small fonts */ |
|---|
| 40 | "Fiv", /* five point font */ |
|---|
| 41 | "Six", "Sev", "Egt", /* etc */ |
|---|
| 42 | "Nin", "Ten", "Elv", |
|---|
| 43 | "Twl", "Twl", "Frtn", |
|---|
| 44 | "Frtn", "Frtn", "Svtn", |
|---|
| 45 | "Svtn", "Svtn", "Twty", |
|---|
| 46 | "Twty", "Twty", "Twty", "Twty", "Twfv", |
|---|
| 47 | "Twfv", "Twfv", "twfv", "Twentynine", |
|---|
| 48 | "Twentynine", "Twentynine", "Twentynine", "Twentynine", |
|---|
| 49 | "Thirtyfour", "Thirtyfour", "Thirtyfour", "Thirtyfour", |
|---|
| 50 | "Thirtyfour", "Thirtyfour", "Thirtyfour", "Fortyone", |
|---|
| 51 | "Fortyone", "Fortyone" |
|---|
| 52 | }; |
|---|
| 53 | |
|---|
| 54 | #define MAXFONTSIZE 42 |
|---|
| 55 | |
|---|
| 56 | #define TEXFONT(F) (texfontnames[((F) <= MAX_FONT) ? (F)+1 : MAX_FONT]) |
|---|
| 57 | #define TEXFONTSIZE(S) (texfontsizes[((S) <= MAXFONTSIZE) ? round(S)+1\ |
|---|
| 58 | : MAXFONTSIZE]) |
|---|
| 59 | #define TEXFONTMAG(T) TEXFONTSIZE(T->size*(rigid_text(T) ? 1.0 : mag)) |
|---|
| 60 | |
|---|