FreeType 1.31.1

This commit is contained in:
2023-08-27 18:03:45 +02:00
commit 5edbb7a80a
454 changed files with 173977 additions and 0 deletions

38
contrib/ftos2/DEVELFAQ Normal file
View File

@@ -0,0 +1,38 @@
This is a FreeType/2 programmers' mini-FAQ
Q1: Is the source code available?
A1: Yes! But if you think you have all you need, you're probably wrong :-)
The source is now actually part of FreeType project, located at
ftp://ftp.physiol.med.tu-muenchen.de/pub/freetype
We have now the permission to distribute the OS/2 IFI headers with
the FreeType/2 source code. They're all the files beginning with a
"32" in the "ifi" directory. It seems that some people had problems
with the download indicated in the last beta.
Q2: What compilers are supported?
A2: The development of FreeType/2 was done primarily in IBM's VisualAge C++
version 3.0. It should be possible to build the DLL with Watcom C/C++ but
it's not quite working yet.
It is perhaps possible to build the Font Driver with another compiler,
but you'll have to know the compiler (and OS/2 of course) _quite_ well.
Note that the FreeType library itself supports also EMX/GCC (and I
believe it was mainly developed in it).
Q3: What other tools do I need?
A3: You'll need a kernel debugger. Check out IBM's ICAT, it's great and
it's free! Actually without ICAT this code would probably never happen.
If you've lived under a rock and don't know what ICAT is, it's actually
an interface to ol' good KDB. It is a source-level debugger and it looks
and feels very much like the VisualAge debugger, IPMD.
And if you haven't got it yet, you'll need _two_ computers to use ICAT.
But believe me, it's worth it!

260
contrib/ftos2/FAQ Normal file
View File

@@ -0,0 +1,260 @@
This is a FreeType/2 users' mini-FAQ
Table of Contents:
Q1: Where can I find the latest FreeType/2 release?
Q2: Now that I have FreeType/2 installed, how do I actually add TrueType
fonts to OS/2?
Q3: When will you add font-smoothing to the DLL? I really want that!
Q4: Why does IBM's TrueType engine do such a poor job?
Q5: But there are still differences with the glyphs produced by Windows or
the Mac, right?
Q6: I've got TrueType Times New Roman installed but the system still seems
to be using the original ATM (Type 1) font. Why this odd behaviour?
Q7: I noticed it takes a second or two before the Font Palette object opens
for the first time. Why?
Q8: I noticed the characters sometimes have odd spacing. When will you fix
it?
Q9: Could you explain the open fonts limit?
Q10: Can you recommend some fonts to use?
Q11: What's a 'broken glyph'?
Q12: Why do some fonts appear twice, once starting with an '@'?
Q13: I've got a Chinese (Japanese, Korean) font but the characters aren't
there! Why?
Q14: I tried to use a DBCS font but I got an exception un UCONV.DLL. What's
wrong?
Q15: My system won't boot after I installed FreeType/2 and the uninstall
script won't work when I boot to command line. What now?
Q16: I'm upgrading from previous version and I don't want to uninstall and
reinstall. Is there any other way?
Q17: What's this stuff about Times New Roman being aliased to Tms Rmn?
Please explain this.
Questions & Answers:
Q1: Where can I find the latest FreeType/2 release?
A1: Links to the latest release can be found at the FreeType/2 homepage at
http://www.freetype.org/ft_os2/index.html.
Q2: Now that I have FreeType/2 installed, how do I actually add TrueType
fonts to OS/2?
A2: I thought everyone knew that... It's simple, really. Open the Font
Palette object (in System Setup folder) then click 'Edit font' and 'Add'.
Now type the directory path where your TrueType fonts reside, such as
'C:\WINDOWS\FONTS' if you have Win95 and click 'Add'. You'll be presented a
list of all fonts that OS/2 found in specified directory. Simply select all
fonts you wish to install click 'Add' for the last time. If you wish to
remove fonts, just use the 'Delete' button in the 'Edit Font' dialog.
TIP: If you wish to add font to OS/2 but don't want to actually copy the
file, just type the directory name where the font files already are instead
of 'X:\PSFONTS' in the 'Add New Fonts' dialog.
Q3: When will you add font-smoothing to the DLL? I really want that!
A3: Short answer: We can't.
Long answer: The FreeType library already supports font-smoothing (or
antialiasing or grayscaling). The problem is that OS/2's font engine, in
its current incarnation, doesn't know anything about anti-aliased text and
is only able to manage monochrome bitmaps. Font smoothing support would
require some changes of PM/GPI/GRE components, which certainly is out of
our scope, and isn't planned by IBM (to our knowledge) in foreseeable
future, if ever.
If you really need font smoothing in your application, you can still use
the FreeType library itself. Be warned that it is a rather low-level engine
and that you'll need to add a various number of text features on top of
this code to get the equivalent of PM's font API.
There is a good chance that FreeType 2.0 will ease the pain for developers
when it's available.
And if you really want font smoothing in OS/2, ask IBM!
Q4: Why does IBM's TrueType engine do such a poor job?
A4: It'd be easy to throw one or two stones at IBM's engineers if this was
the result of lazy coding or bad software engineering. However, the problem
is more complex, and PSP programmers deserve little, if any, blame.
Trouble is that the TrueType specification, which can be found both on
Microsoft and Apple sites, has severe lacks, as well as particularly fuzzy
definitions. Part of the TT spec is the TrueType bytecode specification.
This bytecode is used to write glyph programs that are used to explicitely
hint each glyph to have it rendered perfectly on the screen (and on
printers). It is made of approximately 200 opcodes, which relate to moving
points on a pixel grid, measuring distances in any kind of direction,
keeping widths and heights consistent across a single font, etc..
Some of these opcodes are simply un-documented, or lack precise and
important details related to their exact implementation. As a consequence,
when FreeType started, it's first bytecode interpreter exhibited results
which were very similar to OS/2's one (i.e. bad baseline, incoherent
widths, "swashs" and bad serifs, etc..). There are several commercial
engines which provide the same kind of "erroneous" output, like the one in
the BeOS for instance.
It took FreeType developers _many_ months and experimentation to discover
the real meaning of some opcodes, and incorporate it into the library. This
"spelunker" work has been painful and slow, which is why few commercial
companies, if any, dared to do it, but it finally pays off ! Moreover, the
FreeType library is released under a BSD-like free license. This means that
_anyone_ is now able to take the work that has been done to rewrite or fix
his own TrueType interpreter. (Of course, another good idea is to use
FreeType as your core TrueType engine, to be able to benefit to ongoing
fixes and "undocumented features" discoveries, etc...)
Q5: But there are still differences with the glyphs produced by Windows or
the Mac, right?
A5: Right. Another feature of the TrueType specification is to use fixed
float pixel coordinates. When measuring distances along diagonals, some
rouding error usually occur. Also, some TrueType opcodes have a more or
less "chaotic" behaviour, where a ridiculous difference in inputs can
produce vastly different results. These factors mean that the only way to
match bit-to-bit the glyphs produced by Windows or the Macintosh is to
implement the _exact_ same computation routines, and reproduce all their
rounding errors ! As FreeType is a clean-room implementation, this will
never be possible. Note that the bitmaps match in 95% cases, at least, and
that there are already differences between the Win 3.1 and Win95 TrueType
renderers (i.e. look at the "m" of Arial at size 8 for example).
The FreeType team tries very hard to "catch" differences, but there is a
point where this just isn't possible... However, we're very satisfied with
its current quality, and we hope you'll be too :-)
Q6: I've got TrueType Times New Roman installed but the system still seems
to be using the original ATM (Type 1) font. Why this odd behaviour?
A6: It seems in case of a name clash OS/2 is using the font that was
installed later. Try removing and reinstalling the TrueType font.
Alternately remove the ATM (Type 1) font (not recommended).
Experiments also suggest that different apps behave differently. Some apps
will for example show both fonts but will use only one of them anyway. It
really depends.
Q7: I noticed it takes a second or two before the Font Palette object opens
for the first time. Why?
A7: Because FreeType/2 postpones as much work on the fonts as possible
until it's really needed. This means the first opening of a font is a bit
slower. But it also means no resources are unnecessarily wasted. And it's
not really that bad :-) This behaviour is also noticeable when e.g. opening
a document for the first time. Note that subsequent openings are OK because
OS/2 caches as much information as possible.
Q8: I noticed the characters sometimes have odd spacing. When will you fix
it?
A8: I won't. It's not really a bug, it's a feature. If they weren't spaced
'oddly', the result might look better, but only at the cost of
Windows-style 'WYSIWYG', i.e. what you see on screen will almost certainly
look totally different on any other device. Anyway, the spacing is
controlled by OS/2 and not by the Font Driver itself, so if you still don't
like it, IBM is the right one to ask :-)
This problem is particularly visible in Netscape. Most probably this
happens because Netscape tries to use fractional pointsizes, but most
TrueType fonts don't allow that. This means that Netscape sometimes
positions characters as if they were e.g. 8.6 points while their actual
size is only 8 points.
Q9: Could you explain the open fonts limit?
A9: Sure. If you install 50 fonts in OS/2, the system opens them all at
startup and keeps them open until shutdown. While many users may want to
have large number of fonts installed (like me), very few of them probably
use all the fonts all the time. This of course wastes lots of memory and
swap space. Just for your information, normal fonts take up 30-50 K of
memory with FreeType/2, but for example Times New Roman MT 30 takes over
500K!
FreeType/2 overcomes this problem by only actually keeping in memory the
last n most recently used fonts. The actual number is settable via entry in
OS2.INI and there's an simple REXX script to do that. Good default might be
10-15 fonts, depending what you want to do with them.
Note that this process is totally transparent to the system. You won't have
to do anything, FreeType/2 will take care of everything. The only things
you will notice is dramatically reduced memory consumption and when working
with large numbers of fonts there may be slight delay when reopening a
font.
Q10: Can you recommend some fonts to use?
A10: Yes! I recommend to use Micro$oft's (oh no!) Core Fonts - Times New
Roman, Arial and Courier New, plus other MS fonts. There are several
reasons: the fonts have very good quality, stick to the TrueType spec prety
well, support many countries and are widely available. Moreover they're
free. You can certainly find some Win95 or NT machine in your neighbourhood
(all too easily I'm afraid). They should also be available from MS's Web
site.
Note: If you want to copy the fonts from a Win95 machine, they're in
\WINDOWS\FONTS. Watch out, the directory is hidden!
Q11: What's a 'broken glyph'?
A11: Some fonts contain buggy or 'broken' glyphs that cannot be reliably
loaded and rendered. Those glyphs are usually very rarely used so you might
never notice. There was a problem with the first Beta of FreeType/2 that if
there was a single broken glyph in a font, the
whole font didn't work.
Q12: Why do some fonts appear twice, once starting with an '@'?
A12: It's because of DBCS systems. If you don't have one, you can safely
ignore these fonts. The DBCS characters in them are rotated 90 degrees
counterclockwise. It allows you to write vertical text (e.g. Chinese) with
a normal word processor. You write the text horizontally but if you turn
the resulting page 90 degrees clockwise, you've got vertical text.
It's not working perfectly yet.
Q13: I've got a Chinese (Japanese, Korean) font but the characters aren't
there! Why?
A13: Most probably the font and your system settings don't mix. One
possible cause is that your country setting is different than that of the
font and the font contains no information about what language it's meant
for. In that case, FreeType/2 has to guess from your country setting. This
means it might try to treat e.g. Japanese font as a Korean one which means
you won't be able to access the Japanese characters in it. It's all a bit
more complicated but it's a result of how national language support is done
in OS/2.
Q14: I tried to use a DBCS font but I got an exception un UCONV.DLL. What's
wrong?
A14: UCONV.DLL it used for character code translation. A likely cause is
that you are missing the required translation table in \LANGUAGE\CODEPAGE
directory on your boot drive. Look for file named 'IBM<CP>', where <CP> is
the codepage you use, e.g. IBM950 for Taiwan or IBM949 for Korea.
Q15: My system won't boot after I installed FreeType/2 and the uninstall
script won't work when I boot to command line. What now?
A15: But you've archived the key files, haven't you? If not, one way out of
this mess is booting to command line and renaming or deleting FREETYPE.DLL
from \OS2\DLL. Your system should boot then.
Q16: I'm upgrading from previous version and I don't want to uninstall and
reinstall. Is there any other way?
A16: Yes! There's a little utility called REPMOD.EXE which allows you to
replace files that are in use. In case you don't already have it, it's
included in the FreeType/2 package. You should simply run UPDATE.CMD. The
new version will be used on next reboot.
Q17: What's this stuff about Times New Roman being aliased to Tms Rmn?
Please explain this.
A17: OS/2 contains bitmap font called Tms Rmn which is often used in dialog
windows and elsewhere. The bitmap font contains only several pointsizes (8,
10, 12, 14, 18, 24). If you request a missing pointsize, OS/2's graphics
engine (GRE) substitutes it from the (outline) ATM font Times New Roman
which can also be referred to as Roman/Tms Rmn. Now FreeType/2 mimics this
functionality and can fully replace the ATM version. I recommend to
uninstall the ATM font since if both fonts are installed, some apps use the
ATM one, others TrueType one, without any apparent logic. If you uninstall
(via Font Palette) the ATM version, you will always get high-quality
TrueType Times New Roman.

BIN
contrib/ftos2/ft2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,53 @@
/*********************************************************************\
* Module Name: 32FDDEF.H
*
* OS/2 Intelligent Font Interface
*
* Copyright (c) 1989,1994 IBM Corporation
* Copyright (c) 1989 Microsoft Corporation
*
\*********************************************************************/
#ifndef __32FDDEF_H__
#define __32FDDEF_H__
/* Typedef the Font Driver 32 Bit entry points */
/* FdLoadFontFile */
typedef HFF (* _syscall PFDLFF)(PSZ pszFileName);
/* FdQueryFaces */
typedef LONG (* _syscall PFDQF)(HFF hff, PIFIMETRICS pifim,
ULONG cMetricLen, ULONG cFontCount,
ULONG cStart);
/* FdConvertFontFile */
typedef LONG (* _syscall PFDCFF)(PSZ pszSrc, PSZ pszDestDir,
PSZ pszName);
/* FdClaimFontFile */
typedef LONG (* _syscall PFDCLF)(PSZ pszFileName);
/* FdUnloadFontFile */
typedef LONG (* _syscall PFDUFF)(HFF hff);
/* FdOpenFontContext */
typedef HFC (* _syscall PFDOFC)(HFF hff, ULONG ulFont);
/* FdSetFontContext */
typedef LONG (* _syscall PFDSFC)(HFC hfc, PCONTEXTINFO pci);
/* FdCloseFontContext */
typedef LONG (* _syscall PFDCFC)(HFC hfc);
/* FdQueryFaceAttr */
typedef LONG (* _syscall PFDQFA)(HFC hfc, ULONG iQuery, PBYTE pBuffer,
ULONG cb, PGLYPH pagi, GLYPH gistart);
/* FdQueryCharAttr */
typedef LONG (* _syscall PFDQCA)(HFC hfc, PCHARATTR pCharAttr,
PBITMAPMETRICS pbmm);
/* FdQueryFullFaces */
typedef LONG (* _syscall PFDQFF)(HFF hff, PVOID pBuf, PULONG cBufLen,
PULONG cFontCount, ULONG cStart);
#endif

View File

@@ -0,0 +1,161 @@
/*********************************************************************\
* Module Name: 32FDSTRC.H
*
* OS/2 Intelligent Font Interface
*
* Copyright (c) 1989,1994 IBM Corporation
* Copyright (c) 1989 Microsoft Corporation
*
\*********************************************************************/
#ifndef __32FDSTRC_H__
#define __32FDSTRC_H__
#define FACESIZE 32
#define GLYPHNAMESIZE 16
/* Error codes defined to be returned by IFI */
/* NOTE: The actual values are subject to change */
/*#define PMERR_BUFFER_TOO_SMALL 23003L*/
#define PMERR_FACENAME_NOT_FOUND 23004L
#define PMERR_FD_ALREADY_INSTALLED 23005L
#define PMERR_INVALID_CONTEXTINFO 23006L
#define PMERR_NOT_A_FONT_FILE 23007L
#define PMERR_INVALID_FONT_SELECTION 23008L
#define PMERR_INVALID_FORMAT 23009L
#define PMERR_BUSY_HFC 230010L
#define PMERR_INVALID_HFC 230011L
#define PMERR_INVALID_INDEX 230012L
#define PMERR_INVALID_QUERY_TYPE 230013L
#define PMERR_CONTEXT_NOT_SET 230014L
/* Query faces subfunction */
#define FD_QUERY_CONTEXTMETRICS 1L
#define FD_QUERY_ABC_WIDTHS 2L
#define FD_QUERY_KERNINGPAIRS 3L
/* Query char subfunction */
#define FD_QUERY_CHARIMAGE 1L
#define FD_QUERY_OUTLINE 2L
#define FD_QUERY_BITMAPMETRICS 4L
#define FD_CHARATTR_ALIGNED_8 0x00000001
#define FD_CHARATTR_ALIGNED_16 0x00000002
#define FD_CHARATTR_ALIGNED_32 0x00000004
#define FD_CHARATTR_NO_CACHE 0x00000010
typedef struct _ABC_TRIPLETS /*abc*/
{
LONG lA;
ULONG ulB;
LONG lC;
} ABC_TRIPLETS;
typedef ABC_TRIPLETS *PABC_TRIPLETS;
// THIS STRUCTURE NOW RESIDES IN PMDDI.H FOR CRUISER WORLD
// BUT IFI FONT DRIVER DOES NOT INCLUDE PMDDI.H
#ifndef INCL_IFI
typedef struct _POINTFX { /* ptfx */
FIXED x;
FIXED y;
} POINTFX;
typedef POINTFX *PPOINTFX;
#endif
typedef struct _BITMAPMETRICS /* bmm */
{
SIZEL sizlExtent;
ULONG cyAscent;
#ifdef OLD_DRIVER
POINTFX *ppfxOrigin; /* Return character origin. */
#else
POINTFX pfxOrigin; /* Return character origin. */
#endif
} BITMAPMETRICS;
typedef BITMAPMETRICS *PBITMAPMETRICS;
typedef struct _MAT2 /* mat */
{
FIXED eM11;
FIXED eM12;
FIXED eM21;
FIXED eM22;
} MAT2;
typedef struct _FD_KERNINGPAIRS /* krnpr */
{
GLYPH giFirst;
GLYPH giSecond;
LONG eKerningAmount;
} FD_KERNINGPAIRS;
typedef struct _CONTEXTINFO /* ci */
{
ULONG cb; /* Length in bytes of this structure. */
ULONG fl; /* Flags. */
SIZEL sizlPPM; /* Device resolution in pels/meter. */
POINTFX pfxSpot; /* Spot size in pels. */
MAT2 matXform; /* Notional to Device transform. */
} CONTEXTINFO;
typedef CONTEXTINFO *PCONTEXTINFO;
typedef struct _CHARATTR /* ca */
{
ULONG cb;
ULONG iQuery; /* Query type. */
GLYPH gi; /* Glyph index in font. */
PBYTE pBuffer; /* Bitmap buffer. */
ULONG cbLen; /* Size of buffer in bytes. */
} CHARATTR;
typedef CHARATTR *PCHARATTR;
typedef struct _CHARATTR2 /* ca2 */
{
ULONG cb;
ULONG iQuery; /* Query type. */
GLYPH gi; /* Glyph index in font. */
PBYTE pBuffer; /* Bitmap buffer. */
ULONG cbLen; /* Size of buffer in bytes. */
ULONG fl; /* Flags */
} CHARATTR2;
typedef CHARATTR2 *PCHARATTR2;
typedef struct _CONTEXTMETRICS
{
SIZEL sizlMax;
ULONG cyMaxAscent;
ULONG cyMaxDescent;
ULONG cxTotal;
ULONG cGlyphs;
} CONTEXTMETRICS;
typedef CONTEXTMETRICS * PCONTEXTMETRICS;
typedef struct _POLYGONHEADER {
ULONG cb;
ULONG iType; /* Must be FD_POLYGON_TYPE */
} POLYGONHEADER;
typedef POLYGONHEADER *PPOLYGONHEADER;
typedef struct _PRIMLINE {
ULONG iType; /* Must be FD_PRIM_LINE */
POINTFX pte;
} PRIMLINE;
typedef PRIMLINE *PPRIMLINE;
typedef struct _PRIMSPLINE {
ULONG iType; /* Must be FD_PRIM_SPLINE */
POINTFX pte[3];
} PRIMSPLINE;
typedef PRIMSPLINE *PPRIMSPLINE;
/*
* The names of these were changed to avoid conflict with PRIM_LINE
* which is defined ion some other header file.
*/
#define FD_POLYGON_TYPE 24
#define FD_PRIM_LINE 1
#define FD_PRIM_SPLINE 3
#endif

View File

@@ -0,0 +1,118 @@
/*********************************************************************\
* Module Name: 32IFIMET.H
*
* OS/2 Intelligent Font Interface
*
* Copyright (c) 1989,1994 IBM Corporation
* Copyright (c) 1989 Microsoft Corporation
*
* Definition and description of IFIMETRICS structure
* This file is included by FDSTRUCS.H
*
\*********************************************************************/
#ifndef __32IFIMET_H__
#define __32IFIMET_H__
#define FACESIZE 32
#define GLYPHNAMESIZE 16
/* #defines for fsType in IFIMETRICS */
#define IFIMETRICS_FIXED 0x0001 /*Fixed pitch */
#define IFIMETRICS_LICENSED 0x0002 /*Font subject of licensing agreement */
#define IFIMETRICS_KERNING 0x0004 /*Font has kerning data */
#define IFIMETRICS_DBCS 0x0010 /*DBCS font */
#define IFIMETRICS_MBCS 0x0018 /*MBCS (DBCS + SBCS) font */
/* Reserved 0x8000 */
#define IFIMETRICS_ATOMS 0x4000 /*The atom name fields are valid */
#define IFIMETRICS_FAMTRUNC 0x2000 /*Familyname field is truncated */
#define IFIMETRICS_FACETRUNC 0x1000 /*Facename field is truncated */
#define IFIMETRICS_ANTIALIASED 0x0020
#define IFIMETRICS_UNICODE 0x0040
#define IFIMETRICS_NO_CACHE 0x0080
/* #defines for fsDefn in IFIMETRICS */
#define IFIMETRICS_OUTLINE 0x0001 /*1 - Outline. 0 - Raster */
/* Reserved 0x0002 */
/* Reserved 0x0004 */
/* Reserved 0x8000 */
#define IFIMETRICS_UDC_FONT 0x0010 /*User defined font */
/* Reserved */
/* #defines for fsSelection in IFIMETRICS valid for bitmap or outline fonts */
#define IFIMETRICS_ITALIC 0x8000 /*Italic */
#define IFIMETRICS_UNDERSCORE 0x4000 /*Underscored */
#define IFIMETRICS_OVERSTRUCK 0x2000 /*Overstruck */
/* #defines for fsSelection in IFIMETRICS valid for bitmap fonts */
#define IFIMETRICS_NEGATIVE 0x1000 /*Negative image */
#define IFIMETRICS_HOLLOW 0x0800 /*Outline (hollow) */
#if defined(__IBMCPP__) || defined(__IBMC__)
#pragma pack(1)
#else
#pragma Align_members(1)
#endif
typedef struct _IFIMETRICS /* ifim */
{ /* UNITS */
UCHAR szFamilyname[FACESIZE]; /*Font Family Name, e.g. Roman */
UCHAR szFacename[FACESIZE]; /*Face name, e.g. Tms Rmn Bold Italic */
UCHAR szGlyphlistName[GLYPHNAMESIZE]; /*e.g. PM316, Latin-2, Greek */
USHORT idRegistry; /*IBM registration number (or zero). I */
LONG lCapEmHeight; /*Height of uppercase M N */
LONG lXHeight; /*Nominal height of lowercase N */
LONG lMaxAscender; /*Maximum height above baseline of any char N */
LONG lMaxDescender; /*Maximum depth below baseline of any char N */
LONG lLowerCaseAscent; /*Maximum height above baseline of any a-z N */
LONG lLowerCaseDescent; /*Maximum depth below basiline of any a-z N */
LONG lInternalLeading; /*White space within character N */
LONG lExternalLeading; /*White space between lines N */
LONG lAveCharWidth; /*Weighted average character width N */
LONG lMaxCharInc; /*Maximum character increment N */
LONG lEmInc; /*Increment for Capitals (typically 'M') N */
LONG lMaxBaselineExt; /*Height of character cell N */
FIXED fxCharSlope; /*Slope angle, degrees, clockwise D */
FIXED fxInlineDir; /*Drawing direction, degrees clockwise D */
FIXED fxCharRot; /*Glyph rotation in cell, degrees clockwise D */
USHORT usWeightClass; /*Character weight, 1-9 (1=ultra-light) I */
USHORT usWidthClass; /*Character width, 1-9 (1=ultra condensed) I */
LONG lEmSquareSizeX; /*Em Square size, x-direction N */
LONG lEmSquareSizeY; /*Em Square size, y-direction N */
GLYPH giFirstChar; /*Number of first glyph in font I */
GLYPH giLastChar; /*Number of last glyph in font I */
GLYPH giDefaultChar; /*Glyph used if requested glyph invalid I */
GLYPH giBreakChar; /*Space glyph I */
USHORT usNominalPointSize; /*Point size for which font was designed N */
USHORT usMinimumPointSize; /*Minimum point size scaling for font N */
USHORT usMaximumPointSize; /*Maximum point size scaling for font N */
USHORT fsType; /*Type indicators (see #defines) B */
USHORT fsDefn; /*Font definition data (see #defines) B */
USHORT fsSelection; /*Font selection flags (see #defines) B */
USHORT fsCapabilities; /*Font capabilities must be 0 B */
LONG lSubscriptXSize; /*Size in x-direction of subscript N */
LONG lSubscriptYSize; /*Size in y-direction of subscript N */
LONG lSubscriptXOffset; /*Offset in x-direction of subscript N */
LONG lSubscriptYOffset; /*Offset in y-direction of subscript N */
LONG lSuperscriptXSize; /*Size in x-direction of superscript N */
LONG lSuperscriptYSize; /*Size in y-direction of superscript N */
LONG lSuperscriptXOffset; /*Offset in x-direction of superscript N */
LONG lSuperscriptYOffset; /*Offset in y-direction of superscript N */
LONG lUnderscoreSize; /*Underscore size N */
LONG lUnderscorePosition; /*Underscore position N */
LONG lStrikeoutSize; /*Strikeout size N */
LONG lStrikeoutPosition; /*Strikeout position N */
SHORT cKerningPairs; /*Number of kerning pairs in pair table I */
ULONG ulFontClass; /*IBM font classification B */
} IFIMETRICS;
typedef IFIMETRICS FAR *PIFIMETRICS;
#if defined(__IBMCPP__) || defined(__IBMC__)
#pragma pack()
#else
#pragma Align_members()
#endif
#endif

View File

@@ -0,0 +1,79 @@
/*********************************************************************\
* Module Name: 32PMIFI.H
*
* OS/2 Intelligent Font Interface
*
* Copyright (c) 1989,1994 IBM Corporation
* Copyright (c) 1989 Microsoft Corporation
*
\*********************************************************************/
#ifndef __32PMIFI_H__
#define __32PMIFI_H__
#define INCL_IFD
typedef PVOID HFF; /* Font file handle */
typedef PVOID HFC; /* Font context handle */
#ifndef INCL_GRE_FONTS
typedef ULONG GLYPH; /* gi */
typedef ULONG *PGLYPH; /* pgi */
#endif
#include "32fdstrc.h" /* Font Driver structures */
#include "32ifimet.h" /* Pifi Metrics */
#include "32fddef.h" /* Font Driver entry definitions */
typedef struct _FDDISPATCH16 { /* fdisp */
PVOID FdLoadFontFile;
PVOID FdQueryFaces;
PVOID FdUnloadFontFile;
PVOID FdOpenFontContext;
PVOID FdSetFontContext;
PVOID FdCloseFontContext;
PVOID FdQueryFaceAttr;
PVOID FdQueryCharAttr;
PVOID FdClaimFontFile;
PVOID FdConvertFontFile;
} FDDISPATCH16;
typedef FDDISPATCH16 FAR *PFDDISPATCH16;
typedef struct _FDDISPATCH { /* fdisp */
PFDLFF FdLoadFontFile;
PFDQF FdQueryFaces;
PFDUFF FdUnloadFontFile;
PFDOFC FdOpenFontContext;
PFDSFC FdSetFontContext;
PFDCFC FdCloseFontContext;
PFDQFA FdQueryFaceAttr;
PFDQCA FdQueryCharAttr;
PFDCLF FdClaimFontFile;
PFDCFF FdConvertFontFile;
PFDQFF FdQueryFullFaces;
} FDDISPATCH;
typedef FDDISPATCH *PFDDISPATCH;
typedef struct _FDHEADER { /* fdhdr */
ULONG cbLength; /* Length of FDHEADER */
UCHAR strId[16]; /* String 'OS/2 FONT DRIVER' */
UCHAR szTechnology[40]; /* Identifier of Font Driver technology */
ULONG ulVersion; /* IFI version number (0x0100) */
ULONG ufDeviceCaps; /* Capabilities of device */
PFDDISPATCH pfddisp;
} FDHEADER;
typedef FDHEADER FAR *PFDHEADER;
#define OK 0
#define ERROR -1
#define IFI_VERSION 10
#define IFI_VERSION20 20
#define IFI_VERSION21 21
#define FD_DISPATCH_COUNT 11
#define DISPATCHTABLE "FONT_DRIVER_DISPATCH_TABLE"
#endif

View File

@@ -0,0 +1,10 @@
;LIBRARY FreeType INITGLOBAL TERMGLOBAL
LIBRARY FreeType INITINSTANCE TERMINSTANCE
PROTMODE
DATA SINGLE SHARED READWRITE LOADONCALL
;DATA MULTIPLE NONSHARED READWRITE LOADONCALL
CODE LOADONCALL
DESCRIPTION "FreeType/2, Copyright (C) 1998 Michal Necasek"

View File

@@ -0,0 +1,35 @@
# Makefile for FTIFI using IBM VisualAge C++
#
# Explanation of compiler switches used:
# -C compile only, do not link
# -Sp1 pack structures on byte boundaries (quite important)
# -Ss accept double slash (//) comments
# -Ge- build a DLL
# -Rn build a subsystem DLL; means that a special C library is
# linked and some calls cannot be used
# -Fo<name> create object file <name>
# -O+ optimizations on
# -G4 optimize for 486 (should be better for my 6x86MX, produces smaller
# code than Pentium optimization)
# Linker switches used:
# /DE include debug info in executable
# /NOE no extended dictionary search
# /E:2 exepack (for Warp 3 and higher)
# /A:32 align pages of code on 32-byte boundaries (makes smaller file)
# /DBGPACK pack debug info
# uncomment ICCR and LNKR to build a release version
ICCR=-O+ -G4
LNKR=/PACKC /PACKD /M /A:32 /E:2
# uncomment ICCD and LNKD to build a debug version. Note that debug and
# release version is not mutually exclusive in this case.
#ICCD=-Ti+ -DDEBUG
#ICCD=-Ti+
#LNKD=/DE /DBGPACK /M
FreeType.dll: $*.obj $*.def ..\lib\libttf.lib
ilink /NOE $(LNKD) $(LNKR) $*.obj ..\lib\libttf.lib libconv.lib $*.def
FreeType.obj: ftifi.c ftifi.h FreeType.icc
icc $(ICCD) $(ICCR) -C -Sp1 -Ss -Ge- -Rn -FoFreeType -I..\lib -I..\lib\extend -I..\lib\arch\os2 ftifi.c

View File

@@ -0,0 +1,29 @@
# WARNING!! this doesn't quite work yet!!!!
#
# Makefile for FTIFI using Watcom C/C++
#
# Explanation of compiler switches used:
# -4r register calling convention, generate 486 code. Better than
# Pentium opt. for Cyrix/IBM and AMD
# -otexan maximum optimization for speed
# -zp1 pack structures on byte boundaries (quite important!)
# -bd build a DLL
# -zc
# -d2 include debug info
#
# Important linker options used:
# initglobal call DLL initialization function only once (not for each
# process)
# termglobal call DLL termination function only once
# oneautodata use only one shared data segment
WCCR=-4r -otexan
#WCCD=-d2 -DDEBUG
#LNKD=debug all
FreeType.dll: $*.obj $*.def
wlink system os2v2 dll initglobal termglobal op oneautodata export GetOutline_ export FONT_DRIVER_DISPATCH_TABLE=_fdhdr file $* lib ..\lib\libttf.lib $(LNKD)
FreeType.obj: ftifi.c ftifi.h
wcc386 $(WCCD) $(WCCR) -zp1 -bd -zc -I..\lib -I..\lib\extend ftifi.c /Fo=freetype.obj

3209
contrib/ftos2/ifi/ftifi.c Normal file

File diff suppressed because it is too large Load Diff

305
contrib/ftos2/ifi/ftifi.h Normal file
View File

@@ -0,0 +1,305 @@
/*
Conversion from OS/2 UGL to Unicode
Copyright (C) 1997 Robert Muchsel <muchsel@acm.org>
Copyright (C) 1997,1998 Michal Necasek <mike@mendelu.cz>
All entries that were previously 0xFFFF were changed to 0x0000 because
TrueType 'missing glyph' has index 0
*/
#ifndef _FTIFI_H_INCLUDED_
#define _FTIFI_H_INCLUDED_
/* Platform-specific Encoding IDs for MS platform */
#define PSEID_SYMBOL 0
#define PSEID_UNICODE 1
#define PSEID_SHIFTJIS 2
#define PSEID_BIG5 3
#define PSEID_PRC 4
#define PSEID_WANSUNG 5
#define PSEID_JOHAB 6
/* defined by me! */
#define PSEID_PM383 100
/* bit masks for determining supported codepages */
#define OS2_CP1_ANSI_OEM_JAPANESE_JIS (1 << 17)
#define OS2_CP1_ANSI_OEM_CHINESE_SIMPLIFIED (1 << 18)
#define OS2_CP1_ANSI_OEM_CHINESE_TRADITIONAL (1 << 19)
#define OS2_CP1_ANSI_OEM_KOREAN_WANSUNG (1 << 20)
#define OS2_CP1_ANSI_OEM_KOREAN_JOHAB (1 << 21)
/* defines for character translation */
/* from Unicode to UGL */
#define TRANSLATE_UGL 0
/* Symbol - no translation */
#define TRANSLATE_SYMBOL 1
/* Unicode - no translation */
#define TRANSLATE_UNICODE 2
/* Big5 - no translation */
#define TRANSLATE_BIG5 4
/* ShiftJIS - no translation */
#define TRANSLATE_SJIS 5
/* from Unicode to Big5 */
#define TRANSLATE_UNI_BIG5 16
/* from Unicode to ShiftJIS */
#define TRANSLATE_UNI_SJIS 17
#define MAX_GLYPH 504
/* I suppose more than 949 is never used */
/* 504 should be OK for (most) European and American countries */
#ifndef USE_UCONV
static const int UGL2Uni[MAX_GLYPH + 1] = {
/* PM383 UGL mapping */
/* 0..9 */
0x0000, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022, 0x25d8, 0x25cb,
/* 10..19 */
0x25d9, 0x2642, 0x2640, 0x266a, 0x266b, 0x263c, 0x25ba, 0x25c4, 0x2195, 0x203c,
/* 20..29 */
0xb6, 0xa7, 0x25ac, 0x21a8, 0x2191, 0x2193, 0x2192, 0x2190, 0x221f, 0x2194,
/* 30..39 */
0x25b2, 0x25bc, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
/* 40..49 */
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31,
/* 50..59 */
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
/* 60..69 */
0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45,
/* 70..79 */
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
/* 80..89 */
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
/* 90..99 */
0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
/* 100..109 */
0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
/* 110..119 */
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
/* 120..129 */
0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x2302, 0xc7, 0xfc,
/* 130..139 */
0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7, 0xea, 0xeb, 0xe8, 0xef,
/* 140..149 */
0xee, 0xec, 0xc4, 0xc5, 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2,
/* 150..159 */
0xfb, 0xf9, 0xff, 0xd6, 0xdc, 0xf8, 0xa3, 0xd8, 0xd7, 0x192,
/* 160..169 */
0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba, 0xbf, 0xae,
/* 170..179 */
0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb, 0x2591, 0x2592, 0x2593, 0x2502,
/* 180..189 */
0x2524, 0xc1, 0xc2, 0xc0, 0xa9, 0x2563, 0x2551, 0x2557, 0x255d, 0xa2,
/* 190..199 */
0xa5, 0x2510, 0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0xe3, 0xc3,
/* 200..209 */
0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0xa4, 0xf0, 0xd0,
/* 210..219 */
0xca, 0xcb, 0xc8, 0x131, 0xcd, 0xce, 0xcf, 0x2518, 0x250c, 0x2588,
/* 220..229 */
0x2584, 0xa6, 0xcc, 0x2580, 0xd3, 0xdf, 0xd4, 0xd2, 0xf5, 0xd5,
/* 230..239 */
0xb5, 0xfe, 0xde, 0xda, 0xdb, 0xd9, 0xfd, 0xdd, 0xaf, 0xb4,
/* 240..249 */
0xad, 0xb1, 0x2017, 0xbe, 0xb6, 0xa7, 0xf7, 0xb8, 0xb0, 0xa8,
/* 250..259 */
0xb7, 0xb9, 0xb3, 0xb2, 0x25a0, 0xa0, 0x20a7, 0x2310, 0x2561, 0x2562,
/* 260..269 */
0x2556, 0x2555, 0x255c, 0x255b, 0x255e, 0x255f, 0x2567, 0x2568, 0x2564, 0x2565,
/* 270..279 */
0x2559, 0x2558, 0x2552, 0x2553, 0x256b, 0x256a, 0x258c, 0x2590, 0x3b1, 0x393,
/* 280..289 */
0x3c0, 0x3a3, 0x3c3, 0x3c4, 0x3a6, 0x398, 0x3a9, 0x3b4, 0x221e, 0x3c6,
/* 290..299 */
0x3b5, 0x2229, 0x2261, 0x2265, 0x2264, 0x2320, 0x2321, 0x2248, 0x2219, 0x221a,
/* 300..309 */
0x207f, 0x2c9, 0x2d8, 0x2d9, 0x2da, 0x2dd, 0x2db, 0x2c7, 0x2018, 0x2019,
/* 310..318*/
0x201c, 0x201d, 0x2013, 0x2014, 0x2c6, 0x2dc, 0x201a, 0x201e, 0x2026,
/* 319..329 */
0x2020, 0x2021, 0x2c6, 0x2030, 0x160, 0x2039, 0x152, 0x303, 0x2122, 0x161, 0x203a,
/* 330..339 */
0x153, 0x178, 0x11f, 0x11e, 0x130, 0x15f, 0x15e, 0x103, 0x102, 0x105,
/* 340..349 */
0x104, 0x107, 0x106, 0x10d, 0x10c, 0x10f, 0x10e, 0x111, 0x11b, 0x11a,
/* 350..359 */
0x119, 0x118, 0x13a, 0x139, 0x13e, 0x13d, 0x142, 0x141, 0x144, 0x143,
/* 360..369 */
0x148, 0x147, 0x151, 0x150, 0x155, 0x154, 0x159, 0x158, 0x15b, 0x15a,
/* 370..379 */
0x165, 0x164, 0x163, 0x162, 0x171, 0x170, 0x16f, 0x16e, 0x17a, 0x179,
/* 380..383 */
0x17e, 0x17d, 0x17c, 0x17b,
/* I don't know whether the following are used by PM, but they are in
the I18N unicode library */
/* yes they ARE used (for Cyrillic systems) */
/* 384..389 */
0x401, 0x402, 0x403, 0x404, 0x405, 0x406,
/* 390..399 */
0x407, 0x408, 0x409, 0x40a, 0x40b, 0x40c, 0x40e, 0x40f, 0x410, 0x411,
/* 400..409 */
0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41a, 0x41b,
/* 410..419 */
0x41c, 0x41d, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425,
/* 420..429 */
0x426, 0x427, 0x428, 0x429, 0x42a, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f,
/* 430..439 */
0x430, 0x431, 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439,
/* 440..449 */
0x43a, 0x43b, 0x43c, 0x43d, 0x43e, 0x43f, 0x440, 0x441, 0x442, 0x443,
/* 450..459 */
0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x44a, 0x44b, 0x44c, 0x44d,
/* 460..469 */
0x44e, 0x44f, 0x2116, 0x451, 0x452, 0x453, 0x454, 0x455, 0x456, 0x457,
/* 470..479 */
0x458, 0x459, 0x45a, 0x45b, 0x45c, 0x45e, 0x45f, 0x490, 0x491, 0x156,
/* 480..489 */
0x12e, 0x100, 0x112, 0x116, 0x122, 0x136, 0x12a, 0x1eb, 0x145, 0x14c,
/* 490..499 */
0x172, 0x16a, 0x157, 0x12f, 0x101, 0x113, 0x117, 0x123, 0x137, 0x12b,
/* 500..504 */
0x13c, 0x146, 0x14d, 0x173, 0x16b
#if MAX_GLYPH > 504
, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 510..519 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 520..529 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 530..539 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 540..549 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 550..559 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 560..569 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 570..579 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 580..589 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 590..599 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 600..609 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 610..619 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 620..629 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 630..639 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 640..649 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 650..659 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 660..669 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 670..679 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 680..689 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 690..699 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 700..709 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 710..719 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 720..729 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 730..739 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 740..749 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 750..759 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 760..769 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x303f, 0x21b5,
/* 770..779 */
0x3002, 0x300c, 0x300d, 0x3001, 0x0000, 0x30f2, 0x30a1, 0x30a3, 0x30a5, 0x30a7,
/* 780..789 */
0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8,
/* 790..799 */
0x30aa, 0x30ab, 0x30ad, 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb,
/* 800..809 */
0x30bd, 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, 0x30cd,
/* 810..819 */
0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, 0x30df, 0x30e0, 0x30e1,
/* 820..829 */
0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef,
/* 830..839 */
0x30f3, 0x309b, 0x309c, 0x3041, 0x3043, 0x3045, 0x3047, 0x3049, 0x3083, 0x3085,
/* 840..849 */
0x3049, 0x3063, 0x3042, 0x3044, 0x3046, 0x3048, 0x304a, 0x304b, 0x304d, 0x304f,
/* 850..859 */
0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305b, 0x305d, 0x305f, 0x3061, 0x3064,
/* 860..869 */
0x3066, 0x3068, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3072, 0x3075,
/* 870..879 */
0x3078, 0x307b, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3084, 0x3086, 0x3088,
/* 880..889 */
0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308f, 0x3092, 0x3093, 0x300e, 0x300f,
/* 890..899 */
0x30f6, 0x3005, 0x0000, 0x0000, 0x0000, 0x0000, 0x3131, 0x3132, 0x3133, 0x3134,
/* 900..909 */
0x3135, 0x3136, 0x3137, 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e,
/* 910..919 */
0x313f, 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148,
/* 920..929 */
0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, 0x3151, 0x3152,
/* 930..939 */
0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, 0x3159, 0x315a, 0x315b, 0x315c,
/* 940..949 */
0x315d, 0x315e, 0x315f, 0x3160, 0x3161, 0x3162, 0x3163, 0x20a9, 0x0000, 0x3164,
/* 950..959 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 960..969 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 970..979 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 980..989 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 990..999 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 1000..1009 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 1010..1019 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 1020..1023 */
0x0000, 0x0000, 0x0000, 0x0000
#endif /* MAX_GLYHP > 504 */
};
/* on Greek systems, the UGL is a bit different */
/* and changes the entries 319-383 inclusive */
/* # of Greek glyphs in UGL */
#define GREEK_GLYPHS 65
/* start of Greek glyphs in UGL */
#define GREEK_START 319
static const int SubUGLGreek[GREEK_GLYPHS] = {
/* 319..328 */
0x0391, 0x0392, 0x0395, 0x0396, 0x0397, 0x0399, 0x039a, 0x039c, 0x039d, 0x039f,
/* 329..338 */
0x03a1, 0x03a4, 0x03a5, 0x03a7, 0x03b7, 0x03bd, 0x03c7, 0x03bf, 0x0384, 0x0308,
/* 339..348 */
0x0385, 0x0390, 0x0020, 0x00A6, 0x0386, 0x0388, 0x0389, 0x038a, 0x038c, 0x038e,
/* 349..358 */
0x038f, 0x0394, 0x0398, 0x039b, 0x039e, 0x03a0, 0x03a8, 0x03aa, 0x03ab, 0x03ac,
/* 359..368 */
0x03ad, 0x03ae, 0x03af, 0x03b0, 0x03b2, 0x03b3, 0x03b6, 0x03b8, 0x03b9, 0x03ba,
/* 369..378 */
0x03bb, 0x03bc, 0x03be, 0x03c1, 0x03c2, 0x03c5, 0x03c6, 0x03c8, 0x03c9, 0x03ca,
/* 379..383 */
0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000
};
#endif /* USE_UCONV */
#endif /* _FTIFI_H_INCLUDED_ */

184
contrib/ftos2/ifi/ftmem.c Normal file
View File

@@ -0,0 +1,184 @@
/* */
/* ** This is part of the FreeType/2 project! ** */
/* A small utility to display online memory usage stats for FreeType/2 */
/* */
/* The method used to keep the window float on top may be completely */
/* stupid but I found no other way (except putting WinSetWindowPos() */
/* in the timer code which looks odd). */
/* */
/* Copyright (C) 1998 by M. Necasek */
#define INCL_DOSMISC
#define INCL_WINTIMER
#define INCL_PM
#include <os2.h>
#include <stdio.h>
#define ID_TIMER 42
#define IDM_FLOAT 155
/* name of shared memory used for memory usage reporting */
#define MEM_NAME "\\sharemem\\freetype"
typedef struct _INFOSTRUCT {
ULONG signature; /* signature (0x46524545, 'FREE') */
ULONG used; /* bytes actually used */
ULONG maxused; /* maximum amount ever used */
ULONG num_err; /* number of (de)allocation errors */
} INFOSTRUCT, *PINFOSTRUCT;
/* structure (in named shared memory) pointing to the above struct */
typedef struct _INFOPTR {
PINFOSTRUCT address; /* pointer to actual memory info */
} INFOPTR, *PINFOPTR;
HAB hab;
HWND hwndFrame;
PINFOSTRUCT meminfo;
PINFOPTR memptr;
ULONG bFloat = TRUE;
HWND hwndSysSubmenu;
VOID AddFloat(HWND hwndFrame) {
MENUITEM mi;
HWND hwndSysMenu;
SHORT sMenuID;
/* add Float option to system menu */
hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
sMenuID = (SHORT)WinSendMsg(hwndSysMenu, MM_ITEMIDFROMPOSITION,
MPFROMSHORT(0), MPVOID);
WinSendMsg(hwndSysMenu, MM_QUERYITEM, MPFROMSHORT(sMenuID),
MPFROMP(&mi));
hwndSysSubmenu = mi.hwndSubMenu;
mi.iPosition = MIT_END;
mi.afStyle = MIS_SEPARATOR;
mi.afAttribute = 0;
mi.id = -1;
mi.hwndSubMenu = 0;
mi.hItem = 0;
WinSendMsg(hwndSysSubmenu, MM_INSERTITEM, MPFROMP (&mi), NULL);
mi.afStyle = MIS_TEXT;
mi.afAttribute = MIA_CHECKED;
mi.id = IDM_FLOAT;
WinSendMsg(hwndSysSubmenu, MM_INSERTITEM, MPFROMP (&mi), "~Float on top");
}
MRESULT EXPENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
HPS hps;
RECTL rcl;
static ULONG i = 1;
ULONG ulMem;
char szBuf[200];
switch (msg) {
case WM_CREATE:
/* use smaller text */
WinSetPresParam(hwnd, PP_FONTNAMESIZE, 7, (PVOID)"8.Helv");
/* start the timer (ticks each 0.5 sec.) */
AddFloat(WinQueryWindow(hwnd, QW_PARENT));
WinStartTimer(hab, hwnd, ID_TIMER, 500);
break;
/* make window always stay on top (if desired) */
case WM_VRNENABLED:
if (bFloat)
WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
break;
case WM_COMMAND: /* why doesn't WM_SYSCOMMAND work? */
if (LOUSHORT(mp1) == IDM_FLOAT) {
bFloat = !bFloat;
WinCheckMenuItem(hwndSysSubmenu, IDM_FLOAT, bFloat);
}
break;
case WM_TIMER:
if (++i > 13)
i = 1;
WinInvalidateRect(hwnd, NULL, FALSE);
return FALSE;
case WM_PAINT:
hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
/* necessary to avoid incorrectly repainting window */
WinQueryWindowRect(hwnd, &rcl);
/* sprintf(szBuf, " Current use %dK Maximum ever used %dK Errors %d",
meminfo->used / 1024,
meminfo->maxused / 1024, meminfo->num_err);*/
sprintf(szBuf, " Current use %dB Maximum ever used %dK Errors %d",
meminfo->used,
meminfo->maxused / 1024, meminfo->num_err);
WinDrawText(hps, -1, szBuf, &rcl, CLR_BLACK, CLR_WHITE,
DT_CENTER | DT_VCENTER | DT_ERASERECT);
WinEndPaint(hps);
break;
}
return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
void main (void)
{
QMSG qmsg;
HMQ hmq;
HWND hwndClient;
ULONG flFrameFlags;
WinInitialize(0);
hmq = WinCreateMsgQueue(hab, 0);
/* get access to shared memory */
DosGetNamedSharedMem((PVOID*)&memptr, MEM_NAME, PAG_READ);
if (!memptr)
WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
" FreeType/2 is not running!",
"Error", 0, MB_OK | MB_ERROR);
else {
meminfo = memptr->address;
if (meminfo->signature != 0x46524545)
WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
" FreeType/2 is not running!",
"Error", 0, MB_OK | MB_ERROR);
else {
flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
FCF_TASKLIST ;
WinRegisterClass(hab, "MyClass",
(PFNWP) ClientWndProc,
CS_SIZEREDRAW, 0);
hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
WS_VISIBLE,
&flFrameFlags,
"MyClass", "FreeType/2 Heap Usage",
0, (HMODULE) NULL,
0, &hwndClient);
WinSetVisibleRegionNotify(hwndClient, TRUE);
/* make titlebar text look better */
WinSetPresParam(WinWindowFromID(hwndFrame, FID_TITLEBAR),
PP_FONTNAMESIZE, 9, (PVOID)"8.Helv");
WinSetWindowPos(hwndFrame, NULLHANDLE, 0, 0, 350, 42,
SWP_MOVE | SWP_SIZE | SWP_SHOW);
while (WinGetMsg(hab, &qmsg, (HWND) NULL, 0, 0))
WinDispatchMsg(hab, &qmsg);
WinSetVisibleRegionNotify(hwndClient, FALSE);
}
}
/* free shared memory block */
DosFreeMem(memptr);
WinDestroyWindow(hwndFrame);
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
}

View File

@@ -0,0 +1,4 @@
ftmem.exe: $*.obj
ilink /PM:PM /ST:0x8000 /BAS:0x10000 /E:2 /A:4 $*.obj
ftmem.obj: $*.c
icc -C $*.c

BIN
contrib/ftos2/ifi/ftmem.ico Normal file

Binary file not shown.

238
contrib/ftos2/ifi/test.c Normal file
View File

@@ -0,0 +1,238 @@
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "32pmifi.h"
//#define USE_ORIG
#ifdef USE_ORIG
#pragma import (fdhdr, "FONT_DRIVER_DISPATCH_TABLE", "TRUETYPE", 0)
#else
#if defined USE_ATM
#pragma import (fdhdr, "FONT_DRIVER_DISPATCH_TABLE", "PMATM", 0)
#else
#pragma import (fdhdr, "FONT_DRIVER_DISPATCH_TABLE", "FREETYPE", 0)
#endif
#endif
extern FDHEADER fdhdr;
char *fontnames[20] = {
"G:\\OS2\\MDOS\\WINOS2\\SYSTEM\\SYMBOL.TTF",
"G:\\OS2\\MDOS\\WINOS2\\SYSTEM\\WINGDING.TTF",
"G:\\PSFONTS\\ARIALB.ttf",
"G:\\PSFONTS\\ARIALI.ttf",
"G:\\PSFONTS\\ARIALZ.ttf",
"G:\\PSFONTS\\COUR.TTF",
"G:\\PSFONTS\\COURB.TTF",
"G:\\PSFONTS\\COURI.TTF",
"G:\\PSFONTS\\COURZ.TTF",
"G:\\PSFONTS\\ARIAL.ttf",
"G:\\PSFONTS\\TIMESB.TTF",
"G:\\PSFONTS\\TIMESI.ttf",
"G:\\PSFONTS\\TIMESZ.ttf",
"G:\\PSFONTS\\TIMES.TTF",
"G:\\PSFONTS\\ARIBLK.ttf",
"G:\\CHINESE\\AVSV.TTF",
"G:\\CHINESE\\MINGLI.TTC",
"D:\\PSFONTS\\TNRMT30.TTF"
};
#define FNTNAME1 "\\PSFONTS\\TIMES.TTF"
#ifdef USE_ATM
#define FNTNAME2 "\\PSFONTS\\helv.ofm"
#else
#define FNTNAME2 "\\PSFONTS\\symbol.tTf"
#endif
#define BUFSIZE 32768
void ShowChar(PCHARATTR pca, PBITMAPMETRICS pbmm) {
int i, j;
int bufwidth = ((pbmm->sizlExtent.cx + 31) & -32) / 8;
for (i =0; i < pbmm->sizlExtent.cy; i++) {
for (j = 0; j < bufwidth * 8; j++)
if (pca->pBuffer[i * bufwidth + j / 8] & (1 << (7-(j % 8))))
printf("*");
else
printf(" ");
printf("\n");
}
}
void main(int argc, char **argv)
{
char fname[260];
PFDDISPATCH pfdisp;
LONG rc;
HFF hff, hff2; /* font file */
HFC hfc, hfc2; /* font context */
static IFIMETRICS ifimet[12]; /* IFI metrics */
CONTEXTINFO ci;
CHARATTR charattr; /* character attributes */
BITMAPMETRICS bmm; /* bit-map metrics */
PBYTE buf;
int glyph = 0, i, j;
int numFaces;
int faceIndex = 0;
switch (argc) {
case 4:
strcpy(fname, argv[1]);
glyph = atoi(argv[2]);
faceIndex = atoi(argv[3]);
break;
case 2:
glyph = atoi(argv[1]);
case 1:
strcpy(fname, FNTNAME1);
break;
default:
strcpy(fname, argv[1]);
glyph = atoi(argv[2]);
}
buf = (PBYTE)malloc(BUFSIZE);
if (strncmp("OS/2 FONT DRIVER", fdhdr.strId, 16)) {
printf("Invalid Font Driver\n");
return;
}
printf("Font Driver OK, ");
printf("Version %d\n", fdhdr.ulVersion);
printf("Technology: %s\n", fdhdr.szTechnology);
hff = fdhdr.pfddisp->FdLoadFontFile(fname);
printf("Loading font... HFF = %X\n", hff);
if (hff == (HFF)0xFFFFFFFF)
return;
/* rc = fdhdr.pfddisp->FdConvertFontFile("G:\\PSFONTS\\TIMES.TTF",
"G:\\PSFONTS", buf); */
#if 0
for (i = 0; i < 18; i++) {
hff = fdhdr.pfddisp->FdLoadFontFile(fontnames[i]);
if (hff == (HFF)-1) {
printf("x");
continue;
}
numFaces = fdhdr.pfddisp->FdQueryFaces(hff, NULL, 0, -1, 0);
if (numFaces < 0) {
printf("x");
continue;
}
for (j = 0; j < numFaces; j++) {
rc = fdhdr.pfddisp->FdQueryFaces(hff, &ifimet[0], 238, 1, j);
if (rc < 0) {
printf("x");
continue;
}
}
rc = fdhdr.pfddisp->FdUnloadFontFile(hff);
if (rc)
printf("x");
else
printf(".");
}
printf("\n");
#endif
hff = fdhdr.pfddisp->FdLoadFontFile(FNTNAME2);
hff = fdhdr.pfddisp->FdLoadFontFile(fname);
rc = fdhdr.pfddisp->FdUnloadFontFile(hff);
hff = fdhdr.pfddisp->FdLoadFontFile(fname);
printf("Loading font... HFF = %X\n", hff);
if (hff == (HFF)0xFFFFFFFF)
return;
numFaces = fdhdr.pfddisp->FdQueryFaces(hff, NULL, 0, -1, 0);
printf("Number of faces = %d\n", numFaces);
rc = fdhdr.pfddisp->FdQueryFaces(hff, &ifimet[0], sizeof(IFIMETRICS), numFaces, 0);
printf("Querying faces... RC = %X\n", rc);
hfc = fdhdr.pfddisp->FdOpenFontContext(hff, faceIndex);
printf("Opening context... HFC = %X\n", hfc);
if (hfc == (HFC)0xFFFFFFFF) {
rc = fdhdr.pfddisp->FdUnloadFontFile(hff);
printf("Unloading font... RC = %X\n", rc);
}
ci.cb = sizeof(ci);
ci.fl = 0;
/* ci.sizlPPM.cx = 3618;
ci.sizlPPM.cy = 3622;
ci.pfxSpot.x = 46340;
ci.pfxSpot.y = 46340;
ci.matXform.eM11 = 511;
ci.matXform.eM12 = 0;
ci.matXform.eM21 = 0;
ci.matXform.eM22 = 511; */
ci.sizlPPM.cx = 3622;
ci.sizlPPM.cy = 3622;
ci.pfxSpot.x = 46340;
ci.pfxSpot.y = 46340;
ci.matXform.eM11 = 768;
ci.matXform.eM12 = 0;
ci.matXform.eM21 = 0;
ci.matXform.eM22 = 768;
rc = fdhdr.pfddisp->FdQueryFaceAttr(hfc, FD_QUERY_ABC_WIDTHS, buf,
sizeof(ABC_TRIPLETS), NULL, glyph);
printf("Querying face attrs... RC = %d\n", rc);
rc = fdhdr.pfddisp->FdQueryFaceAttr(hfc, FD_QUERY_KERNINGPAIRS, buf,
ifimet[0].cKerningPairs * sizeof(FD_KERNINGPAIRS),
NULL, 0);
rc = fdhdr.pfddisp->FdSetFontContext(hfc, &ci);
printf("Setting context... rc = %X\n", rc);
charattr.cb = sizeof(charattr);
charattr.iQuery = FD_QUERY_BITMAPMETRICS | FD_QUERY_CHARIMAGE;
// charattr.iQuery = FD_QUERY_OUTLINE;
charattr.gi = glyph;
charattr.pBuffer = buf;
charattr.cbLen = BUFSIZE;
if (rc == -1)
return;
rc = fdhdr.pfddisp->FdQueryCharAttr(hfc, &charattr, &bmm);
printf("Querying char attrs... bytes = %d\n", rc);
ShowChar(&charattr, &bmm);
// rc = fdhdr.pfddisp->FdQueryCharAttr(hfc, &charattr, &bmm, NULL);
// printf("Querying char attrs... bytes = %d\n", rc);
hff2 = fdhdr.pfddisp->FdLoadFontFile(FNTNAME2);
printf("Loading font... HFF = %X\n", hff2);
if (hff2 == (HFF)0xFFFFFFFF)
return;
charattr.cbLen = 0;
rc = fdhdr.pfddisp->FdQueryCharAttr(hfc, &charattr, &bmm);
printf("Querying char attrs... bytes = %d\n", rc);
rc = fdhdr.pfddisp->FdQueryFaces(hff2, &ifimet[0], sizeof(ifimet), 1, 0);
printf("Querying faces... RC = %X\n", rc);
hfc2 = fdhdr.pfddisp->FdOpenFontContext(hff2, 0);
printf("Opening context... HFC = %X\n", hfc2);
if (hfc2 == (HFC)0xFFFFFFFF) {
rc = fdhdr.pfddisp->FdUnloadFontFile(hff2);
printf("Unloading font... RC = %X\n", rc);
}
rc = fdhdr.pfddisp->FdCloseFontContext(hfc);
printf("Closing context... RC = %X\n", rc);
rc = fdhdr.pfddisp->FdUnloadFontFile(hff);
printf("Unloading font... RC = %X\n", rc);
rc = fdhdr.pfddisp->FdUnloadFontFile(hff);
printf("Unloading font... RC = %X\n", rc);
rc = fdhdr.pfddisp->FdCloseFontContext(hfc2);
printf("Closing context... RC = %X\n", rc);
rc = fdhdr.pfddisp->FdUnloadFontFile(hff2);
printf("Unloading font... RC = %X\n", rc);
rc = fdhdr.pfddisp->FdUnloadFontFile(hff2);
printf("Unloading font... RC = %X\n", rc);
}

View File

@@ -0,0 +1,6 @@
test.exe: $*.obj freetype.lib
ilink /DE /PM:VIO /ST:0x1000 $*.obj freetype.lib
test.obj: $*.c
icc -Ti+ -C -Ss -Sp1 $*.c
freetype.lib: $*.dll
implib $*.lib $*.dll

View File

@@ -0,0 +1,4 @@
test.exe: $*.obj
wlink file $*.obj lib freetype.lib import _fdhdr freetype.FONT_DRIVER_DISPATCH_TABLE
test.obj: $*.c
wcc386 -d2 -zp1 $*.c

30
contrib/ftos2/install.cmd Normal file
View File

@@ -0,0 +1,30 @@
/* */
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
say "Warning: This is your last chance to back out. If you do not wish to"
say "continue, please just press ENTER. Otherwise please type ""yes"""
pull letter
if letter <> "YES" then exit
/* Find drive where OS/2 is installed */
bootdrive = SysSearchPath('PATH', 'OS2.INI')
/* say os2path */
bootdrive = left(bootdrive, 2)
copy "FREETYPE.DLL " || bootdrive || "\os2\dll"
if rc <> 0 then do
say "Error: Could not copy file!"
pause
exit
end
app = "PM_Font_Drivers"
key = "TRUETYPE"
val = "\OS2\DLL\FREETYPE.DLL" || d2c(0)
SysIni('BOTH', app, key, val)
say "Font Driver is installed. Please reboot."
pause

View File

@@ -0,0 +1,72 @@
# This file is part of the FreeType project.
#
# It builds the library and test programs for IBM VisualAge C++ under OS/2.
#
# You will need nmake.
#
# Use this file while in the lib directory with the following statement:
#
# nmake -f arch\os2\Makefile.icc
#
ARCH = arch\os2
FT_MAKEFILE = $(ARCH)\Makefile.icc
FT_MAKE = $(MAKE) -nologo
CC = icc
CFLAGS = -Wcnd- -Wpro- -Ss -Sp1 -Rn -Ge- -O+ -G4 -Q+ -Iarch\os2 -I. -Iextend
#CFLAGS = -Wcnd- -Wpro- -Ss -Sp1 -Rn -Ge- -Ti+ Q+ -Iarch\os2 -I. -Iextend
# NOTE: Optimizations are discarded, as it seems that Visual Age
# is buggy when producing ttraster.obj. The resulting code
# crashes under some circumstances (performing vertical dropout
# control when rendering smoothed outlines)!
TTFILE = $(ARCH)\os2file.c
TTMEMORY = .\ttmemory.c
TTMUTEX = .\ttmutex.c
PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c \
extend\ftxcmap.c extend\ftxwidth.c
OBJS_X = $(SRC_X:.c=.obj)
SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c \
ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c \
ttextend.c $(PORT)
OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
SRC_S = $(ARCH)\freetype.c
OBJ_S = $(SRC_S:.c=.obj)
OBJS_S = $(OBJ_S) $(OBJS_X)
all:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_S)" libttf.lib
debug:
$(FT_MAKE) -f $(FT_MAKEFILE) LIB_FILES="$(OBJS_M)" libttf.lib
$(OBJ_S): $(SRC_S) $(SRC_M)
$(CC) -C $(CFLAGS) /Fo$@ $*.c
$(OBJS_X):
$(CC) -C $(CFLAGS) /Fo$@ $*.c
$(ARCH)\os2file.obj:
$(CC) -C $(CFLAGS) /Fo$@ $*.c
libttf.lib: $(LIB_FILES)
!ilib /nologo /noignorecase /nobackup $@ -+$?,,
clean:
-del *.obj
-del extend\*.obj
-del arch\os2\*.obj
distclean: clean
-del libttf.lib
# end of Makefile.icc

View File

@@ -0,0 +1,41 @@
# This file is part of the FreeType project.
# Modified for FTIFI - Mike
#
# It builds the library and test programs using Watcom C/C++ under OS/2.
#
# You will need nmake!!
# If you can change this makefile to work with wmake, please
# inform me.
#
# Use this file while in the lib directory with the following statement:
#
# nmake -f arch\os2\Makefile.icc
CC = wcc386
CFLAGS = -4r -Otexan -zp1 -bd -zc -Iarch\os2 -I. -Iextend
SRC = ttapi.c ttcache.c ttcalc.c ttcmap.c tterror.c \
ttfile.c ttgload.c ttinterp.c ttlists.c ttload.c \
ttmemory.c ttmutex.c ttobjs.c ttraster.c ttextend.c \
\
extend\ftxgasp.c extend\ftxkern.c
OBJ = $(SRC:.c=.obj)
.c.obj:
$(CC) $(CFLAGS) $*.c
all: libttf.lib
libttf.lib: $(OBJ)
-move ft*.obj extend
!wlib -c $@ -+$?
clean:
-del *.obj
-del extend\*.obj
distclean: clean
-del libttf.lib
# end of Makefile.wcc

View File

@@ -0,0 +1,385 @@
/*******************************************************************
*
* ttmemory.c 1.2
*
* Memory management component (body).
*
* Copyright 1996, 1997 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* Portions Copyright 1998 by Michal Necasek
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
* license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
*
* Changes between 1.1 and 1.2:
*
* - the font pool is gone.
*
* - introduced the FREE macro and the Free function for
* future use in destructors.
*
* - Init_FontPool() is now a macro to allow the compilation of
* 'legacy' applications (all four test programs have been updated).
*
* Note: This code was slightly adapted for use in the OS/2
* Font Driver (FreeType/2).
*
******************************************************************/
#include "ttdebug.h"
#include "ttmemory.h"
#include "ttengine.h"
#define INCL_DEV
#include <os2.h>
#include <pmddi.h>
#include <stdlib.h>
#undef DEBUG_MEM
/* -------------------- debugging defs ----------------------- */
/* DEBUG_MEM creates a file and logs all actions to it */
#ifdef DEBUG_MEM
static HFILE MemLogHandle = NULLHANDLE;
static ULONG Written = 0;
static char log[2048] = "";
static char buf[2048] = "";
char* itoa10( int i, char* buffer ) {
char* ptr = buffer;
char* rptr = buffer;
char digit;
if (i == 0) {
buffer[0] = '0';
buffer[1] = 0;
return buffer;
}
if (i < 0) {
*ptr = '-';
ptr++; rptr++;
i = -i;
}
while (i != 0) {
*ptr = (char) (i % 10 + '0');
ptr++;
i /= 10;
}
*ptr = 0; ptr--;
while (ptr > rptr) {
digit = *ptr;
*ptr = *rptr;
*rptr = digit;
ptr--;
rptr++;
}
return buffer;
}
static const char* hexstr = "0123456789abcdef";
char* itohex2( int i, char* buffer )
{
buffer[0] = hexstr[ (i >> 12) & 0xF ];
buffer[1] = hexstr[ (i >> 8 ) & 0xF ];
buffer[2] = hexstr[ (i >> 4 ) & 0xF ];
buffer[3] = hexstr[ (i ) & 0xF ];
buffer[4] = '\0';
return buffer;
}
char* itohex4( long i, char* buffer )
{
itohex2( (i >> 16) & 0xFFFF, buffer );
/* We separate the high and low part with a dot to make it */
/* more readable */
buffer[4] = '.';
itohex2( i & 0xFFFF, buffer+5 );
return buffer;
}
#define COPY(s) strcpy(log, s)
#define CAT(s) strcat(log, s)
#define CATI(v) strcat(log, itoa10( (int)v, buf ))
#define CATH(v) strcat(log, itohex4( (long)v, buf ))
#define CATW(v) strcat(log, itohex2( (short)v, buf ))
#define WRITE DosWrite(MemLogHandle, log, strlen(log), &Written)
#define ERRRET(e) { COPY("Error at "); \
CATI(__LINE__); \
CAT("\r\n"); \
WRITE; \
return(e); \
}
#else
#define COPY(s)
#define CAT(s)
#define CATI(v)
#define CATH(v)
#define CATW(v)
#define WRITE
#define ERRRET(e) return(e);
#endif /* DEBUG_MEM */
#undef TRACK_MEM
/* TRACK_MEM allows online tracking of memory usage online (via shared */
/* memory). It is used in conjunction with the FTMEM utility. */
#ifdef TRACK_MEM
/* name of shared memory used for memory usage reporting */
#define MEM_NAME "\\sharemem\\freetype"
/* structure containing memory usage information */
typedef struct _INFOSTRUCT {
ULONG signature; /* signature (0x46524545, 'FREE') */
ULONG used; /* bytes actually used */
ULONG maxused; /* maximum amount ever used */
ULONG num_err; /* number of (de)allocation errors */
} INFOSTRUCT, *PINFOSTRUCT;
/* structure (in named shared memory) pointing to the above struct */
typedef struct _INFOPTR {
PINFOSTRUCT address; /* pointer to actual memory info */
} INFOPTR, *PINFOPTR;
PINFOSTRUCT meminfo; /* struct in shared memory holding usage info */
PINFOPTR memptr;
#endif
/* -----------------------------------------------------------------
A brief explanation of the memory allocator :
- We store the block's size in front of it. The size implies the nature
of the block, and selects a de-allocation scheme..
- A note on the memory debugging schemes: logging and online tracking
are independent of each other and none, either or both may be used.
----------------------------------------------------------------- */
/****************************************************************/
/* */
/* Allocate a block of memory */
/* */
static
void* ft2_malloc( long size )
{
long* head;
void* base;
int rc;
/* add header size */
size += sizeof(long);
/* Allocate memory accessible from all processes */
if (( rc = SSAllocMem( (PVOID)&head, size, 0 )))
{
COPY( "ft2_malloc: block SSAllocMem failed with rc = " );
CATH( rc );
CAT ( "\r\n" );
WRITE;
return NULL;
}
*head = size;
base = (void*)(head + 1);
#ifdef TRACK_MEM
meminfo->used += size;
if (meminfo->used > meminfo->maxused)
meminfo->maxused = meminfo->used;
#endif
return base;
}
/****************************************************************/
/* */
/* Release a block of memory */
/* */
int ft2_free( void* block )
{
long* head;
long size, offset;
int rc, h;
if (!block)
return -1;
head = ((long*)block) - 1;
size = *head;
if (size <= 0)
{
COPY( "ft2_free: negative size !!\r\n" );
WRITE;
return -1;
}
rc = SSFreeMem( (PVOID)head );
if (rc)
{
COPY( "ft2_free: block SSFreeMem failed with rc = " );
CATI( rc );
CAT ( "\r\n" );
WRITE;
}
#ifdef TRACK_MEM
meminfo->used -= size;
#endif
return rc;
}
/*******************************************************************
*
* Function : TT_Alloc
*
* Description : Allocates memory from the heap buffer.
*
* Input : Size size of the memory to be allocated
* P pointer to a buffer pointer
*
* Output : Error code.
*
* NOTE: The newly allocated block should _always_ be zeroed
* on return. Many parts of the engine rely on this to
* work properly.
*
******************************************************************/
TT_Error TT_Alloc( long Size, void** P )
{
if ( Size )
{
*P = ft2_malloc( Size );
if (!*P) {
#ifdef TRACK_MEM
meminfo->num_err++;
#endif
return TT_Err_Out_Of_Memory;
}
/* MEM_Set( *P, 0, Size); */ /* not necessary, SSAllocMem does it */
}
else
*P = NULL;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TT_Free
*
* Description : Releases a previously allocated block of memory.
*
* Input : P pointer to memory block
*
* Output : Always SUCCESS.
*
* Note : The pointer must _always_ be set to NULL by this function.
*
******************************************************************/
TT_Error TT_Free( void** P )
{
if ( !P || !*P )
return TT_Err_Ok;
if (ft2_free( *P )) {
#ifdef TRACK_MEM
meminfo->num_err++;
#endif
}
*P = NULL;
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Init
*
* Description : Initializes the memory.
*
* Output : Always SUCCESS.
*
******************************************************************/
TT_Error TTMemory_Init()
{
int rc;
#ifdef DEBUG_MEM
ULONG Action;
DosOpen("C:\\FTMEM.LOG", &MemLogHandle, &Action, 0, FILE_NORMAL,
OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS,
OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_WRITE_THROUGH |
OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_WRITEONLY,
NULL);
COPY("FTMEM Init.\r\n");
WRITE;
#endif /* DEBUG */
#ifdef TRACK_MEM
/* allocate named shared memory and global shared memory */
SSAllocMem(&meminfo, 4096, 0);
DosAllocSharedMem((PVOID*)&memptr, MEM_NAME, 4096, fALLOC);
memptr->address = meminfo;
meminfo->signature = 0x46524545; /* 'FREE' */
meminfo->maxused = 0;
meminfo->used = 0;
#endif /* TRACK */
return TT_Err_Ok;
}
/*******************************************************************
*
* Function : TTMemory_Done
*
* Description : Finalizes memory usage.
*
* Output : Always SUCCESS.
*
******************************************************************/
TT_Error TTMemory_Done()
{
/* Never called by the font driver (beats me why). We do not
release the heaps */
#ifdef TRACK_MEM
DosFreeMem(memptr); /* free shared memory */
SSFreeMem(meminfo);
#endif
#ifdef DEBUG_MEM
COPY("FTMEM Done.\r\n");
WRITE;
DosClose(MemLogHandle);
#endif
return TT_Err_Ok;
}
/* END */

63
contrib/ftos2/limit.cmd Normal file
View File

@@ -0,0 +1,63 @@
/* */
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
Parse Upper Arg a1 a2
app = "FreeType/2"
key = "OPENFACES"
if Arg() = 0 then call usage
if a1 = 'Q' then call query
if a1 = 'S' then call set
call usage
set:
val = a2
if val = '' then do
say 'Invalid limit!'
exit
end
if val < 8 then do
say 'The lowest acceptable limit is 8!'
pause
exit
end
szval = val || d2c(0)
rc = SysIni('USER', app, key, szval)
say rc
if rc = 'ERROR:' then do
say 'Error updating OS2.INI!'
pause
exit
end
say "Open faces limit updated to " || val || ". Please reboot to activate changes."
pause
exit
query:
val = SysIni('USER', app, key)
if val = "ERROR:" then val = "not set"
/* strip the terminating NULL character */
else val = substr(val, 1, pos(d2c(0), val) - 1)
say 'The current open faces limit is ' || val
pause
exit
usage:
say 'This program is used to set the limit of concurrently open typefaces for'
say 'FreeType/2. Use lower numbers to limit memory consumption and higher to'
say 'improve performance if you use lots of fonts.'
say
say 'Usage: LIMIT q - query the current limit'
say ' LIMIT s <val> - set limit to <val> (effective on next reboot).'
pause

15
contrib/ftos2/query.cmd Normal file
View File

@@ -0,0 +1,15 @@
/* */
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
app = "PM_Font_Drivers"
key = "TRUETYPE"
val = SysIni('USER', app, key)
if val = "ERROR:" then val = "none"
/* strip the terminating NULL character */
else val = substr(val, 1, pos(d2c(0), val) - 1)
say 'The current TrueType driver is ' || val
pause

87
contrib/ftos2/readme.1st Normal file
View File

@@ -0,0 +1,87 @@
This is the source code from the FreeType/2 OS/2 font driver.
Copyright (C) 1997-1998 Michal Necasek (mike@mendelu.cz).
Here's a description of the files in this package :
readme.1st This file
readme.txt The FreeType/2 Readme
FAQ The FreeType/2 user faq
DEVELFAQ The FreeType/2 developer faq. Read it before trying to
compile this program
install.cmd The FreeType/2 installation script
uninstall.cmd The FreeType/2 uninstallation script
query.cmd A script used to query the name of the current font driver
limit.cmd The driver controls the number of font files it keeps
opened at the same time, in order to save system resources
and memory (of course, this _doesn't_ limit the number of
opened fonts in PM, it just saves a _lot_ of memory when
many fonts are installed on your system).
This script let you change this limit. It can be useful
if you use font-intensive applications (like DTP) and
want better performance (to the sake of memory).
update.cmd The FreeType/2 update script
ifi/ Source code of the FreeType/2 font driver proper
lib/ files that must be added to the standard FreeType 1.1
release. They take the place of the files located in
the corresponding "lib" file.
lib/ttmemory.c replacement for the FreeType memory
manager component. This one uses the GRE
shared memory segment allocater, and is
required.
lib/arch/makefile.icc Makefile to compile the FreeType library for
FreeType/2 with Visual Age. You'll need nmake.
lib/arch/makefile.wat Makefile to compile with Watcom. NOTE that
you'll ALSO need nmake (wmake won't work !!)
Here's how to compile the font driver.
0. Read the DEVELFAQ ! Now ! Then make a WPS backup !
1. Get the FreeType library, and copy the "lib" hierarchy into it to
replace the related files (i.e. ttmemory.c and makefiles).
2. Compile FreeType with the new files, simply go to "freetype/lib"
and type :
nmake -f arch\os2\makefile.icc for VisualAge
nmake -f arch\os2\makefile.wat for Watcom
3. Adjust the makefiles in "ifi" to reflect the location of the
library file "libttf.lib" that was generated previously.
5. Compile the font driver. Go to the "ft_os2/ifi" directory, then type
nmake -f freetype.icc for VisualAge
nmake -f freetype.wat for Watcom
You should have created a file called "FreeType.dll". Copy it to
your "ft_os2" directory..
6. Run the "install.cmd" script, then reboot after closing all
applications.
7. When your desktop is back, go to the font palette and try to
install some new TrueType fonts. Enjoy the difference :-)
8. You can also compile a small memory usage dumper called "ftmem.c"
to know how much memory the driver is using. Simply do
nmake -f ftmem.icc for VisualAge
nmake -f ftmem.wat for Watcom
Then launch it. A small window will appear with the current amount
of memory allocated by the driver.

113
contrib/ftos2/readme.txt Normal file
View File

@@ -0,0 +1,113 @@
* * * FreeType/2 * * *
(Version 1.0, 5. November 1998)
Copyright (C) 1997,1998 Michal Necasek <mike@mendelu.cz>
Copyright (C) 1997,1998 The FreeType Development Team
Motto: "OS/2 is dead? Again? Thanks for telling me, I'd never notice!"
*** if you are upgrading from previous version, please see the FAQ (Q15) ***
- First a short Q&A:
Q1: What's this?
A1: This is what OS/2 users have been waiting for only too long - a free,
high-quality TrueType renderer a.k.a. Font Driver conforming to the
OS/2 Intelligent Font Interface specification. It is based on FreeType -
a free portable library for using TrueType fonts.
Please note that although this code is free the FreeType team and
I will cheerfully accept any donations by happy users ;-) (not that I
expect to get any)
Q2: How do I use this?
A2: Go to OS/2 command line and run INSTALL.CMD from the directory containing
FREETYPE.DLL. This will replace the original IBM TrueType driver if it is
installed.
Q3: Where's the disclaimer?
A3: No, don't worry, I didn't forget that. I of course provide NO WARRANTY
that this code will work as you expect. Use only at your OWN RISK!
Q4: What should I do RIGHT NOW?
A4: Before attempting to install this driver, you are STRONGLY advised
to archive your current configuration (Set Desktop Properties/Archive/
Create archive at each startup, then reboot. Then of course switch archiving
off). It is always possible your system won't boot with the font driver
installed. You can risk it, but I warned you! You know how nasty the
computers can be ;-)
Q5: What about the license?
A5: This code is distributed under the FreeType license.
It is free and the source code is available as part of the FreeType
distribution.
Q6: How do I get rid of this?
A6: Ah, right question. Just run UNINSTALL.CMD. That removes the font driver
(not physically, it just isn't used on next startup) and restores the
original TRUETYPE.DLL if it exists.
Q7: Is there something else?
A7: Yes, be prepared that the fonts just kick ass! You will no longer have
to envy those poor souls still using the so-called 95% OS from THAT
unspeakable company starting with the letter M ;-)
- Current features/bugs/limitations:
Features : - outlines
- scaled/rotated text
- supports printed output
- works with TTCs (TrueType collections)
- national characters (if provided in the font, of course);
should work with all Latin codepages, Cyrillic and Greek.
- partial DBCS support - Traditional Chinese should work about
98%. Fonts like Times New Roman MT30 should work on all
systems. If you want your language to be supported, you can
apply at <mike@mendelu.cz> and become a Beta tester.
Bug/feature: - unharmonious glyph spacing in some applications. This seems
to come from OS/2's WYSIWYG glyph placement policy. This
is more or less visible depending on the application. We
can't do a lot about this... At least it's true WYSIWYG and
no nasty surprises when printing.
Limitations: - no grayscaling (a.k.a. antialiasing) - this is a limitation
of OS/2, not my code. If OS/2 starts supporting it, I'll
implement it the moment I lay my hands on the specs :)
Unfortunately it most probably won't happen any too soon.
Anyway, you have to bug IBM about this one, not me!
- Planned features and features under consideration:
- possibly adding even support for Type 1 fonts, but that depends on
further FreeType engine development. Looks quite probable now.
And finally, thanks go to:
- the FreeType team, the makers of FreeType. Without them, my work would be
impossible.
- especially David Turner of FreeType for his help, advice and support
- Robert Muchsel, I used one or two ideas from his code
- Marc L Cohen, Ken Borgendale and Tetsuro Nishimura from IBM. They provided
me with lots of extremely valuable 'inside' information.
- and last but not least - IBM, for providing us with the wonderful OS/2.
And for giving out the necessary docs for free. If all companies did
that, the world would be a better place.
Information on FreeType is available at
http://www.freetype.org
Please send bug reports/suggestions and comments to :
freetype-os2@physiol.med.tu-muenchen.de
Greetings can also be sent directly to the author at : mike@mendelu.cz
And if you didn't know, IBM and OS/2 are registered trademarks of the
International Business Machines Corporation.

60
contrib/ftos2/uninst.c Normal file
View File

@@ -0,0 +1,60 @@
/* */
/* UNINST - FreeType/2 uninstaller */
/* */
/* Copyright 1998 Michal Necasek <mike@mendelu.cz> */
/* */
/* UNINSTALL.CMD rewritten in C - apparently the REXX version fails */
/* when OS/2 is booted to command line. This causes problems if */
/* FreeType/2 prevents PM from starting successfully. */
/* */
/* Note: This can be compiled as 16-bit app to keep the size down. */
#define INCL_NOXLATE_WIN16
#define INCL_NOXLATE_DOS16
#define INCL_WINSHELLDATA
#define INCL_DOSMISC
#include <os2.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
char szApp[] = "PM_Font_Drivers";
char szKey[] = "TRUETYPE";
char szBuffer[300];
void main(void) {
ULONG ulBootDrv;
USHORT usLen = 0;
APIRET rc;
char c;
usLen = PrfQueryProfileString(HINI_USERPROFILE, szApp, szKey, NULL,
(PVOID)szBuffer, 260L);
if (!strcmp("\\OS2\\DLL\\FREETYPE.DLL", szBuffer)) {
if(!PrfWriteProfileString(HINI_USERPROFILE, szApp, szKey, NULL))
goto err;
printf("FreeType/2 successfully removed.\n");
printf("Do you wish to restore TRUETYPE.DLL (y/n)? ");
c = getch();
if (c != 'y' && c != 'Y')
return;
if(!PrfWriteProfileString(HINI_USERPROFILE, szApp, szKey,
"\\OS2\\DLL\\TRUETYPE.DLL"))
goto err;
printf("\nTRUETYPE.DLL successfully restored");
}
else {
printf("FreeType/2 not installed!");
return;
}
return;
err:
printf("Uninstallation failed!");
}

View File

@@ -0,0 +1,34 @@
/* */
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
say "This utility will remove the FreeType/2 font driver and install "
say "the original TRUETYPE.DLL if it exists. If you do not wish to"
say "continue, please just press ENTER. Otherwise please type ""y"""
pull letter
if letter <> "Y" then exit
/* Find drive where OS/2 is installed */
bootdrive = SysSearchPath('PATH', 'OS2.INI')
bootdrive = left(bootdrive, 1)
app = "PM_Font_Drivers"
key = "TRUETYPE"
/* look for TRUETYPE.DLL */
rc = SysFileTree(left(bootdrive,1) || ":\OS2\DLL\TRUETYPE.DLL", "file", "F")
if file.0 = 1 then do
say "Restoring TRUETYPE.DLL..."
val = "\OS2\DLL\TRUETYPE.DLL" || d2c(0)
SysIni('BOTH', app, key, val)
end
else do
say "Uninstalling FREETYPE.DLL..."
SysIni('BOTH', app, key, "DELETE:")
end
say "FTIFI is uninstalled. Please reboot."
pause

BIN
contrib/mac/mac.hqx Normal file

Binary file not shown.

View File

@@ -0,0 +1,5 @@
ttf2bdf
config.status
config.cache
config.log
Makefile

View File

@@ -0,0 +1,74 @@
#
# $Id: Makefile.in,v 1.4 1998/12/06 18:50:22 mleisher Exp $
#
#
# Copyright 1996, 1997, 1998 Computing Research Labs, New Mexico State
# University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
# OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
RM = @RM@
MKINSTALLDIRS = ../../mkinstalldirs
CC = @CC@
CFLAGS = @XX_CFLAGS@ @CFLAGS@
SRCS = remap.c ttf2bdf.c
OBJS = remap.o ttf2bdf.o
#
# Point these at the FreeType source directories.
#
INCS = @CPPFLAGS@
LIBS = @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
all: ttf2bdf
ttf2bdf: $(OBJS)
$(PURIFY) $(CC) $(STATIC) $(CFLAGS) -o ttf2bdf $(OBJS) $(LIBS)
clean:
$(RM) -f *.o *BAK *CKP *~ a.out core
realclean: clean
$(RM) -f ttf2bdf
distclean: clean
$(RM) -f ttf2bdf config.* Makefile
.c.o:
$(CC) $(CFLAGS) $(INCS) -c $< -o $@
install: ttf2bdf
@$(MKINSTALLDIRS) $(bindir) $(mandir)/man1
@cp ttf2bdf $(bindir)/ttf2bdf
@cp ttf2bdf.man $(mandir)/man1/ttf2bdf.1
uninstall:
@$(RM) -f $(bindir)/ttf2bdf
@$(RM) -f $(mandir)/man1/ttf2bdf.1
# end of Makefile

315
contrib/ttf2bdf/README Normal file
View File

@@ -0,0 +1,315 @@
#
# $Id: README,v 1.18 1999/08/19 16:30:24 mleisher Exp $
#
#
# Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
# New Mexico State University
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
# OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
# THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
This is version 2.7 of a program to convert TrueType fonts to BDF fonts using
the FreeType renderer.
BDF fonts can be edited using the XmBDFEditor which is available from (replace
the <version> with the most current version number):
[Sources]
ftp://crl.nmsu.edu/CLR/multiling/General/xmbdfed.tar.gz
[Binaries: Linux/Pentium, Solaris, SunOS]
ftp://crl.nmsu.edu/CLR/multiling/General/xmbdfed-<version>-ELF.tar.gz
ftp://crl.nmsu.edu/CLR/multiling/General/xmbdfed-<version>-SOLARIS.tar.gz
COMPILING ttf2bdf
-----------------
1. Pick up the latest FreeType distribution from:
ftp://ftp.physiol.med.tu-muenchen.de/pub/freetype/devel/freetype-current.tar.gz
2. Unpack FreeType and build it.
3. Go into the "contrib/ttf2bdf/" directory and type "make" to build "ttf2bdf".
RUNNING ttf2bdf
---------------
Type the following to get a list of command line options:
% ttf2bdf -h
ACKNOWLEDGEMENTS
----------------
Thanks go to the following people:
Robert Wilhelm <robert@physiol.med.tu-muenchen.de> for pointing out a
crucial problem with the pre-1.0 code.
Lho Li-Da <ollie@ms1.hinet.net> for pointing out a problem with Big5 and
GB2312 encoding ids being documented incorrectly in the TT docs and a
problem with glyphs that are height 1 or width 1, and a font name problem.
Adrian Havill <havill@threeweb.ad.jp> for unintentionally pointing out a
missing feature.
Richard Verhoeven <rcb5@win.tue.nl> for pointing out a font names problem,
problem with bitmaps missing their last byte in each row, and an invalid
FONT_DESCENT property value.
Choi Jun Ho <junker@jazz.snu.ac.kr> for his inspiration from his
implementation that changed some character set names, and added a
number of new command line parameters.
Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz> for providing some
critical grid fitting and metrics fixes when generating the bitmaps,
adding the code to "auto-detect" bold and italic fonts, removing the
dependency on ttobjs.h, finding some remapping bugs, and other fixes.
Matti Koskinen <mjkoskin@sci.fi> for pointing out a problem with using
the code 0xffff.
Eugene Bobin <gene@ftim.ustu.ru> for contributing the Cyrillic mapping
tables (iso8859.5, koi8.r, windows.1251) and the sample shell scripts for
generating sets of BDF fonts.
Oleg N. Yakovlev <yashka@optima.dnepropetrovsk.ua> for alerting me to the
problem of certain codes not being loaded correctly in the mapping tables.
Bertrand Petit <elrond@phoe.frmug.org> for providing additional command line
parameters to allow more control over the XLFD name generated.
Roman Czyborra <czyborra@cs.tu-berlin.de> for pointing out the need for a
change from UNICODE-2.0 to ISO10646-1 in the font XLFD name.
Mike Blazer <blazer@mail.nevalink.ru> for pointing out the include changes
needed to compile on Windows.
Solofo Ramangalahy <solofo@mpi-sb.mpg.de> for contributing the ISO8859.1 and
ISO8859.3 mapping tables.
Antoine Leca <Antoine.Leca@renault.fr> for suggesting the exchange of
columns in the mapping table to better fit the mapping table format used by
many.
Robert Brady <rwb197@ecs.soton.ac.uk> for pointing out a problem with the
length of _XFREE86_GLYPH_RANGES properties and an Exceed font compiler.
CHANGES
-------
Version 2.7
===========
1. Swapped all the columns in the mapping files.
2. Changed the mapping table loader to index on the second column instead of
the first.
3. Reduced the line length of _XFREE86_GLYPH_RANGES properties to 256
instead of 512.
Version 2.6
===========
1. Changed the includes to deal with compilation on Windows.
2. Added some new mapping tables.
Version 2.5
===========
1. Updated the copyright dates.
2. Fixed an incorrect parameter for Traditional C compilers.
3. Added generation of the _XFREE86_GLYPH_RANGES properties.
Version 2.4
===========
1. Change all CRLF's, CR's, or LF's in copyright strings to double spaces.
2. Changed it so gcc 2.8.1 likes the return type of main() again.
Version 2.3
===========
1. Changed Makefile.in a bit to make installation more consistent.
2. Changed the lower limit for the vertical and horizontal resolutions to be
10dpi instead of 50dpi.
Version 2.2
===========
1. Added missing documentation in the manual page.
2. Added the `-u' parameter to allow setting the character used to replace
dashes or spaces in the font name.
3. Changed the CHARSET_REGISTRY and CHARSET_ENCODING to be "ISO10646-1"
instead of "Unicode-2.0".
4. The numGlyphs property comes back incorrect for some fonts, so the loop
cycles through all 65536 possibilities every time now.
Version 2.1
===========
1. Added patches provided by Bertrand Petit.
2. Insured compatibility with FreeType 1.1.
Version 2.0
===========
1. Created two new subdirectories. One for mapping tables and one for any
other contributed code, scripts, or data.
2. Updated Cyrillic mapping files sent by Eugene Bobin.
3. Minor fixes to make compatible with the latest version of FreeType.
Version 1.9
===========
1. Fixed a problem with the first code of a mapping table being lost.
Version 1.8
===========
1. Added the Unicode->Cyrillic mapping tables provided by Eugene Bobin.
2. Created a shell script based on Eugene Bobin's scripts to generate sets
of BDF fonts at one time.
Version 1.7
===========
1. If a remapping table is provided, code ranges are now expected to be
specified in terms of the codes in the mapping table.
2. The glyph generation loop is improved a bit.
Version 1.6
===========
1. Added two expected keywords REGISTRY and ENCODING in the remap files.
These values are used when the font's XLFD name is generated.
2. Added TTF2BDF_VERSION macro used for adding the "Converted by" comment.
3. Handle the case of no glyphs being generated. No BDF font is produced.
4. Updated for new API with TT_Engine.
Version 1.5
===========
1. Fixed a problem with updating the average width field of the XLFD
font name.
2. Changed things so bitmaps are generated to a temporay file so an
accurate count and metrics can be calculated.
3. Changed things so the font header is not generated until the bitmaps
have been generated. This allows accurate calculations of the various
fields needed.
4. Added the '-l' command line parameter that allows specification of a
subrange of glyphs to generate. The syntax is the same as that used in
X11 for subranges. See the X11 XLFD documentation, page 9 for more
detail.
Example:
% ttf2bdf -l '60 70 80_90' font.ttf -o font.bdf
The command above will only generate the glyphs for codes 60, 70,
and 80 through 90 inclusive.
5. Added the ability to load a mapping table that will remap a font to
another character set. The mapping table should have two columns.
The first column should be the hexadecimal code of the glyph in the
"cmap" table ttf2bdf is using. The second column should have the
code which should be used in the BDF font. An example mapping file
is provided which will map fonts from Unicode (default cmap table) to
ISO8859-2.
6. Fixed grid fitting to avoid dropout in some cases.
7. Removed dependency on ttobjs.h by using the new API function for
retrieving strings.
8. Removed warning about getpid() on Solaris.
9. Rearranged the man page a bit to be more useful. Minor
improvements also done.
10. Changed the loop so it does not include 0xffff as a code because
it causes crashes when converting some fonts.
Version 1.4 [Never released as binaries]
===========
1. Changed the names of two MS encodings (Wansung and Johab) to
KSC5601.1987 and KSC5601.1992.
2. Added the '-n' command line flag to turn hinting off.
3. Added the '-c' command line flag to set the font spacing.
4. Added the '-t', '-w', and '-s' command line options to override the
default typeface, weight and slant names.
Version 1.3
===========
1. Converted to use the new FreeType API.
2. Added the '-rh' and '-rv' command line parameters to allow both the
horizontal and vertical resolutions to be set individually.
3. Fixed a problem with ignoring undefined glyphs. All undefined were
being rendered which caused missing glyphs on the end.
4. Fixed a problem with offset calculations needed to render glyph
bitmaps.
Version 1.2
===========
1. Fixed a problem with dashes that appear in the font family name causing
parse problems with the XLFD font names.
2. Fixed a problem with certain bitmaps missing their final byte on each
row.
3. Fixed an incorrect FONT_DESCENT value.
4. Changed things around so names can be retrieved in a more general way.
5. Fixed a problem with bitmaps not being generated after a certain point.
Version 1.1
===========
1. Fixed the actual glyph count for the CHARS line.
2. Swapped the Big5 and GB2312 XLFD encoding strings because of incorrect TT
specifications.
3. Fixed a problem with bitmap generation for glyphs that are width 1 or
height 1.
4. Added command line parameters to set the font and render pool memory
sizes in Kilobytes from the command line.
Version 1.0
===========
1. Initial release.
mleisher@crl.nmsu.edu (Mark Leisher)
15 October 1997

1357
contrib/ttf2bdf/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
dnl $Id: configure.in,v 1.1 1998/01/14 21:45:26 mleisher Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(../../lib/freetype.h)
AC_PROG_CC
OLDLIBS=$LIBS
LIBS="$LIBS -L../../lib/.libs"
CPPFLAGS="$CPPFLAGS -I../../lib"
AC_CHECK_LIB(ttf, TT_Init_FreeType, LIBS="$LIBS -lttf",[
AC_MSG_ERROR([Can't find ttf library! Compile FreeType first.])])
AC_SUBST(LIBS)
dnl get Compiler flags right.
if test "x$CC" = xgcc; then
XX_CFLAGS="-Wall -pedantic"
else
case "$host" in
alpha-dec-osf*)
XX_CFLAGS="-std1 -O2 -g3"
;;
*)
XX_CFLAGS=
;;
esac
fi
AC_SUBST(XX_CFLAGS)
AC_CHECK_PROG(RM, rm, rm)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl Checks for library functions.
AC_FUNC_MEMCMP
AC_OUTPUT(Makefile)

View File

@@ -0,0 +1,28 @@
#!/usr/local/bin/perl
#
# hack a XFLD info - alias all fonts, declared as koi8*, to iso8859-1
#
# usage:
# cd fontdir; ../ISO2koi < fonts.dir >> fonts.alias
#
# 1996/08/29 - vsv
#
while (<>) {
chop;
($z, $koi8) = split /[ \t]+/;
$iso = $koi8;
$iso =~ s/-koi8r-1/-iso8859-1/g;
$iso =~ s/-koi8-1/-iso8859-1/g;
$iso =~ s/-koi8-r/-iso8859-1/g;
$iso =~ s/-cronyx-/-adobe-/g;
$iso =~ s/-cronix-/-adobe-/g;
## $iso =~ s/-cronix-/-hack-/g;
## $iso =~ s/-cronyx-/-hack-/g;
# Elvis+ fonts...
## $iso =~ s/-adobe-/-hack-/g;
## $iso =~ s/-dec-/-hack-/g;
next if ("$iso" !~ /-iso8859-/);
@z = split (/-/, $iso);
# no matter, 10 or 12, must be more then 3-4 ;)
printf ("\"%s\"\t\"%s\"\n", $iso, $koi8) if (@z > 10);
}

View File

@@ -0,0 +1,60 @@
#!/bin/csh
# -*- mode:SH; -*-
#
# This script creates series of bdf files from TTF file.
#
#
# Please set up parameters
#
# Font dpi:
set DPI=96
#
# TrueType files dir.
set ttf_dir=~/ttf
# TTF files, please specify only base name
# Script will try to use BolD, Italic and BoldItalic versions of face
set FACES="ARIAL ARIBLK ARIALN TAHOMA TIMES VERDANA"
# Output codepage
# koi8.r
# windows.1251
# iso8859.5
# iso8859.2
set LANG_ID=koi8.r
foreach x ( 7 8 9 10 11 12 14 16 18 20 24 30 50 100 150)
foreach z ( $FACES )
set y = ${ttf_dir}/${z}
#
# Simple face
if( -e ${y}.TTF ) then
echo ${y} at ${x}pt
./ttf2bdf -m $LANG_ID -p $x -r $DPI ${y}.TTF | bdftopcf | compress > ${DPI}dpi/${z}${x}.pcf.Z
endif
#
# Bold face
if( -e ${y}BD.TTF ) then
echo Bold ${y} at ${x}pt
./ttf2bdf -m $LANG_ID -p $x -r $DPI -w bold ${y}BD.TTF | bdftopcf | compress > ${DPI}dpi/${z}bd${x}.pcf.Z
endif
#
# Italic face
if( -e ${y}I.TTF ) then
echo Italic ${y} at ${x}pt
./ttf2bdf -m $LANG_ID -p $x -r $DPI -s o ${y}I.TTF | bdftopcf | compress >${DPI}dpi/${z}i${x}.pcf.Z
endif
#
# Bold Italic face
if( -e ${y}BI.TTF ) then
echo Bold Italic ${y} at ${x}pt
./ttf2bdf -m $LANG_ID -p $x -r $DPI -w bold -s o ${y}BI.TTF | bdftopcf | compress > ${DPI}dpi/${z}bi${x}.pcf.Z
endif
end
end
echo Creating fonts directory...
cd ${DPI}dpi
mkfontdir

View File

@@ -0,0 +1,59 @@
#!/bin/csh
# -*- mode:SH; -*-
#
# This script creates series of bdf files from TTF file.
#
#
# Please set up parameters
#
# Font dpi:
set DPI=96
#
# TrueType files dir.
set ttf_dir=~/ttf
# TTF files, please specify only base name
# Script will try to use BolD, Italic and BoldItalic versions of face
set FACES="COUR MONOTYPE"
# Output codepage
# koi8.r
# windows.1251
# iso8859.5
# iso8859.2
set LANG_ID=koi8.r
foreach x ( 7 8 9 10 11 12 14 16 18 20 24 30 50 100 150)
foreach z ( $FACES )
set y = ${ttf_dir}/${z}
#
# Simple face
if( -e ${y}.TTF ) then
echo ${z} at ${x}pt
./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI ${y}.TTF | bdftopcf | compress > ${DPI}dpi/${z}${x}.pcf.Z
endif
#
# Bold face
if( -e ${y}BD.TTF ) then
echo Bold ${z} at ${x}pt
./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI -w bold ${y}BD.TTF | bdftopcf | compress > ${DPI}dpi/${z}bd${x}.pcf.Z
endif
#
# Italic face
if( -e ${y}I.TTF ) then
echo Italic ${z} at ${x}pt
./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI -s o ${y}I.TTF | bdftopcf | compress >${DPI}dpi/${z}i${x}.pcf.Z
endif
#
# Bold Italic face
if( -e ${y}BI.TTF ) then
echo Bold Italic ${z} at ${x}pt
./ttf2bdf -c m -m $LANG_ID -p $x -r $DPI -w bold -s o ${y}BI.TTF | bdftopcf | compress > ${DPI}dpi/${z}bi${x}.pcf.Z
endif
end
end
#echo Creating fonts directory...
#cd ${DPI}dpi
#mkfontdir

View File

@@ -0,0 +1,278 @@
#
# $Id: iso8859.1,v 1.2 1999/06/16 16:13:11 mleisher Exp $
#
# SAMPLE TTF2BDF MAPPING TABLE
#
# Mapping table from Unicode to ISO8859-1. Names are from the Unicode
# Character Database on ftp.unicode.org.
#
# Two keywords are used to specify the character set registry and encoding:
# REGISTRY and ENCODING. These will be used when creating the XLFD name
# for the font.
#
# Column 1 is the ISO8859-1 value, and column 2 is the Unicode value. The
# columns can be separated by tabs or whitespace, and only the first two
# columns are used.
#
# Empty lines and lines starting with '#' are ignored.
#
# NOTE: made with material from "The ISO 8859 Alphabet Soup" --solofo
#
REGISTRY ISO8859
ENCODING 1
0x00 0x0000 # <control>
0x01 0x0001 # <control>
0x02 0x0002 # <control>
0x03 0x0003 # <control>
0x04 0x0004 # <control>
0x05 0x0005 # <control>
0x06 0x0006 # <control>
0x07 0x0007 # <control>
0x08 0x0008 # <control>
0x09 0x0009 # <control>
0x0A 0x000A # <control>
0x0B 0x000B # <control>
0x0C 0x000C # <control>
0x0D 0x000D # <control>
0x0E 0x000E # <control>
0x0F 0x000F # <control>
0x10 0x0010 # <control>
0x11 0x0011 # <control>
0x12 0x0012 # <control>
0x13 0x0013 # <control>
0x14 0x0014 # <control>
0x15 0x0015 # <control>
0x16 0x0016 # <control>
0x17 0x0017 # <control>
0x18 0x0018 # <control>
0x19 0x0019 # <control>
0x1A 0x001A # <control>
0x1B 0x001B # <control>
0x1C 0x001C # <control>
0x1D 0x001D # <control>
0x1E 0x001E # <control>
0x1F 0x001F # <control>
0x20 0x0020 # SPACE
0x21 0x0021 # EXCLAMATION MARK
0x22 0x0022 # QUOTATION MARK
0x23 0x0023 # NUMBER SIGN
0x24 0x0024 # DOLLAR SIGN
0x25 0x0025 # PERCENT SIGN
0x26 0x0026 # AMPERSAND
0x27 0x0027 # APOSTROPHE
0x28 0x0028 # LEFT PARENTHESIS
0x29 0x0029 # RIGHT PARENTHESIS
0x2A 0x002A # ASTERISK
0x2B 0x002B # PLUS SIGN
0x2C 0x002C # COMMA
0x2D 0x002D # HYPHEN-MINUS
0x2E 0x002E # FULL STOP
0x2F 0x002F # SOLIDUS
0x30 0x0030 # DIGIT ZERO
0x31 0x0031 # DIGIT ONE
0x32 0x0032 # DIGIT TWO
0x33 0x0033 # DIGIT THREE
0x34 0x0034 # DIGIT FOUR
0x35 0x0035 # DIGIT FIVE
0x36 0x0036 # DIGIT SIX
0x37 0x0037 # DIGIT SEVEN
0x38 0x0038 # DIGIT EIGHT
0x39 0x0039 # DIGIT NINE
0x3A 0x003A # COLON
0x3B 0x003B # SEMICOLON
0x3C 0x003C # LESS-THAN SIGN
0x3D 0x003D # EQUALS SIGN
0x3E 0x003E # GREATER-THAN SIGN
0x3F 0x003F # QUESTION MARK
0x40 0x0040 # COMMERCIAL AT
0x41 0x0041 # LATIN CAPITAL LETTER A
0x42 0x0042 # LATIN CAPITAL LETTER B
0x43 0x0043 # LATIN CAPITAL LETTER C
0x44 0x0044 # LATIN CAPITAL LETTER D
0x45 0x0045 # LATIN CAPITAL LETTER E
0x46 0x0046 # LATIN CAPITAL LETTER F
0x47 0x0047 # LATIN CAPITAL LETTER G
0x48 0x0048 # LATIN CAPITAL LETTER H
0x49 0x0049 # LATIN CAPITAL LETTER I
0x4A 0x004A # LATIN CAPITAL LETTER J
0x4B 0x004B # LATIN CAPITAL LETTER K
0x4C 0x004C # LATIN CAPITAL LETTER L
0x4D 0x004D # LATIN CAPITAL LETTER M
0x4E 0x004E # LATIN CAPITAL LETTER N
0x4F 0x004F # LATIN CAPITAL LETTER O
0x50 0x0050 # LATIN CAPITAL LETTER P
0x51 0x0051 # LATIN CAPITAL LETTER Q
0x52 0x0052 # LATIN CAPITAL LETTER R
0x53 0x0053 # LATIN CAPITAL LETTER S
0x54 0x0054 # LATIN CAPITAL LETTER T
0x55 0x0055 # LATIN CAPITAL LETTER U
0x56 0x0056 # LATIN CAPITAL LETTER V
0x57 0x0057 # LATIN CAPITAL LETTER W
0x58 0x0058 # LATIN CAPITAL LETTER X
0x59 0x0059 # LATIN CAPITAL LETTER Y
0x5A 0x005A # LATIN CAPITAL LETTER Z
0x5B 0x005B # LEFT SQUARE BRACKET
0x5C 0x005C # REVERSE SOLIDUS
0x5D 0x005D # RIGHT SQUARE BRACKET
0x5E 0x005E # CIRCUMFLEX ACCENT
0x5F 0x005F # LOW LINE
0x60 0x0060 # GRAVE ACCENT
0x61 0x0061 # LATIN SMALL LETTER A
0x62 0x0062 # LATIN SMALL LETTER B
0x63 0x0063 # LATIN SMALL LETTER C
0x64 0x0064 # LATIN SMALL LETTER D
0x65 0x0065 # LATIN SMALL LETTER E
0x66 0x0066 # LATIN SMALL LETTER F
0x67 0x0067 # LATIN SMALL LETTER G
0x68 0x0068 # LATIN SMALL LETTER H
0x69 0x0069 # LATIN SMALL LETTER I
0x6A 0x006A # LATIN SMALL LETTER J
0x6B 0x006B # LATIN SMALL LETTER K
0x6C 0x006C # LATIN SMALL LETTER L
0x6D 0x006D # LATIN SMALL LETTER M
0x6E 0x006E # LATIN SMALL LETTER N
0x6F 0x006F # LATIN SMALL LETTER O
0x70 0x0070 # LATIN SMALL LETTER P
0x71 0x0071 # LATIN SMALL LETTER Q
0x72 0x0072 # LATIN SMALL LETTER R
0x73 0x0073 # LATIN SMALL LETTER S
0x74 0x0074 # LATIN SMALL LETTER T
0x75 0x0075 # LATIN SMALL LETTER U
0x76 0x0076 # LATIN SMALL LETTER V
0x77 0x0077 # LATIN SMALL LETTER W
0x78 0x0078 # LATIN SMALL LETTER X
0x79 0x0079 # LATIN SMALL LETTER Y
0x7A 0x007A # LATIN SMALL LETTER Z
0x7B 0x007B # LEFT CURLY BRACKET
0x7C 0x007C # VERTICAL LINE
0x7D 0x007D # RIGHT CURLY BRACKET
0x7E 0x007E # TILDE
0x7F 0x007F # <control>
0x80 0x0080 # <control>
0x81 0x0081 # <control>
0x82 0x0082 # <control>
0x83 0x0083 # <control>
0x84 0x0084 # <control>
0x85 0x0085 # <control>
0x86 0x0086 # <control>
0x87 0x0087 # <control>
0x88 0x0088 # <control>
0x89 0x0089 # <control>
0x8A 0x008A # <control>
0x8B 0x008B # <control>
0x8C 0x008C # <control>
0x8D 0x008D # <control>
0x8E 0x008E # <control>
0x8F 0x008F # <control>
0x90 0x0090 # <control>
0x91 0x0091 # <control>
0x92 0x0092 # <control>
0x93 0x0093 # <control>
0x94 0x0094 # <control>
0x95 0x0095 # <control>
0x96 0x0096 # <control>
0x97 0x0097 # <control>
0x98 0x0098 # <control>
0x99 0x0099 # <control>
0x9A 0x009A # <control>
0x9B 0x009B # <control>
0x9C 0x009C # <control>
0x9D 0x009D # <control>
0x9E 0x009E # <control>
0x9F 0x009F # <control>
0xA0 0x00A0 # NO-BREAK SPACE
0xA1 0x00A1 # INVERTED EXCLAMATION MARK
0xA2 0x00A2 # CENT SIGN
0xA3 0x00A3 # POUND SIGN
0xA4 0x00A4 # CURRENCY SIGN
0xA5 0x00A5 # YEN SIGN
0xA6 0x00A6 # BROKEN BAR
0xA7 0x00A7 # SECTION SIGN
0xA8 0x00A8 # DIAERESIS
0xA9 0x00A9 # COPYRIGHT SIGN
0xAA 0x00AA # FEMININE ORDINAL INDICATOR
0xAB 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0xAC 0x00AC # NOT SIGN
0xAD 0x00AD # SOFT HYPHEN
0xAE 0x00AE # REGISTERED SIGN
0xAF 0x00AF # MACRON
0xB0 0x00B0 # DEGREE SIGN
0xB1 0x00B1 # PLUS-MINUS SIGN
0xB2 0x00B2 # SUPERSCRIPT TWO
0xB3 0x00B3 # SUPERSCRIPT THREE
0xB4 0x00B4 # ACUTE ACCENT
0xB5 0x00B5 # MICRO SIGN
0xB6 0x00B6 # PILCROW SIGN
0xB7 0x00B7 # MIDDLE DOT
0xB8 0x00B8 # CEDILLA
0xB9 0x00B9 # SUPERSCRIPT ONE
0xBA 0x00BA # MASCULINE ORDINAL INDICATOR
0xBB 0x00BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0xBC 0x00BC # VULGAR FRACTION ONE QUARTER
0xBD 0x00BD # VULGAR FRACTION ONE HALF
0xBE 0x00BE # VULGAR FRACTION THREE QUARTERS
0xBF 0x00BF # INVERTED QUESTION MARK
0xC0 0x00C0 # LATIN CAPITAL LETTER A WITH GRAVE
0xC1 0x00C1 # LATIN CAPITAL LETTER A WITH ACUTE
0xC2 0x00C2 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0xC3 0x00C3 # LATIN CAPITAL LETTER A WITH TILDE
0xC4 0x00C4 # LATIN CAPITAL LETTER A WITH DIAERESIS
0xC5 0x00C5 # LATIN CAPITAL LETTER A WITH RING ABOVE
0xC6 0x00C6 # LATIN CAPITAL LETTER AE
0xC7 0x00C7 # LATIN CAPITAL LETTER C WITH CEDILLA
0xC8 0x00C8 # LATIN CAPITAL LETTER E WITH GRAVE
0xC9 0x00C9 # LATIN CAPITAL LETTER E WITH ACUTE
0xCA 0x00CA # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
0xCB 0x00CB # LATIN CAPITAL LETTER E WITH DIAERESIS
0xCC 0x00CC # LATIN CAPITAL LETTER I WITH GRAVE
0xCD 0x00CD # LATIN CAPITAL LETTER I WITH ACUTE
0xCE 0x00CE # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0xCF 0x00CF # LATIN CAPITAL LETTER I WITH DIAERESIS
0xD0 0x00D0 # LATIN CAPITAL LETTER ETH
0xD1 0x00D1 # LATIN CAPITAL LETTER N WITH TILDE
0xD2 0x00D2 # LATIN CAPITAL LETTER O WITH GRAVE
0xD3 0x00D3 # LATIN CAPITAL LETTER O WITH ACUTE
0xD4 0x00D4 # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0xD5 0x00D5 # LATIN CAPITAL LETTER O WITH TILDE
0xD6 0x00D6 # LATIN CAPITAL LETTER O WITH DIAERESIS
0xD7 0x00D7 # MULTIPLICATION SIGN
0xD8 0x00D8 # LATIN CAPITAL LETTER O WITH STROKE
0xD9 0x00D9 # LATIN CAPITAL LETTER U WITH GRAVE
0xDA 0x00DA # LATIN CAPITAL LETTER U WITH ACUTE
0xDB 0x00DB # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
0xDC 0x00DC # LATIN CAPITAL LETTER U WITH DIAERESIS
0xDD 0x00DD # LATIN CAPITAL LETTER Y WITH ACUTE
0xDE 0x00DE # LATIN CAPITAL LETTER THORN
0xDF 0x00DF # LATIN SMALL LETTER SHARP S
0xE0 0x00E0 # LATIN SMALL LETTER A WITH GRAVE
0xE1 0x00E1 # LATIN SMALL LETTER A WITH ACUTE
0xE2 0x00E2 # LATIN SMALL LETTER A WITH CIRCUMFLEX
0xE3 0x00E3 # LATIN SMALL LETTER A WITH TILDE
0xE4 0x00E4 # LATIN SMALL LETTER A WITH DIAERESIS
0xE5 0x00E5 # LATIN SMALL LETTER A WITH RING ABOVE
0xE6 0x00E6 # LATIN SMALL LETTER AE
0xE7 0x00E7 # LATIN SMALL LETTER C WITH CEDILLA
0xE8 0x00E8 # LATIN SMALL LETTER E WITH GRAVE
0xE9 0x00E9 # LATIN SMALL LETTER E WITH ACUTE
0xEA 0x00EA # LATIN SMALL LETTER E WITH CIRCUMFLEX
0xEB 0x00EB # LATIN SMALL LETTER E WITH DIAERESIS
0xEC 0x00EC # LATIN SMALL LETTER I WITH GRAVE
0xED 0x00ED # LATIN SMALL LETTER I WITH ACUTE
0xEE 0x00EE # LATIN SMALL LETTER I WITH CIRCUMFLEX
0xEF 0x00EF # LATIN SMALL LETTER I WITH DIAERESIS
0xF0 0x00F0 # LATIN SMALL LETTER ETH
0xF1 0x00F1 # LATIN SMALL LETTER N WITH TILDE
0xF2 0x00F2 # LATIN SMALL LETTER O WITH GRAVE
0xF3 0x00F3 # LATIN SMALL LETTER O WITH ACUTE
0xF4 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX
0xF5 0x00F5 # LATIN SMALL LETTER O WITH TILDE
0xF6 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS
0xF7 0x00F7 # DIVISION SIGN
0xF8 0x00F8 # LATIN SMALL LETTER O WITH STROKE
0xF9 0x00F9 # LATIN SMALL LETTER U WITH GRAVE
0xFA 0x00FA # LATIN SMALL LETTER U WITH ACUTE
0xFB 0x00FB # LATIN SMALL LETTER U WITH CIRCUMFLEX
0xFC 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS
0xFD 0x00FD # LATIN SMALL LETTER Y WITH ACUTE
0xFE 0x00FE # LATIN SMALL LETTER THORN
0xFF 0x00FF # LATIN SMALL LETTER Y WITH DIAERESIS

View File

@@ -0,0 +1,276 @@
#
# $Id: iso8859.2,v 1.2 1999/06/16 16:13:11 mleisher Exp $
#
# SAMPLE TTF2BDF MAPPING TABLE
#
# Mapping table from Unicode to ISO8859-2. Names are from the Unicode
# Character Database on ftp.unicode.org.
#
# Two keywords are used to specify the character set registry and encoding:
# REGISTRY and ENCODING. These will be used when creating the XLFD name
# for the font.
#
# Column 1 is the ISO8859-2 value, and column 2 is the Unicode value. The
# columns can be separated by tabs or whitespace, and only the first two
# columns are used.
#
# Empty lines and lines starting with '#' are ignored.
#
REGISTRY ISO8859
ENCODING 2
0x00 0x0000 # <control>
0x01 0x0001 # <control>
0x02 0x0002 # <control>
0x03 0x0003 # <control>
0x04 0x0004 # <control>
0x05 0x0005 # <control>
0x06 0x0006 # <control>
0x07 0x0007 # <control>
0x08 0x0008 # <control>
0x09 0x0009 # <control>
0x0A 0x000A # <control>
0x0B 0x000B # <control>
0x0C 0x000C # <control>
0x0D 0x000D # <control>
0x0E 0x000E # <control>
0x0F 0x000F # <control>
0x10 0x0010 # <control>
0x11 0x0011 # <control>
0x12 0x0012 # <control>
0x13 0x0013 # <control>
0x14 0x0014 # <control>
0x15 0x0015 # <control>
0x16 0x0016 # <control>
0x17 0x0017 # <control>
0x18 0x0018 # <control>
0x19 0x0019 # <control>
0x1A 0x001A # <control>
0x1B 0x001B # <control>
0x1C 0x001C # <control>
0x1D 0x001D # <control>
0x1E 0x001E # <control>
0x1F 0x001F # <control>
0x20 0x0020 # SPACE
0x21 0x0021 # EXCLAMATION MARK
0x22 0x0022 # QUOTATION MARK
0x23 0x0023 # NUMBER SIGN
0x24 0x0024 # DOLLAR SIGN
0x25 0x0025 # PERCENT SIGN
0x26 0x0026 # AMPERSAND
0x27 0x0027 # APOSTROPHE
0x28 0x0028 # LEFT PARENTHESIS
0x29 0x0029 # RIGHT PARENTHESIS
0x2A 0x002A # ASTERISK
0x2B 0x002B # PLUS SIGN
0x2C 0x002C # COMMA
0x2D 0x002D # HYPHEN-MINUS
0x2E 0x002E # FULL STOP
0x2F 0x002F # SOLIDUS
0x30 0x0030 # DIGIT ZERO
0x31 0x0031 # DIGIT ONE
0x32 0x0032 # DIGIT TWO
0x33 0x0033 # DIGIT THREE
0x34 0x0034 # DIGIT FOUR
0x35 0x0035 # DIGIT FIVE
0x36 0x0036 # DIGIT SIX
0x37 0x0037 # DIGIT SEVEN
0x38 0x0038 # DIGIT EIGHT
0x39 0x0039 # DIGIT NINE
0x3A 0x003A # COLON
0x3B 0x003B # SEMICOLON
0x3C 0x003C # LESS-THAN SIGN
0x3D 0x003D # EQUALS SIGN
0x3E 0x003E # GREATER-THAN SIGN
0x3F 0x003F # QUESTION MARK
0x40 0x0040 # COMMERCIAL AT
0x41 0x0041 # LATIN CAPITAL LETTER A
0x42 0x0042 # LATIN CAPITAL LETTER B
0x43 0x0043 # LATIN CAPITAL LETTER C
0x44 0x0044 # LATIN CAPITAL LETTER D
0x45 0x0045 # LATIN CAPITAL LETTER E
0x46 0x0046 # LATIN CAPITAL LETTER F
0x47 0x0047 # LATIN CAPITAL LETTER G
0x48 0x0048 # LATIN CAPITAL LETTER H
0x49 0x0049 # LATIN CAPITAL LETTER I
0x4A 0x004A # LATIN CAPITAL LETTER J
0x4B 0x004B # LATIN CAPITAL LETTER K
0x4C 0x004C # LATIN CAPITAL LETTER L
0x4D 0x004D # LATIN CAPITAL LETTER M
0x4E 0x004E # LATIN CAPITAL LETTER N
0x4F 0x004F # LATIN CAPITAL LETTER O
0x50 0x0050 # LATIN CAPITAL LETTER P
0x51 0x0051 # LATIN CAPITAL LETTER Q
0x52 0x0052 # LATIN CAPITAL LETTER R
0x53 0x0053 # LATIN CAPITAL LETTER S
0x54 0x0054 # LATIN CAPITAL LETTER T
0x55 0x0055 # LATIN CAPITAL LETTER U
0x56 0x0056 # LATIN CAPITAL LETTER V
0x57 0x0057 # LATIN CAPITAL LETTER W
0x58 0x0058 # LATIN CAPITAL LETTER X
0x59 0x0059 # LATIN CAPITAL LETTER Y
0x5A 0x005A # LATIN CAPITAL LETTER Z
0x5B 0x005B # LEFT SQUARE BRACKET
0x5C 0x005C # REVERSE SOLIDUS
0x5D 0x005D # RIGHT SQUARE BRACKET
0x5E 0x005E # CIRCUMFLEX ACCENT
0x5F 0x005F # LOW LINE
0x60 0x0060 # GRAVE ACCENT
0x61 0x0061 # LATIN SMALL LETTER A
0x62 0x0062 # LATIN SMALL LETTER B
0x63 0x0063 # LATIN SMALL LETTER C
0x64 0x0064 # LATIN SMALL LETTER D
0x65 0x0065 # LATIN SMALL LETTER E
0x66 0x0066 # LATIN SMALL LETTER F
0x67 0x0067 # LATIN SMALL LETTER G
0x68 0x0068 # LATIN SMALL LETTER H
0x69 0x0069 # LATIN SMALL LETTER I
0x6A 0x006A # LATIN SMALL LETTER J
0x6B 0x006B # LATIN SMALL LETTER K
0x6C 0x006C # LATIN SMALL LETTER L
0x6D 0x006D # LATIN SMALL LETTER M
0x6E 0x006E # LATIN SMALL LETTER N
0x6F 0x006F # LATIN SMALL LETTER O
0x70 0x0070 # LATIN SMALL LETTER P
0x71 0x0071 # LATIN SMALL LETTER Q
0x72 0x0072 # LATIN SMALL LETTER R
0x73 0x0073 # LATIN SMALL LETTER S
0x74 0x0074 # LATIN SMALL LETTER T
0x75 0x0075 # LATIN SMALL LETTER U
0x76 0x0076 # LATIN SMALL LETTER V
0x77 0x0077 # LATIN SMALL LETTER W
0x78 0x0078 # LATIN SMALL LETTER X
0x79 0x0079 # LATIN SMALL LETTER Y
0x7A 0x007A # LATIN SMALL LETTER Z
0x7B 0x007B # LEFT CURLY BRACKET
0x7C 0x007C # VERTICAL LINE
0x7D 0x007D # RIGHT CURLY BRACKET
0x7E 0x007E # TILDE
0x7F 0x007F # <control>
0x80 0x0080 # <control>
0x81 0x0081 # <control>
0x82 0x0082 # <control>
0x83 0x0083 # <control>
0x84 0x0084 # <control>
0x85 0x0085 # <control>
0x86 0x0086 # <control>
0x87 0x0087 # <control>
0x88 0x0088 # <control>
0x89 0x0089 # <control>
0x8A 0x008A # <control>
0x8B 0x008B # <control>
0x8C 0x008C # <control>
0x8D 0x008D # <control>
0x8E 0x008E # <control>
0x8F 0x008F # <control>
0x90 0x0090 # <control>
0x91 0x0091 # <control>
0x92 0x0092 # <control>
0x93 0x0093 # <control>
0x94 0x0094 # <control>
0x95 0x0095 # <control>
0x96 0x0096 # <control>
0x97 0x0097 # <control>
0x98 0x0098 # <control>
0x99 0x0099 # <control>
0x9A 0x009A # <control>
0x9B 0x009B # <control>
0x9C 0x009C # <control>
0x9D 0x009D # <control>
0x9E 0x009E # <control>
0x9F 0x009F # <control>
0xA0 0x00A0 # NO-BREAK SPACE
0xA1 0x0104 # LATIN CAPITAL LETTER A WITH OGONEK
0xA2 0x02D8 # BREVE
0xA3 0x0141 # LATIN CAPITAL LETTER L WITH STROKE
0xA4 0x00A4 # CURRENCY SIGN
0xA5 0x013D # LATIN CAPITAL LETTER L WITH CARON
0xA6 0x015A # LATIN CAPITAL LETTER S WITH ACUTE
0xA7 0x00A7 # SECTION SIGN
0xA8 0x00A8 # DIAERESIS
0xA9 0x0160 # LATIN CAPITAL LETTER S WITH CARON
0xAA 0x015E # LATIN CAPITAL LETTER S WITH CEDILLA
0xAB 0x0164 # LATIN CAPITAL LETTER T WITH CARON
0xAC 0x0179 # LATIN CAPITAL LETTER Z WITH ACUTE
0xAD 0x00AD # SOFT HYPHEN
0xAE 0x017D # LATIN CAPITAL LETTER Z WITH CARON
0xAF 0x017B # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0xB0 0x00B0 # DEGREE SIGN
0xB1 0x0105 # LATIN SMALL LETTER A WITH OGONEK
0xB2 0x02DB # OGONEK
0xB3 0x0142 # LATIN SMALL LETTER L WITH STROKE
0xB4 0x00B4 # ACUTE ACCENT
0xB5 0x013E # LATIN SMALL LETTER L WITH CARON
0xB6 0x015B # LATIN SMALL LETTER S WITH ACUTE
0xB7 0x02C7 # CARON
0xB8 0x00B8 # CEDILLA
0xB9 0x0161 # LATIN SMALL LETTER S WITH CARON
0xBA 0x015F # LATIN SMALL LETTER S WITH CEDILLA
0xBB 0x0165 # LATIN SMALL LETTER T WITH CARON
0xBC 0x017A # LATIN SMALL LETTER Z WITH ACUTE
0xBD 0x02DD # DOUBLE ACUTE ACCENT
0xBE 0x017E # LATIN SMALL LETTER Z WITH CARON
0xBF 0x017C # LATIN SMALL LETTER Z WITH DOT ABOVE
0xC0 0x0154 # LATIN CAPITAL LETTER R WITH ACUTE
0xC1 0x00C1 # LATIN CAPITAL LETTER A WITH ACUTE
0xC2 0x00C2 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0xC3 0x0102 # LATIN CAPITAL LETTER A WITH BREVE
0xC4 0x00C4 # LATIN CAPITAL LETTER A WITH DIAERESIS
0xC5 0x0139 # LATIN CAPITAL LETTER L WITH ACUTE
0xC6 0x0106 # LATIN CAPITAL LETTER C WITH ACUTE
0xC7 0x00C7 # LATIN CAPITAL LETTER C WITH CEDILLA
0xC8 0x010C # LATIN CAPITAL LETTER C WITH CARON
0xC9 0x00C9 # LATIN CAPITAL LETTER E WITH ACUTE
0xCA 0x0118 # LATIN CAPITAL LETTER E WITH OGONEK
0xCB 0x00CB # LATIN CAPITAL LETTER E WITH DIAERESIS
0xCC 0x011A # LATIN CAPITAL LETTER E WITH CARON
0xCD 0x00CD # LATIN CAPITAL LETTER I WITH ACUTE
0xCE 0x00CE # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0xCF 0x010E # LATIN CAPITAL LETTER D WITH CARON
0xD0 0x0110 # LATIN CAPITAL LETTER D WITH STROKE
0xD1 0x0143 # LATIN CAPITAL LETTER N WITH ACUTE
0xD2 0x0147 # LATIN CAPITAL LETTER N WITH CARON
0xD3 0x00D3 # LATIN CAPITAL LETTER O WITH ACUTE
0xD4 0x00D4 # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0xD5 0x0150 # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
0xD6 0x00D6 # LATIN CAPITAL LETTER O WITH DIAERESIS
0xD7 0x00D7 # MULTIPLICATION SIGN
0xD8 0x0158 # LATIN CAPITAL LETTER R WITH CARON
0xD9 0x016E # LATIN CAPITAL LETTER U WITH RING ABOVE
0xDA 0x00DA # LATIN CAPITAL LETTER U WITH ACUTE
0xDB 0x0170 # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
0xDC 0x00DC # LATIN CAPITAL LETTER U WITH DIAERESIS
0xDD 0x00DD # LATIN CAPITAL LETTER Y WITH ACUTE
0xDE 0x0162 # LATIN CAPITAL LETTER T WITH CEDILLA
0xDF 0x00DF # LATIN SMALL LETTER SHARP S
0xE0 0x0155 # LATIN SMALL LETTER R WITH ACUTE
0xE1 0x00E1 # LATIN SMALL LETTER A WITH ACUTE
0xE2 0x00E2 # LATIN SMALL LETTER A WITH CIRCUMFLEX
0xE3 0x0103 # LATIN SMALL LETTER A WITH BREVE
0xE4 0x00E4 # LATIN SMALL LETTER A WITH DIAERESIS
0xE5 0x013A # LATIN SMALL LETTER L WITH ACUTE
0xE6 0x0107 # LATIN SMALL LETTER C WITH ACUTE
0xE7 0x00E7 # LATIN SMALL LETTER C WITH CEDILLA
0xE8 0x010D # LATIN SMALL LETTER C WITH CARON
0xE9 0x00E9 # LATIN SMALL LETTER E WITH ACUTE
0xEA 0x0119 # LATIN SMALL LETTER E WITH OGONEK
0xEB 0x00EB # LATIN SMALL LETTER E WITH DIAERESIS
0xEC 0x011B # LATIN SMALL LETTER E WITH CARON
0xED 0x00ED # LATIN SMALL LETTER I WITH ACUTE
0xEE 0x00EE # LATIN SMALL LETTER I WITH CIRCUMFLEX
0xEF 0x010F # LATIN SMALL LETTER D WITH CARON
0xF0 0x0111 # LATIN SMALL LETTER D WITH STROKE
0xF1 0x0144 # LATIN SMALL LETTER N WITH ACUTE
0xF2 0x0148 # LATIN SMALL LETTER N WITH CARON
0xF3 0x00F3 # LATIN SMALL LETTER O WITH ACUTE
0xF4 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX
0xF5 0x0151 # LATIN SMALL LETTER O WITH DOUBLE ACUTE
0xF6 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS
0xF7 0x00F7 # DIVISION SIGN
0xF8 0x0159 # LATIN SMALL LETTER R WITH CARON
0xF9 0x016F # LATIN SMALL LETTER U WITH RING ABOVE
0xFA 0x00FA # LATIN SMALL LETTER U WITH ACUTE
0xFB 0x0171 # LATIN SMALL LETTER U WITH DOUBLE ACUTE
0xFC 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS
0xFD 0x00FD # LATIN SMALL LETTER Y WITH ACUTE
0xFE 0x0163 # LATIN SMALL LETTER T WITH CEDILLA
0xFF 0x02D9 # DOT ABOVE

View File

@@ -0,0 +1,271 @@
#
# $Id: iso8859.3,v 1.2 1999/06/16 16:13:11 mleisher Exp $
#
# SAMPLE TTF2BDF MAPPING TABLE
#
# Mapping table from Unicode to ISO8859-3. Names are from the Unicode
# Character Database on ftp.unicode.org.
#
# Two keywords are used to specify the character set registry and encoding:
# REGISTRY and ENCODING. These will be used when creating the XLFD name
# for the font.
#
# Column 1 is the ISO8859-3 value, and column 2 is the Unicode value. The
# columns can be separated by tabs or whitespace, and only the first two
# columns are used.
#
# Empty lines and lines starting with '#' are ignored.
#
# NOTE: prepared with material from "The ISO 8859 Alphabet Soup"
#
REGISTRY ISO8859
ENCODING 3
0x00 0x0000 # <control>
0x01 0x0001 # <control>
0x02 0x0002 # <control>
0x03 0x0003 # <control>
0x04 0x0004 # <control>
0x05 0x0005 # <control>
0x06 0x0006 # <control>
0x07 0x0007 # <control>
0x08 0x0008 # <control>
0x09 0x0009 # <control>
0x0A 0x000A # <control>
0x0B 0x000B # <control>
0x0C 0x000C # <control>
0x0D 0x000D # <control>
0x0E 0x000E # <control>
0x0F 0x000F # <control>
0x10 0x0010 # <control>
0x11 0x0011 # <control>
0x12 0x0012 # <control>
0x13 0x0013 # <control>
0x14 0x0014 # <control>
0x15 0x0015 # <control>
0x16 0x0016 # <control>
0x17 0x0017 # <control>
0x18 0x0018 # <control>
0x19 0x0019 # <control>
0x1A 0x001A # <control>
0x1B 0x001B # <control>
0x1C 0x001C # <control>
0x1D 0x001D # <control>
0x1E 0x001E # <control>
0x1F 0x001F # <control>
0x20 0x0020 # SPACE
0x21 0x0021 # EXCLAMATION MARK
0x22 0x0022 # QUOTATION MARK
0x23 0x0023 # NUMBER SIGN
0x24 0x0024 # DOLLAR SIGN
0x25 0x0025 # PERCENT SIGN
0x26 0x0026 # AMPERSAND
0x27 0x0027 # APOSTROPHE
0x28 0x0028 # LEFT PARENTHESIS
0x29 0x0029 # RIGHT PARENTHESIS
0x2A 0x002A # ASTERISK
0x2B 0x002B # PLUS SIGN
0x2C 0x002C # COMMA
0x2D 0x002D # HYPHEN-MINUS
0x2E 0x002E # FULL STOP
0x2F 0x002F # SOLIDUS
0x30 0x0030 # DIGIT ZERO
0x31 0x0031 # DIGIT ONE
0x32 0x0032 # DIGIT TWO
0x33 0x0033 # DIGIT THREE
0x34 0x0034 # DIGIT FOUR
0x35 0x0035 # DIGIT FIVE
0x36 0x0036 # DIGIT SIX
0x37 0x0037 # DIGIT SEVEN
0x38 0x0038 # DIGIT EIGHT
0x39 0x0039 # DIGIT NINE
0x3A 0x003A # COLON
0x3B 0x003B # SEMICOLON
0x3C 0x003C # LESS-THAN SIGN
0x3D 0x003D # EQUALS SIGN
0x3E 0x003E # GREATER-THAN SIGN
0x3F 0x003F # QUESTION MARK
0x40 0x0040 # COMMERCIAL AT
0x41 0x0041 # LATIN CAPITAL LETTER A
0x42 0x0042 # LATIN CAPITAL LETTER B
0x43 0x0043 # LATIN CAPITAL LETTER C
0x44 0x0044 # LATIN CAPITAL LETTER D
0x45 0x0045 # LATIN CAPITAL LETTER E
0x46 0x0046 # LATIN CAPITAL LETTER F
0x47 0x0047 # LATIN CAPITAL LETTER G
0x48 0x0048 # LATIN CAPITAL LETTER H
0x49 0x0049 # LATIN CAPITAL LETTER I
0x4A 0x004A # LATIN CAPITAL LETTER J
0x4B 0x004B # LATIN CAPITAL LETTER K
0x4C 0x004C # LATIN CAPITAL LETTER L
0x4D 0x004D # LATIN CAPITAL LETTER M
0x4E 0x004E # LATIN CAPITAL LETTER N
0x4F 0x004F # LATIN CAPITAL LETTER O
0x50 0x0050 # LATIN CAPITAL LETTER P
0x51 0x0051 # LATIN CAPITAL LETTER Q
0x52 0x0052 # LATIN CAPITAL LETTER R
0x53 0x0053 # LATIN CAPITAL LETTER S
0x54 0x0054 # LATIN CAPITAL LETTER T
0x55 0x0055 # LATIN CAPITAL LETTER U
0x56 0x0056 # LATIN CAPITAL LETTER V
0x57 0x0057 # LATIN CAPITAL LETTER W
0x58 0x0058 # LATIN CAPITAL LETTER X
0x59 0x0059 # LATIN CAPITAL LETTER Y
0x5A 0x005A # LATIN CAPITAL LETTER Z
0x5B 0x005B # LEFT SQUARE BRACKET
0x5C 0x005C # REVERSE SOLIDUS
0x5D 0x005D # RIGHT SQUARE BRACKET
0x5E 0x005E # CIRCUMFLEX ACCENT
0x5F 0x005F # LOW LINE
0x60 0x0060 # GRAVE ACCENT
0x61 0x0061 # LATIN SMALL LETTER A
0x62 0x0062 # LATIN SMALL LETTER B
0x63 0x0063 # LATIN SMALL LETTER C
0x64 0x0064 # LATIN SMALL LETTER D
0x65 0x0065 # LATIN SMALL LETTER E
0x66 0x0066 # LATIN SMALL LETTER F
0x67 0x0067 # LATIN SMALL LETTER G
0x68 0x0068 # LATIN SMALL LETTER H
0x69 0x0069 # LATIN SMALL LETTER I
0x6A 0x006A # LATIN SMALL LETTER J
0x6B 0x006B # LATIN SMALL LETTER K
0x6C 0x006C # LATIN SMALL LETTER L
0x6D 0x006D # LATIN SMALL LETTER M
0x6E 0x006E # LATIN SMALL LETTER N
0x6F 0x006F # LATIN SMALL LETTER O
0x70 0x0070 # LATIN SMALL LETTER P
0x71 0x0071 # LATIN SMALL LETTER Q
0x72 0x0072 # LATIN SMALL LETTER R
0x73 0x0073 # LATIN SMALL LETTER S
0x74 0x0074 # LATIN SMALL LETTER T
0x75 0x0075 # LATIN SMALL LETTER U
0x76 0x0076 # LATIN SMALL LETTER V
0x77 0x0077 # LATIN SMALL LETTER W
0x78 0x0078 # LATIN SMALL LETTER X
0x79 0x0079 # LATIN SMALL LETTER Y
0x7A 0x007A # LATIN SMALL LETTER Z
0x7B 0x007B # LEFT CURLY BRACKET
0x7C 0x007C # VERTICAL LINE
0x7D 0x007D # RIGHT CURLY BRACKET
0x7E 0x007E # TILDE
0x7F 0x007F # <control>
0x80 0x0080 # <control>
0x81 0x0081 # <control>
0x82 0x0082 # <control>
0x83 0x0083 # <control>
0x84 0x0084 # <control>
0x85 0x0085 # <control>
0x86 0x0086 # <control>
0x87 0x0087 # <control>
0x88 0x0088 # <control>
0x89 0x0089 # <control>
0x8A 0x008A # <control>
0x8B 0x008B # <control>
0x8C 0x008C # <control>
0x8D 0x008D # <control>
0x8E 0x008E # <control>
0x8F 0x008F # <control>
0x90 0x0090 # <control>
0x91 0x0091 # <control>
0x92 0x0092 # <control>
0x93 0x0093 # <control>
0x94 0x0094 # <control>
0x95 0x0095 # <control>
0x96 0x0096 # <control>
0x97 0x0097 # <control>
0x98 0x0098 # <control>
0x99 0x0099 # <control>
0x9A 0x009A # <control>
0x9B 0x009B # <control>
0x9C 0x009C # <control>
0x9D 0x009D # <control>
0x9E 0x009E # <control>
0x9F 0x009F # <control>
0xA0 0x00A0 # NO-BREAK SPACE
0xA1 0x0126 # LATIN CAPITAL LETTER H WITH STROKE
0xA2 0x02D8 # BREVE
0xA3 0x00A3 # POUND SIGN
0xA4 0x00A4 # CURRENCY SIGN
0xA6 0x0124 # LATIN CAPITAL LETTER H WITH CIRCUMFLEX
0xA7 0x00A7 # SECTION SIGN
0xA8 0x00A8 # DIAERESIS
0xA9 0x0130 # LATIN CAPITAL LETTER I WITH DOT ABOVE
0xAA 0x015E # LATIN CAPITAL LETTER S WITH CEDILLA
0xAB 0x011E # LATIN CAPITAL LETTER G WITH BREVE
0xAC 0x0134 # LATIN CAPITAL LETTER J WITH CIRCUMFLEX
0xAD 0x00AD # SOFT HYPHEN
0xAF 0x017B # LATIN CAPITAL LETTER Z WITH DOT ABOVE
0xB0 0x00B0 # DEGREE SIGN
0xB1 0x0127 # LATIN SMALL LETTER H WITH STROKE
0xB2 0x00B2 # SUPERSCRIPT TWO
0xB3 0x00B3 # SUPERSCRIPT THREE
0xB4 0x00B4 # ACUTE ACCENT
0xB5 0x00B5 # MICRO SIGN
0xB6 0x0125 # LATIN SMALL LETTER H WITH CIRCUMFLEX
0xB7 0x00B7 # MIDDLE DOT
0xB8 0x00B8 # CEDILLA
0xB9 0x0131 # LATIN SMALL LETTER DOTLESS I
0xBA 0x015F # LATIN SMALL LETTER S WITH CEDILLA
0xBB 0x011F # LATIN SMALL LETTER G WITH BREVE
0xBC 0x0135 # LATIN SMALL LETTER J WITH CIRCUMFLEX
0xBD 0x00BD # VULGAR FRACTION ONE HALF
0xBF 0x017C # LATIN SMALL LETTER Z WITH DOT ABOVE
0xC0 0x00C0 # LATIN CAPITAL LETTER A WITH GRAVE
0xC1 0x00C1 # LATIN CAPITAL LETTER A WITH ACUTE
0xC2 0x00C2 # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
0xC4 0x00C4 # LATIN CAPITAL LETTER A WITH DIAERESIS
0xC5 0x010A # LATIN CAPITAL LETTER C WITH DOT ABOVE
0xC6 0x0108 # LATIN CAPITAL LETTER C WITH CIRCUMFLEX
0xC7 0x00C7 # LATIN CAPITAL LETTER C WITH CEDILLA
0xC8 0x00C8 # LATIN CAPITAL LETTER E WITH GRAVE
0xC9 0x00C9 # LATIN CAPITAL LETTER E WITH ACUTE
0xCA 0x00CA # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
0xCB 0x00CB # LATIN CAPITAL LETTER E WITH DIAERESIS
0xCC 0x00CC # LATIN CAPITAL LETTER I WITH GRAVE
0xCD 0x00CD # LATIN CAPITAL LETTER I WITH ACUTE
0xCE 0x00CE # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
0xCF 0x00CF # LATIN CAPITAL LETTER I WITH DIAERESIS
0xD1 0x00D1 # LATIN CAPITAL LETTER N WITH TILDE
0xD2 0x00D2 # LATIN CAPITAL LETTER O WITH GRAVE
0xD3 0x00D3 # LATIN CAPITAL LETTER O WITH ACUTE
0xD4 0x00D4 # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
0xD5 0x0120 # LATIN CAPITAL LETTER G WITH DOT ABOVE
0xD6 0x00D6 # LATIN CAPITAL LETTER O WITH DIAERESIS
0xD7 0x00D7 # MULTIPLICATION SIGN
0xD8 0x011C # LATIN CAPITAL LETTER G WITH CIRCUMFLEX
0xD9 0x00D9 # LATIN CAPITAL LETTER U WITH GRAVE
0xDA 0x00DA # LATIN CAPITAL LETTER U WITH ACUTE
0xDB 0x00DB # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
0xDC 0x00DC # LATIN CAPITAL LETTER U WITH DIAERESIS
0xDD 0x016C # LATIN CAPITAL LETTER U WITH BREVE
0xDE 0x015C # LATIN CAPITAL LETTER S WITH CIRCUMFLEX
0xDF 0x00DF # LATIN SMALL LETTER SHARP S
0xE0 0x00E0 # LATIN SMALL LETTER A WITH GRAVE
0xE1 0x00E1 # LATIN SMALL LETTER A WITH ACUTE
0xE2 0x00E2 # LATIN SMALL LETTER A WITH CIRCUMFLEX
0xE4 0x00E4 # LATIN SMALL LETTER A WITH DIAERESIS
0xE5 0x010B # LATIN SMALL LETTER C WITH DOT ABOVE
0xE6 0x0109 # LATIN SMALL LETTER C WITH CIRCUMFLEX
0xE7 0x00E7 # LATIN SMALL LETTER C WITH CEDILLA
0xE8 0x00E8 # LATIN SMALL LETTER E WITH GRAVE
0xE9 0x00E9 # LATIN SMALL LETTER E WITH ACUTE
0xEA 0x00EA # LATIN SMALL LETTER E WITH CIRCUMFLEX
0xEB 0x00EB # LATIN SMALL LETTER E WITH DIAERESIS
0xEC 0x00EC # LATIN SMALL LETTER I WITH GRAVE
0xED 0x00ED # LATIN SMALL LETTER I WITH ACUTE
0xEE 0x00EE # LATIN SMALL LETTER I WITH CIRCUMFLEX
0xEF 0x00EF # LATIN SMALL LETTER I WITH DIAERESIS
0xF1 0x00F1 # LATIN SMALL LETTER N WITH TILDE
0xF2 0x00F2 # LATIN SMALL LETTER O WITH GRAVE
0xF3 0x00F3 # LATIN SMALL LETTER O WITH ACUTE
0xF4 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX
0xF5 0x0121 # LATIN SMALL LETTER G WITH DOT ABOVE
0xF6 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS
0xF7 0x00F7 # DIVISION SIGN
0xF8 0x011D # LATIN SMALL LETTER G WITH CIRCUMFLEX
0xF9 0x00F9 # LATIN SMALL LETTER U WITH GRAVE
0xFA 0x00FA # LATIN SMALL LETTER U WITH ACUTE
0xFB 0x00FB # LATIN SMALL LETTER U WITH CIRCUMFLEX
0xFC 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS
0xFD 0x016D # LATIN SMALL LETTER U WITH BREVE
0xFE 0x015D # LATIN SMALL LETTER S WITH CIRCUMFLEX
0xFF 0x02D9 # DOT ABOVE

View File

@@ -0,0 +1,265 @@
#/*
# * Unicode 2.0 -> iso8859-5
# *
# * 04 Jan 98 | Eugene Bobin, <gene@ftim.ustu.ru>
# *
# * Modified 16 June 99 Mark Leisher <mleisher@crl.nmsu.edu>
# */
REGISTRY ISO8859
ENCODING 5
0x00 0x0000 # <control>
0x01 0x0001 # <control>
0x02 0x0002 # <control>
0x03 0x0003 # <control>
0x04 0x0004 # <control>
0x05 0x0005 # <control>
0x06 0x0006 # <control>
0x07 0x0007 # <control>
0x08 0x0008 # <control>
0x09 0x0009 # <control>
0x0A 0x000A # <control>
0x0B 0x000B # <control>
0x0C 0x000C # <control>
0x0D 0x000D # <control>
0x0E 0x000E # <control>
0x0F 0x000F # <control>
0x10 0x0010 # <control>
0x11 0x0011 # <control>
0x12 0x0012 # <control>
0x13 0x0013 # <control>
0x14 0x0014 # <control>
0x15 0x0015 # <control>
0x16 0x0016 # <control>
0x17 0x0017 # <control>
0x18 0x0018 # <control>
0x19 0x0019 # <control>
0x1A 0x001A # <control>
0x1B 0x001B # <control>
0x1C 0x001C # <control>
0x1D 0x001D # <control>
0x1E 0x001E # <control>
0x1F 0x001F # <control>
0x20 0x0020 # SPACE
0x21 0x0021 # EXCLAMATION MARK
0x22 0x0022 # QUOTATION MARK
0x23 0x0023 # NUMBER SIGN
0x24 0x0024 # DOLLAR SIGN
0x25 0x0025 # PERCENT SIGN
0x26 0x0026 # AMPERSAND
0x27 0x0027 # APOSTROPHE
0x28 0x0028 # LEFT PARENTHESIS
0x29 0x0029 # RIGHT PARENTHESIS
0x2A 0x002A # ASTERISK
0x2B 0x002B # PLUS SIGN
0x2C 0x002C # COMMA
0x2D 0x002D # HYPHEN-MINUS
0x2E 0x002E # FULL STOP
0x2F 0x002F # SOLIDUS
0x30 0x0030 # DIGIT ZERO
0x31 0x0031 # DIGIT ONE
0x32 0x0032 # DIGIT TWO
0x33 0x0033 # DIGIT THREE
0x34 0x0034 # DIGIT FOUR
0x35 0x0035 # DIGIT FIVE
0x36 0x0036 # DIGIT SIX
0x37 0x0037 # DIGIT SEVEN
0x38 0x0038 # DIGIT EIGHT
0x39 0x0039 # DIGIT NINE
0x3A 0x003A # COLON
0x3B 0x003B # SEMICOLON
0x3C 0x003C # LESS-THAN SIGN
0x3D 0x003D # EQUALS SIGN
0x3E 0x003E # GREATER-THAN SIGN
0x3F 0x003F # QUESTION MARK
0x40 0x0040 # COMMERCIAL AT
0x41 0x0041 # LATIN CAPITAL LETTER A
0x42 0x0042 # LATIN CAPITAL LETTER B
0x43 0x0043 # LATIN CAPITAL LETTER C
0x44 0x0044 # LATIN CAPITAL LETTER D
0x45 0x0045 # LATIN CAPITAL LETTER E
0x46 0x0046 # LATIN CAPITAL LETTER F
0x47 0x0047 # LATIN CAPITAL LETTER G
0x48 0x0048 # LATIN CAPITAL LETTER H
0x49 0x0049 # LATIN CAPITAL LETTER I
0x4A 0x004A # LATIN CAPITAL LETTER J
0x4B 0x004B # LATIN CAPITAL LETTER K
0x4C 0x004C # LATIN CAPITAL LETTER L
0x4D 0x004D # LATIN CAPITAL LETTER M
0x4E 0x004E # LATIN CAPITAL LETTER N
0x4F 0x004F # LATIN CAPITAL LETTER O
0x50 0x0050 # LATIN CAPITAL LETTER P
0x51 0x0051 # LATIN CAPITAL LETTER Q
0x52 0x0052 # LATIN CAPITAL LETTER R
0x53 0x0053 # LATIN CAPITAL LETTER S
0x54 0x0054 # LATIN CAPITAL LETTER T
0x55 0x0055 # LATIN CAPITAL LETTER U
0x56 0x0056 # LATIN CAPITAL LETTER V
0x57 0x0057 # LATIN CAPITAL LETTER W
0x58 0x0058 # LATIN CAPITAL LETTER X
0x59 0x0059 # LATIN CAPITAL LETTER Y
0x5A 0x005A # LATIN CAPITAL LETTER Z
0x5B 0x005B # LEFT SQUARE BRACKET
0x5C 0x005C # REVERSE SOLIDUS
0x5D 0x005D # RIGHT SQUARE BRACKET
0x5E 0x005E # CIRCUMFLEX ACCENT
0x5F 0x005F # LOW LINE
0x60 0x0060 # GRAVE ACCENT
0x61 0x0061 # LATIN SMALL LETTER A
0x62 0x0062 # LATIN SMALL LETTER B
0x63 0x0063 # LATIN SMALL LETTER C
0x64 0x0064 # LATIN SMALL LETTER D
0x65 0x0065 # LATIN SMALL LETTER E
0x66 0x0066 # LATIN SMALL LETTER F
0x67 0x0067 # LATIN SMALL LETTER G
0x68 0x0068 # LATIN SMALL LETTER H
0x69 0x0069 # LATIN SMALL LETTER I
0x6A 0x006A # LATIN SMALL LETTER J
0x6B 0x006B # LATIN SMALL LETTER K
0x6C 0x006C # LATIN SMALL LETTER L
0x6D 0x006D # LATIN SMALL LETTER M
0x6E 0x006E # LATIN SMALL LETTER N
0x6F 0x006F # LATIN SMALL LETTER O
0x70 0x0070 # LATIN SMALL LETTER P
0x71 0x0071 # LATIN SMALL LETTER Q
0x72 0x0072 # LATIN SMALL LETTER R
0x73 0x0073 # LATIN SMALL LETTER S
0x74 0x0074 # LATIN SMALL LETTER T
0x75 0x0075 # LATIN SMALL LETTER U
0x76 0x0076 # LATIN SMALL LETTER V
0x77 0x0077 # LATIN SMALL LETTER W
0x78 0x0078 # LATIN SMALL LETTER X
0x79 0x0079 # LATIN SMALL LETTER Y
0x7A 0x007A # LATIN SMALL LETTER Z
0x7B 0x007B # LEFT CURLY BRACKET
0x7C 0x007C # VERTICAL LINE
0x7D 0x007D # RIGHT CURLY BRACKET
0x7E 0x007E # TILDE
0x7F 0x007F # <control>
0x80 0x0080 # <control>
0x81 0x0081 # <control>
0x82 0x0082 # <control>
0x83 0x0083 # <control>
0x84 0x0084 # <control>
0x85 0x0085 # <control>
0x86 0x0086 # <control>
0x87 0x0087 # <control>
0x88 0x0088 # <control>
0x89 0x0089 # <control>
0x8A 0x008A # <control>
0x8B 0x008B # <control>
0x8C 0x008C # <control>
0x8D 0x008D # <control>
0x8E 0x008E # <control>
0x8F 0x008F # <control>
0x90 0x0090 # <control>
0x91 0x0091 # <control>
0x92 0x0092 # <control>
0x93 0x0093 # <control>
0x94 0x0094 # <control>
0x95 0x0095 # <control>
0x96 0x0096 # <control>
0x97 0x0097 # <control>
0x98 0x0098 # <control>
0x99 0x0099 # <control>
0x9A 0x009A # <control>
0x9B 0x009B # <control>
0x9C 0x009C # <control>
0x9D 0x009D # <control>
0x9E 0x009E # <control>
0x9F 0x009F # <control>
0xA0 0x00A0 # NO-BREAK SPACE
0xA1 0x0401 # CYRILLIC CAPITAL LETTER IO /* <20> */
0xA2 0x00A2 # CENT SIGN
0xA3 0x00A3 # POUND SIGN
0xA4 0x00A4 # CURRENCY SIGN
0xA5 0x00A5 # YEN SIGN
0xA6 0x00A6 # BROKEN BAR
0xA7 0x00A7 # SECTION SIGN
0xA8 0x00A8 # DIAERESIS
0xA9 0x00A9 # COPYRIGHT SIGN
0xAA 0x00AA # FEMININE ORDINAL INDICATOR
0xAB 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0xAC 0x00AC # NOT SIGN
0xAD 0x00AD # SOFT HYPHEN
0xAE 0x00AE # REGISTERED SIGN
0xAF 0x00AF # MACRON
0xB0 0x0410 # CYRILLIC CAPITAL LETTER A /* <20> */
0xB1 0x0411 # CYRILLIC CAPITAL LETTER BE /* <20> */
0xB2 0x0412 # CYRILLIC CAPITAL LETTER VE /* <20> */
0xB3 0x0413 # CYRILLIC CAPITAL LETTER GHE /* <20> */
0xB4 0x0414 # CYRILLIC CAPITAL LETTER DE /* <20> */
0xB5 0x0415 # CYRILLIC CAPITAL LETTER IE /* <20> */
0xB6 0x0416 # CYRILLIC CAPITAL LETTER ZHE /* <20> */
0xB7 0x0417 # CYRILLIC CAPITAL LETTER ZE /* <20> */
0xB8 0x0418 # CYRILLIC CAPITAL LETTER I /* <20> */
0xB9 0x0419 # CYRILLIC CAPITAL LETTER SHORT I /* <20> */
0xBA 0x041A # CYRILLIC CAPITAL LETTER KA /* <20> */
0xBB 0x041B # CYRILLIC CAPITAL LETTER EL /* <20> */
0xBC 0x041C # CYRILLIC CAPITAL LETTER EM /* <20> */
0xBD 0x041D # CYRILLIC CAPITAL LETTER EN /* <20> */
0xBE 0x041E # CYRILLIC CAPITAL LETTER O /* <20> */
0xBF 0x041F # CYRILLIC CAPITAL LETTER PE /* <20> */
0xC0 0x0420 # CYRILLIC CAPITAL LETTER ER /* <20> */
0xC1 0x0421 # CYRILLIC CAPITAL LETTER ES /* <20> */
0xC2 0x0422 # CYRILLIC CAPITAL LETTER TE /* <20> */
0xC3 0x0423 # CYRILLIC CAPITAL LETTER U /* <20> */
0xC4 0x0424 # CYRILLIC CAPITAL LETTER EF /* <20> */
0xC5 0x0425 # CYRILLIC CAPITAL LETTER HA /* <20> */
0xC6 0x0426 # CYRILLIC CAPITAL LETTER TSE /* <20> */
0xC7 0x0427 # CYRILLIC CAPITAL LETTER CHE /* <20> */
0xC8 0x0428 # CYRILLIC CAPITAL LETTER SHA /* <20> */
0xC9 0x0429 # CYRILLIC CAPITAL LETTER SHCHA /* <20> */
0xCA 0x042A # CYRILLIC CAPITAL LETTER HARD SIGN /* <20> */
0xCB 0x042B # CYRILLIC CAPITAL LETTER YERU /* <20> */
0xCC 0x042C # CYRILLIC CAPITAL LETTER SOFT SIGN /* <20> */
0xCD 0x042D # CYRILLIC CAPITAL LETTER E /* <20> */
0xCE 0x042E # CYRILLIC CAPITAL LETTER YU /* <20> */
0xCF 0x042F # CYRILLIC CAPITAL LETTER YA /* <20> */
0xD0 0x0430 # CYRILLIC SMALL LETTER A /* <20> */
0xD1 0x0431 # CYRILLIC SMALL LETTER BE /* <20> */
0xD2 0x0432 # CYRILLIC SMALL LETTER VE /* <20> */
0xD3 0x0433 # CYRILLIC SMALL LETTER GHE /* <20> */
0xD4 0x0434 # CYRILLIC SMALL LETTER DE /* <20> */
0xD5 0x0435 # CYRILLIC SMALL LETTER IE /* <20> */
0xD6 0x0436 # CYRILLIC SMALL LETTER ZHE /* <20> */
0xD7 0x0437 # CYRILLIC SMALL LETTER ZE /* <20> */
0xD8 0x0438 # CYRILLIC SMALL LETTER I /* <20> */
0xD9 0x0439 # CYRILLIC SMALL LETTER SHORT I /* <20> */
0xDA 0x043A # CYRILLIC SMALL LETTER KA /* <20> */
0xDB 0x043B # CYRILLIC SMALL LETTER EL /* <20> */
0xDC 0x043C # CYRILLIC SMALL LETTER EM /* <20> */
0xDD 0x043D # CYRILLIC SMALL LETTER EN /* <20> */
0xDE 0x043E # CYRILLIC SMALL LETTER O /* <20> */
0xDF 0x043F # CYRILLIC SMALL LETTER PE /* <20> */
0xE0 0x0440 # CYRILLIC SMALL LETTER ER /* <20> */
0xE1 0x0441 # CYRILLIC SMALL LETTER ES /* <20> */
0xE2 0x0442 # CYRILLIC SMALL LETTER TE /* <20> */
0xE3 0x0443 # CYRILLIC SMALL LETTER U /* <20> */
0xE4 0x0444 # CYRILLIC SMALL LETTER EF /* <20> */
0xE5 0x0445 # CYRILLIC SMALL LETTER HA /* <20> */
0xE6 0x0446 # CYRILLIC SMALL LETTER TSE /* <20> */
0xE7 0x0447 # CYRILLIC SMALL LETTER CHE /* <20> */
0xE8 0x0448 # CYRILLIC SMALL LETTER SHA /* <20> */
0xE9 0x0449 # CYRILLIC SMALL LETTER SHCHA /* <20> */
0xEA 0x044A # CYRILLIC SMALL LETTER HARD SIGN /* <20> */
0xEB 0x044B # CYRILLIC SMALL LETTER YERU /* <20> */
0xEC 0x044C # CYRILLIC SMALL LETTER SOFT SIGN /* <20> */
0xED 0x044D # CYRILLIC SMALL LETTER E /* <20> */
0xEE 0x044E # CYRILLIC SMALL LETTER YU /* <20> */
0xEF 0x044F # CYRILLIC SMALL LETTER YA /* <20> */
0xF0 0x00F0 # LATIN SMALL LETTER ETH
0xF1 0x0451 # CYRILLIC SMALL LETTER IO /* <20> */
0xF2 0x00F2 # LATIN SMALL LETTER O WITH GRAVE
0xF3 0x00F3 # LATIN SMALL LETTER O WITH ACUTE
0xF4 0x00F4 # LATIN SMALL LETTER O WITH CIRCUMFLEX
0xF5 0x00F5 # LATIN SMALL LETTER O WITH TILDE
0xF6 0x00F6 # LATIN SMALL LETTER O WITH DIAERESIS
0xF7 0x00F7 # DIVISION SIGN
0xF8 0x00F8 # LATIN SMALL LETTER O WITH STROKE
0xF9 0x00F9 # LATIN SMALL LETTER U WITH GRAVE
0xFA 0x00FA # LATIN SMALL LETTER U WITH ACUTE
0xFB 0x00FB # LATIN SMALL LETTER U WITH CIRCUMFLEX
0xFC 0x00FC # LATIN SMALL LETTER U WITH DIAERESIS
0xFD 0x00FD # LATIN SMALL LETTER Y WITH ACUTE
0xFE 0x00FE # LATIN SMALL LETTER THORN
0xFF 0x00FF # LATIN SMALL LETTER Y WITH DIAERESIS

232
contrib/ttf2bdf/maps/koi8.r Normal file
View File

@@ -0,0 +1,232 @@
#/*
# * Unicode 2.0 -> KOI8-R
# *
# * 11 Jan 97 | Eugene Bobin, <gene@ftim.ustu.ru>
# *
# * Modified 16 June 99 Mark Leisher <mleisher@crl.nmsu.edu>
# */
REGISTRY KOI8
ENCODING R
0x00 0x0000 # <control>
0x01 0x0001 # <control>
0x02 0x0002 # <control>
0x03 0x0003 # <control>
0x04 0x0004 # <control>
0x05 0x0005 # <control>
0x06 0x0006 # <control>
0x07 0x0007 # <control>
0x08 0x0008 # <control>
0x09 0x0009 # <control>
0x0A 0x000A # <control>
0x0B 0x000B # <control>
0x0C 0x000C # <control>
0x0D 0x000D # <control>
0x0E 0x000E # <control>
0x0F 0x000F # <control>
0x10 0x0010 # <control>
0x11 0x0011 # <control>
0x12 0x0012 # <control>
0x13 0x0013 # <control>
0x14 0x0014 # <control>
0x15 0x0015 # <control>
0x16 0x0016 # <control>
0x17 0x0017 # <control>
0x18 0x0018 # <control>
0x19 0x0019 # <control>
0x1A 0x001A # <control>
0x1B 0x001B # <control>
0x1C 0x001C # <control>
0x1D 0x001D # <control>
0x1E 0x001E # <control>
0x1F 0x001F # <control>
0x20 0x0020 # SPACE
0x21 0x0021 # EXCLAMATION MARK
0x22 0x0022 # QUOTATION MARK
0x23 0x0023 # NUMBER SIGN
0x24 0x0024 # DOLLAR SIGN
0x25 0x0025 # PERCENT SIGN
0x26 0x0026 # AMPERSAND
0x27 0x0027 # APOSTROPHE
0x28 0x0028 # LEFT PARENTHESIS
0x29 0x0029 # RIGHT PARENTHESIS
0x2A 0x002A # ASTERISK
0x2B 0x002B # PLUS SIGN
0x2C 0x002C # COMMA
0x2D 0x002D # HYPHEN-MINUS
0x2E 0x002E # FULL STOP
0x2F 0x002F # SOLIDUS
0x30 0x0030 # DIGIT ZERO
0x31 0x0031 # DIGIT ONE
0x32 0x0032 # DIGIT TWO
0x33 0x0033 # DIGIT THREE
0x34 0x0034 # DIGIT FOUR
0x35 0x0035 # DIGIT FIVE
0x36 0x0036 # DIGIT SIX
0x37 0x0037 # DIGIT SEVEN
0x38 0x0038 # DIGIT EIGHT
0x39 0x0039 # DIGIT NINE
0x3A 0x003A # COLON
0x3B 0x003B # SEMICOLON
0x3C 0x003C # LESS-THAN SIGN
0x3D 0x003D # EQUALS SIGN
0x3E 0x003E # GREATER-THAN SIGN
0x3F 0x003F # QUESTION MARK
0x40 0x0040 # COMMERCIAL AT
0x41 0x0041 # LATIN CAPITAL LETTER A
0x42 0x0042 # LATIN CAPITAL LETTER B
0x43 0x0043 # LATIN CAPITAL LETTER C
0x44 0x0044 # LATIN CAPITAL LETTER D
0x45 0x0045 # LATIN CAPITAL LETTER E
0x46 0x0046 # LATIN CAPITAL LETTER F
0x47 0x0047 # LATIN CAPITAL LETTER G
0x48 0x0048 # LATIN CAPITAL LETTER H
0x49 0x0049 # LATIN CAPITAL LETTER I
0x4A 0x004A # LATIN CAPITAL LETTER J
0x4B 0x004B # LATIN CAPITAL LETTER K
0x4C 0x004C # LATIN CAPITAL LETTER L
0x4D 0x004D # LATIN CAPITAL LETTER M
0x4E 0x004E # LATIN CAPITAL LETTER N
0x4F 0x004F # LATIN CAPITAL LETTER O
0x50 0x0050 # LATIN CAPITAL LETTER P
0x51 0x0051 # LATIN CAPITAL LETTER Q
0x52 0x0052 # LATIN CAPITAL LETTER R
0x53 0x0053 # LATIN CAPITAL LETTER S
0x54 0x0054 # LATIN CAPITAL LETTER T
0x55 0x0055 # LATIN CAPITAL LETTER U
0x56 0x0056 # LATIN CAPITAL LETTER V
0x57 0x0057 # LATIN CAPITAL LETTER W
0x58 0x0058 # LATIN CAPITAL LETTER X
0x59 0x0059 # LATIN CAPITAL LETTER Y
0x5A 0x005A # LATIN CAPITAL LETTER Z
0x5B 0x005B # LEFT SQUARE BRACKET
0x5C 0x005C # REVERSE SOLIDUS
0x5D 0x005D # RIGHT SQUARE BRACKET
0x5E 0x005E # CIRCUMFLEX ACCENT
0x5F 0x005F # LOW LINE
0x60 0x0060 # GRAVE ACCENT
0x61 0x0061 # LATIN SMALL LETTER A
0x62 0x0062 # LATIN SMALL LETTER B
0x63 0x0063 # LATIN SMALL LETTER C
0x64 0x0064 # LATIN SMALL LETTER D
0x65 0x0065 # LATIN SMALL LETTER E
0x66 0x0066 # LATIN SMALL LETTER F
0x67 0x0067 # LATIN SMALL LETTER G
0x68 0x0068 # LATIN SMALL LETTER H
0x69 0x0069 # LATIN SMALL LETTER I
0x6A 0x006A # LATIN SMALL LETTER J
0x6B 0x006B # LATIN SMALL LETTER K
0x6C 0x006C # LATIN SMALL LETTER L
0x6D 0x006D # LATIN SMALL LETTER M
0x6E 0x006E # LATIN SMALL LETTER N
0x6F 0x006F # LATIN SMALL LETTER O
0x70 0x0070 # LATIN SMALL LETTER P
0x71 0x0071 # LATIN SMALL LETTER Q
0x72 0x0072 # LATIN SMALL LETTER R
0x73 0x0073 # LATIN SMALL LETTER S
0x74 0x0074 # LATIN SMALL LETTER T
0x75 0x0075 # LATIN SMALL LETTER U
0x76 0x0076 # LATIN SMALL LETTER V
0x77 0x0077 # LATIN SMALL LETTER W
0x78 0x0078 # LATIN SMALL LETTER X
0x79 0x0079 # LATIN SMALL LETTER Y
0x7A 0x007A # LATIN SMALL LETTER Z
0x7B 0x007B # LEFT CURLY BRACKET
0x7C 0x007C # VERTICAL LINE
0x7D 0x007D # RIGHT CURLY BRACKET
0x7E 0x007E # TILDE
0xA0 0x00A0 # NO-BREAK SPACE
0xA1 0x00A1 # INVERTED EXCLAMATION MARK
0xA2 0x00A2 # CENT SIGN
0xA3 0x0451 # CYRILLIC SMALL LETTER IO /* <20> */
0xA4 0x00A4 # CURRENCY SIGN
0xA5 0x00A5 # YEN SIGN
0xA6 0x00A6 # BROKEN BAR
0xA7 0x00A7 # SECTION SIGN
0xA8 0x00A8 # DIAERESIS
0xA9 0x00A9 # COPYRIGHT SIGN
0xAA 0x00AA # FEMININE ORDINAL INDICATOR
0xAB 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0xAC 0x00AC # NOT SIGN
0xAD 0x00AD # SOFT HYPHEN
0xAE 0x00AE # REGISTERED SIGN
0xAF 0x00AF # MACRON
0xB0 0x00B0 # DEGREE SIGN
0xB1 0x00B1 # PLUS-MINUS SIGN
0xB2 0x00B2 # SUPERSCRIPT TWO
0xB3 0x0401 # CYRILLIC CAPITAL LETTER IO /* <20> */
0xB4 0x00B4 # ACUTE ACCENT
0xB5 0x00B5 # MICRO SIGN
0xB6 0x00B6 # PILCROW SIGN
0xB7 0x00B7 # MIDDLE DOT
0xB8 0x00B8 # CEDILLA
0xB9 0x00B9 # SUPERSCRIPT ONE
0xBA 0x00BA # MASCULINE ORDINAL INDICATOR
0xBB 0x00BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0xBC 0x00BC # VULGAR FRACTION ONE QUARTER
0xBD 0x00BD # VULGAR FRACTION ONE HALF
0xBE 0x00BE # VULGAR FRACTION THREE QUARTERS
0xBF 0x00BF # INVERTED QUESTION MARK
0xC0 0x044E # CYRILLIC SMALL LETTER YU /* <20> */
0xC1 0x0430 # CYRILLIC SMALL LETTER A /* <20> */
0xC2 0x0431 # CYRILLIC SMALL LETTER BE /* <20> */
0xC3 0x0446 # CYRILLIC SMALL LETTER TSE /* <20> */
0xC4 0x0434 # CYRILLIC SMALL LETTER DE /* <20> */
0xC5 0x0435 # CYRILLIC SMALL LETTER IE /* <20> */
0xC6 0x0444 # CYRILLIC SMALL LETTER EF /* <20> */
0xC7 0x0433 # CYRILLIC SMALL LETTER GHE /* <20> */
0xC8 0x0445 # CYRILLIC SMALL LETTER HA /* <20> */
0xC9 0x0438 # CYRILLIC SMALL LETTER I /* <20> */
0xCA 0x0439 # CYRILLIC SMALL LETTER SHORT I /* <20> */
0xCB 0x043A # CYRILLIC SMALL LETTER KA /* <20> */
0xCC 0x043B # CYRILLIC SMALL LETTER EL /* <20> */
0xCD 0x043C # CYRILLIC SMALL LETTER EM /* <20> */
0xCE 0x043D # CYRILLIC SMALL LETTER EN /* <20> */
0xCF 0x043E # CYRILLIC SMALL LETTER O /* <20> */
0xD0 0x043F # CYRILLIC SMALL LETTER PE /* <20> */
0xD1 0x044F # CYRILLIC SMALL LETTER YA /* <20> */
0xD2 0x0440 # CYRILLIC SMALL LETTER ER /* <20> */
0xD3 0x0441 # CYRILLIC SMALL LETTER ES /* <20> */
0xD4 0x0442 # CYRILLIC SMALL LETTER TE /* <20> */
0xD5 0x0443 # CYRILLIC SMALL LETTER U /* <20> */
0xD6 0x0436 # CYRILLIC SMALL LETTER ZHE /* <20> */
0xD7 0x0432 # CYRILLIC SMALL LETTER VE /* <20> */
0xD8 0x044C # CYRILLIC SMALL LETTER SOFT SIGN /* <20> */
0xD9 0x044B # CYRILLIC SMALL LETTER YERU /* <20> */
0xDA 0x0437 # CYRILLIC SMALL LETTER ZE /* <20> */
0xDB 0x0448 # CYRILLIC SMALL LETTER SHA /* <20> */
0xDC 0x044D # CYRILLIC SMALL LETTER E /* <20> */
0xDD 0x0449 # CYRILLIC SMALL LETTER SHCHA /* <20> */
0xDE 0x0447 # CYRILLIC SMALL LETTER CHE /* <20> */
0xDF 0x044A # CYRILLIC SMALL LETTER HARD SIGN /* <20> */
0xE0 0x042E # CYRILLIC CAPITAL LETTER YU /* <20> */
0xE1 0x0410 # CYRILLIC CAPITAL LETTER A /* <20> */
0xE2 0x0411 # CYRILLIC CAPITAL LETTER BE /* <20> */
0xE3 0x0426 # CYRILLIC CAPITAL LETTER TSE /* <20> */
0xE4 0x0414 # CYRILLIC CAPITAL LETTER DE /* <20> */
0xE5 0x0415 # CYRILLIC CAPITAL LETTER IE /* <20> */
0xE6 0x0424 # CYRILLIC CAPITAL LETTER EF /* <20> */
0xE7 0x0413 # CYRILLIC CAPITAL LETTER GHE /* <20> */
0xE8 0x0425 # CYRILLIC CAPITAL LETTER HA /* <20> */
0xE9 0x0418 # CYRILLIC CAPITAL LETTER I /* <20> */
0xEA 0x0419 # CYRILLIC CAPITAL LETTER SHORT I /* <20> */
0xEB 0x041A # CYRILLIC CAPITAL LETTER KA /* <20> */
0xEC 0x041B # CYRILLIC CAPITAL LETTER EL /* <20> */
0xED 0x041C # CYRILLIC CAPITAL LETTER EM /* <20> */
0xEE 0x041D # CYRILLIC CAPITAL LETTER EN /* <20> */
0xEF 0x041E # CYRILLIC CAPITAL LETTER O /* <20> */
0xF0 0x041F # CYRILLIC CAPITAL LETTER PE /* <20> */
0xF1 0x042F # CYRILLIC CAPITAL LETTER YA /* <20> */
0xF2 0x0420 # CYRILLIC CAPITAL LETTER ER /* <20> */
0xF3 0x0421 # CYRILLIC CAPITAL LETTER ES /* <20> */
0xF4 0x0422 # CYRILLIC CAPITAL LETTER TE /* <20> */
0xF5 0x0423 # CYRILLIC CAPITAL LETTER U /* <20> */
0xF6 0x0416 # CYRILLIC CAPITAL LETTER ZHE /* <20> */
0xF7 0x0412 # CYRILLIC CAPITAL LETTER VE /* <20> */
0xF8 0x042C # CYRILLIC CAPITAL LETTER SOFT SIGN /* <20> */
0xF9 0x042B # CYRILLIC CAPITAL LETTER YERU /* <20> */
0xFA 0x0417 # CYRILLIC CAPITAL LETTER ZE /* <20> */
0xFB 0x0428 # CYRILLIC CAPITAL LETTER SHA /* <20> */
0xFC 0x042D # CYRILLIC CAPITAL LETTER E /* <20> */
0xFD 0x0429 # CYRILLIC CAPITAL LETTER SHCHA /* <20> */
0xFE 0x0427 # CYRILLIC CAPITAL LETTER CHE /* <20> */
0xFF 0x042A # CYRILLIC CAPITAL LETTER HARD SIGN /* <20> */

View File

@@ -0,0 +1,233 @@
#/*
# * Unicode 2.0 -> Windows CP_1251 (Must Die ;)
# *
# * 11 Jan 97 | Eugene Bobin, <gene@ftim.ustu.ru>
# *
# * Modified 16 June 99 Mark Leisher <mleisher@crl.nmsu.edu>
# */
#
REGISTRY WINDOWS
ENCODING 1251
0x00 0x0000 # <control>
0x01 0x0001 # <control>
0x02 0x0002 # <control>
0x03 0x0003 # <control>
0x04 0x0004 # <control>
0x05 0x0005 # <control>
0x06 0x0006 # <control>
0x07 0x0007 # <control>
0x08 0x0008 # <control>
0x09 0x0009 # <control>
0x0A 0x000A # <control>
0x0B 0x000B # <control>
0x0C 0x000C # <control>
0x0D 0x000D # <control>
0x0E 0x000E # <control>
0x0F 0x000F # <control>
0x10 0x0010 # <control>
0x11 0x0011 # <control>
0x12 0x0012 # <control>
0x13 0x0013 # <control>
0x14 0x0014 # <control>
0x15 0x0015 # <control>
0x16 0x0016 # <control>
0x17 0x0017 # <control>
0x18 0x0018 # <control>
0x19 0x0019 # <control>
0x1A 0x001A # <control>
0x1B 0x001B # <control>
0x1C 0x001C # <control>
0x1D 0x001D # <control>
0x1E 0x001E # <control>
0x1F 0x001F # <control>
0x20 0x0020 # SPACE
0x21 0x0021 # EXCLAMATION MARK
0x22 0x0022 # QUOTATION MARK
0x23 0x0023 # NUMBER SIGN
0x24 0x0024 # DOLLAR SIGN
0x25 0x0025 # PERCENT SIGN
0x26 0x0026 # AMPERSAND
0x27 0x0027 # APOSTROPHE
0x28 0x0028 # LEFT PARENTHESIS
0x29 0x0029 # RIGHT PARENTHESIS
0x2A 0x002A # ASTERISK
0x2B 0x002B # PLUS SIGN
0x2C 0x002C # COMMA
0x2D 0x002D # HYPHEN-MINUS
0x2E 0x002E # FULL STOP
0x2F 0x002F # SOLIDUS
0x30 0x0030 # DIGIT ZERO
0x31 0x0031 # DIGIT ONE
0x32 0x0032 # DIGIT TWO
0x33 0x0033 # DIGIT THREE
0x34 0x0034 # DIGIT FOUR
0x35 0x0035 # DIGIT FIVE
0x36 0x0036 # DIGIT SIX
0x37 0x0037 # DIGIT SEVEN
0x38 0x0038 # DIGIT EIGHT
0x39 0x0039 # DIGIT NINE
0x3A 0x003A # COLON
0x3B 0x003B # SEMICOLON
0x3C 0x003C # LESS-THAN SIGN
0x3D 0x003D # EQUALS SIGN
0x3E 0x003E # GREATER-THAN SIGN
0x3F 0x003F # QUESTION MARK
0x40 0x0040 # COMMERCIAL AT
0x41 0x0041 # LATIN CAPITAL LETTER A
0x42 0x0042 # LATIN CAPITAL LETTER B
0x43 0x0043 # LATIN CAPITAL LETTER C
0x44 0x0044 # LATIN CAPITAL LETTER D
0x45 0x0045 # LATIN CAPITAL LETTER E
0x46 0x0046 # LATIN CAPITAL LETTER F
0x47 0x0047 # LATIN CAPITAL LETTER G
0x48 0x0048 # LATIN CAPITAL LETTER H
0x49 0x0049 # LATIN CAPITAL LETTER I
0x4A 0x004A # LATIN CAPITAL LETTER J
0x4B 0x004B # LATIN CAPITAL LETTER K
0x4C 0x004C # LATIN CAPITAL LETTER L
0x4D 0x004D # LATIN CAPITAL LETTER M
0x4E 0x004E # LATIN CAPITAL LETTER N
0x4F 0x004F # LATIN CAPITAL LETTER O
0x50 0x0050 # LATIN CAPITAL LETTER P
0x51 0x0051 # LATIN CAPITAL LETTER Q
0x52 0x0052 # LATIN CAPITAL LETTER R
0x53 0x0053 # LATIN CAPITAL LETTER S
0x54 0x0054 # LATIN CAPITAL LETTER T
0x55 0x0055 # LATIN CAPITAL LETTER U
0x56 0x0056 # LATIN CAPITAL LETTER V
0x57 0x0057 # LATIN CAPITAL LETTER W
0x58 0x0058 # LATIN CAPITAL LETTER X
0x59 0x0059 # LATIN CAPITAL LETTER Y
0x5A 0x005A # LATIN CAPITAL LETTER Z
0x5B 0x005B # LEFT SQUARE BRACKET
0x5C 0x005C # REVERSE SOLIDUS
0x5D 0x005D # RIGHT SQUARE BRACKET
0x5E 0x005E # CIRCUMFLEX ACCENT
0x5F 0x005F # LOW LINE
0x60 0x0060 # GRAVE ACCENT
0x61 0x0061 # LATIN SMALL LETTER A
0x62 0x0062 # LATIN SMALL LETTER B
0x63 0x0063 # LATIN SMALL LETTER C
0x64 0x0064 # LATIN SMALL LETTER D
0x65 0x0065 # LATIN SMALL LETTER E
0x66 0x0066 # LATIN SMALL LETTER F
0x67 0x0067 # LATIN SMALL LETTER G
0x68 0x0068 # LATIN SMALL LETTER H
0x69 0x0069 # LATIN SMALL LETTER I
0x6A 0x006A # LATIN SMALL LETTER J
0x6B 0x006B # LATIN SMALL LETTER K
0x6C 0x006C # LATIN SMALL LETTER L
0x6D 0x006D # LATIN SMALL LETTER M
0x6E 0x006E # LATIN SMALL LETTER N
0x6F 0x006F # LATIN SMALL LETTER O
0x70 0x0070 # LATIN SMALL LETTER P
0x71 0x0071 # LATIN SMALL LETTER Q
0x72 0x0072 # LATIN SMALL LETTER R
0x73 0x0073 # LATIN SMALL LETTER S
0x74 0x0074 # LATIN SMALL LETTER T
0x75 0x0075 # LATIN SMALL LETTER U
0x76 0x0076 # LATIN SMALL LETTER V
0x77 0x0077 # LATIN SMALL LETTER W
0x78 0x0078 # LATIN SMALL LETTER X
0x79 0x0079 # LATIN SMALL LETTER Y
0x7A 0x007A # LATIN SMALL LETTER Z
0x7B 0x007B # LEFT CURLY BRACKET
0x7C 0x007C # VERTICAL LINE
0x7D 0x007D # RIGHT CURLY BRACKET
0x7E 0x007E # TILDE
0xA0 0x00A0 # NO-BREAK SPACE
0xA1 0x00A1 # INVERTED EXCLAMATION MARK
0xA2 0x00A2 # CENT SIGN
0xA3 0x0451 # CYRILLIC SMALL LETTER IO /* <20> */
0xA4 0x00A4 # CURRENCY SIGN
0xA5 0x00A5 # YEN SIGN
0xA6 0x00A6 # BROKEN BAR
0xA7 0x00A7 # SECTION SIGN
0xA8 0x00A8 # DIAERESIS
0xA9 0x00A9 # COPYRIGHT SIGN
0xAA 0x00AA # FEMININE ORDINAL INDICATOR
0xAB 0x00AB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
0xAC 0x00AC # NOT SIGN
0xAD 0x00AD # SOFT HYPHEN
0xAE 0x00AE # REGISTERED SIGN
0xAF 0x00AF # MACRON
0xB0 0x00B0 # DEGREE SIGN
0xB1 0x00B1 # PLUS-MINUS SIGN
0xB2 0x00B2 # SUPERSCRIPT TWO
0xB3 0x0401 # CYRILLIC CAPITAL LETTER IO /* <20> */
0xB4 0x00B4 # ACUTE ACCENT
0xB5 0x00B5 # MICRO SIGN
0xB6 0x00B6 # PILCROW SIGN
0xB7 0x00B7 # MIDDLE DOT
0xB8 0x00B8 # CEDILLA
0xB9 0x00B9 # SUPERSCRIPT ONE
0xBA 0x00BA # MASCULINE ORDINAL INDICATOR
0xBB 0x00BB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
0xBC 0x00BC # VULGAR FRACTION ONE QUARTER
0xBD 0x00BD # VULGAR FRACTION ONE HALF
0xBE 0x00BE # VULGAR FRACTION THREE QUARTERS
0xBF 0x00BF # INVERTED QUESTION MARK
0xC0 0x044E # CYRILLIC SMALL LETTER YU /* <20> */
0xC1 0x0430 # CYRILLIC SMALL LETTER A /* <20> */
0xC2 0x0431 # CYRILLIC SMALL LETTER BE /* <20> */
0xC3 0x0446 # CYRILLIC SMALL LETTER TSE /* <20> */
0xC4 0x0434 # CYRILLIC SMALL LETTER DE /* <20> */
0xC5 0x0435 # CYRILLIC SMALL LETTER IE /* <20> */
0xC6 0x0444 # CYRILLIC SMALL LETTER EF /* <20> */
0xC7 0x0433 # CYRILLIC SMALL LETTER GHE /* <20> */
0xC8 0x0445 # CYRILLIC SMALL LETTER HA /* <20> */
0xC9 0x0438 # CYRILLIC SMALL LETTER I /* <20> */
0xCA 0x0439 # CYRILLIC SMALL LETTER SHORT I /* <20> */
0xCB 0x043A # CYRILLIC SMALL LETTER KA /* <20> */
0xCC 0x043B # CYRILLIC SMALL LETTER EL /* <20> */
0xCD 0x043C # CYRILLIC SMALL LETTER EM /* <20> */
0xCE 0x043D # CYRILLIC SMALL LETTER EN /* <20> */
0xCF 0x043E # CYRILLIC SMALL LETTER O /* <20> */
0xD0 0x043F # CYRILLIC SMALL LETTER PE /* <20> */
0xD1 0x044F # CYRILLIC SMALL LETTER YA /* <20> */
0xD2 0x0440 # CYRILLIC SMALL LETTER ER /* <20> */
0xD3 0x0441 # CYRILLIC SMALL LETTER ES /* <20> */
0xD4 0x0442 # CYRILLIC SMALL LETTER TE /* <20> */
0xD5 0x0443 # CYRILLIC SMALL LETTER U /* <20> */
0xD6 0x0436 # CYRILLIC SMALL LETTER ZHE /* <20> */
0xD7 0x0432 # CYRILLIC SMALL LETTER VE /* <20> */
0xD8 0x044C # CYRILLIC SMALL LETTER SOFT SIGN /* <20> */
0xD9 0x044B # CYRILLIC SMALL LETTER YERU /* <20> */
0xDA 0x0437 # CYRILLIC SMALL LETTER ZE /* <20> */
0xDB 0x0448 # CYRILLIC SMALL LETTER SHA /* <20> */
0xDC 0x044D # CYRILLIC SMALL LETTER E /* <20> */
0xDD 0x0449 # CYRILLIC SMALL LETTER SHCHA /* <20> */
0xDE 0x0447 # CYRILLIC SMALL LETTER CHE /* <20> */
0xDF 0x044A # CYRILLIC SMALL LETTER HARD SIGN /* <20> */
0xE0 0x042E # CYRILLIC CAPITAL LETTER YU /* <20> */
0xE1 0x0410 # CYRILLIC CAPITAL LETTER A /* <20> */
0xE2 0x0411 # CYRILLIC CAPITAL LETTER BE /* <20> */
0xE3 0x0426 # CYRILLIC CAPITAL LETTER TSE /* <20> */
0xE4 0x0414 # CYRILLIC CAPITAL LETTER DE /* <20> */
0xE5 0x0415 # CYRILLIC CAPITAL LETTER IE /* <20> */
0xE6 0x0424 # CYRILLIC CAPITAL LETTER EF /* <20> */
0xE7 0x0413 # CYRILLIC CAPITAL LETTER GHE /* <20> */
0xE8 0x0425 # CYRILLIC CAPITAL LETTER HA /* <20> */
0xE9 0x0418 # CYRILLIC CAPITAL LETTER I /* <20> */
0xEA 0x0419 # CYRILLIC CAPITAL LETTER SHORT I /* <20> */
0xEB 0x041A # CYRILLIC CAPITAL LETTER KA /* <20> */
0xEC 0x041B # CYRILLIC CAPITAL LETTER EL /* <20> */
0xED 0x041C # CYRILLIC CAPITAL LETTER EM /* <20> */
0xEE 0x041D # CYRILLIC CAPITAL LETTER EN /* <20> */
0xEF 0x041E # CYRILLIC CAPITAL LETTER O /* <20> */
0xF0 0x041F # CYRILLIC CAPITAL LETTER PE /* <20> */
0xF1 0x042F # CYRILLIC CAPITAL LETTER YA /* <20> */
0xF2 0x0420 # CYRILLIC CAPITAL LETTER ER /* <20> */
0xF3 0x0421 # CYRILLIC CAPITAL LETTER ES /* <20> */
0xF4 0x0422 # CYRILLIC CAPITAL LETTER TE /* <20> */
0xF5 0x0423 # CYRILLIC CAPITAL LETTER U /* <20> */
0xF6 0x0416 # CYRILLIC CAPITAL LETTER ZHE /* <20> */
0xF7 0x0412 # CYRILLIC CAPITAL LETTER VE /* <20> */
0xF8 0x042C # CYRILLIC CAPITAL LETTER SOFT SIGN /* <20> */
0xF9 0x042B # CYRILLIC CAPITAL LETTER YERU /* <20> */
0xFA 0x0417 # CYRILLIC CAPITAL LETTER ZE /* <20> */
0xFB 0x0428 # CYRILLIC CAPITAL LETTER SHA /* <20> */
0xFC 0x042D # CYRILLIC CAPITAL LETTER E /* <20> */
0xFD 0x0429 # CYRILLIC CAPITAL LETTER SHCHA /* <20> */
0xFE 0x0427 # CYRILLIC CAPITAL LETTER CHE /* <20> */
0xFF 0x042A # CYRILLIC CAPITAL LETTER HARD SIGN /* <20> */

690
contrib/ttf2bdf/remap.c Normal file
View File

@@ -0,0 +1,690 @@
/*
* Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
* New Mexico State University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef lint
#ifdef __GNUC__
static char rcsid[] __attribute__ ((unused)) = "$Id: remap.c,v 1.9 1999/06/16 16:13:11 mleisher Exp $";
#else
static char rcsid[] = "$Id: remap.c,v 1.9 1999/06/16 16:13:11 mleisher Exp $";
#endif
#endif
#include <stdio.h>
#include <string.h>
#ifdef WIN32
#include <windows.h>
#else
#include <stdlib.h>
#include <unistd.h>
#endif
/*
* Structure for managing simple lists in place.
*/
typedef struct {
unsigned char *bfield;
unsigned long bsize;
unsigned long bused;
unsigned char **field;
unsigned long size;
unsigned long used;
} list_t;
/*
* Callback type used with the high speed text file reader function.
*/
typedef int (*scanlines_callback_t)(
#ifdef __STDC__
unsigned char *line,
unsigned long linelen,
unsigned long lineno,
void *client_data
#endif
);
/*
* Various utility routines.
*/
#define setsbit(m, cc) (m[(cc) >> 3] |= (1 << ((cc) & 7)))
#define sbitset(m, cc) (m[(cc) >> 3] & (1 << ((cc) & 7)))
/*
* An empty string for empty fields.
*/
static unsigned char empty[1] = { 0 };
/*
* Assume the line is NULL terminated and that the `list' parameter was
* initialized the first time it was used.
*/
static void
#ifdef __STDC__
splitline(unsigned char *separators, unsigned char *line,
unsigned long linelen, list_t *list)
#else
splitline(separators, line, linelen, list)
unsigned char *separators, *line;
unsigned long linelen;
list_t *list;
#endif
{
int mult, final_empty;
unsigned char *sp, *ep, *end;
unsigned char seps[32];
/*
* Initialize the list.
*/
list->used = list->bused = 0;
/*
* If the line is empty, then simply return.
*/
if (linelen == 0 || line[0] == 0)
return;
/*
* If the `separators' parameter is NULL or empty, split the list into
* individual bytes.
*/
if (separators == 0 || *separators == 0) {
if (linelen > list->bsize) {
if (list->bsize)
list->bfield = (unsigned char *) malloc(linelen);
else
list->bfield = (unsigned char *) realloc(list->bfield, linelen);
list->bsize = linelen;
}
list->bused = linelen;
(void) memcpy(list->bfield, line, linelen);
return;
}
/*
* Prepare the separator bitmap.
*/
(void) memset((char *) seps, 0, 32);
/*
* If the very last character of the separator string is a plus, then set
* the `mult' flag to indicate that multiple separators should be
* collapsed into one.
*/
for (mult = 0, sp = separators; sp && *sp; sp++) {
if (*sp == '+' && *(sp + 1) == 0)
mult = 1;
else
setsbit(seps, *sp);
}
/*
* Break the line up into fields.
*/
for (final_empty = 0, sp = ep = line, end = sp + linelen;
sp < end && *sp;) {
/*
* Collect everything that is not a separator.
*/
for (; ep < end && *ep && !sbitset(seps, *ep); ep++) ;
/*
* Resize the list if necessary.
*/
if (list->used == list->size) {
if (list->size == 0)
list->field = (unsigned char **)
malloc(sizeof(unsigned char *) << 3);
else
list->field = (unsigned char **)
realloc((char *) list->field,
sizeof(unsigned char *) * (list->size + 8));
list->size += 8;
}
/*
* Assign the field appropriately.
*/
list->field[list->used++] = (ep > sp) ? sp : empty;
sp = ep;
if (mult) {
/*
* If multiple separators should be collapsed, do it now by
* setting all the separator characters to 0.
*/
for (; ep < end && *ep && sbitset(seps, *ep); ep++)
*ep = 0;
} else
/*
* Don't collapse multiple separators by making them 0, so just
* make the one encountered 0.
*/
*ep++ = 0;
final_empty = (ep > sp && *ep == 0);
sp = ep;
}
/*
* Finally, NULL terminate the list.
*/
if (list->used + final_empty + 1 >= list->size) {
if (list->used == list->size) {
if (list->size == 0)
list->field = (unsigned char **)
malloc(sizeof(unsigned char *) << 3);
else
list->field = (unsigned char **)
realloc((unsigned char *) list->field,
sizeof(char *) * (list->size + 8));
list->size += 8;
}
}
if (final_empty)
list->field[list->used++] = empty;
if (list->used == list->size) {
if (list->size == 0)
list->field = (unsigned char **)
malloc(sizeof(unsigned char *) << 3);
else
list->field = (unsigned char **)
realloc((char *) list->field,
sizeof(unsigned char *) * (list->size + 8));
list->size += 8;
}
list->field[list->used] = 0;
}
static int
#ifdef __STDC__
scanlines(int fd, scanlines_callback_t callback, void *client_data,
unsigned long *lineno)
#else
scanlines(fd, callback, client_data, lineno)
int fd;
scanlines_callback_t callback;
void *client_data;
unsigned long *lineno;
#endif
{
unsigned long lno;
int n, res, done, refill, bytes, hold;
char *ls, *le, *pp, *pe, *hp;
char buf[65536];
if (callback == 0)
return -1;
lno = 1;
(void) memset(buf, 0, 65536);
res = done = 0;
pp = ls = le = buf;
bytes = 65536;
while (!done && (n = read(fd, pp, bytes)) > 0) {
/*
* Determine the new end of the buffer pages.
*/
pe = pp + n;
for (refill = 0; done == 0 && refill == 0; ) {
while (le < pe && *le != '\n' && *le != '\r')
le++;
if (le == pe) {
/*
* Hit the end of the last page in the buffer.
* Need to find out how many pages to shift
* and how many pages need to be read in.
* Adjust the line start and end pointers down
* to point to the right places in the pages.
*/
pp = buf + (((ls - buf) >> 13) << 13);
n = pp - buf;
ls -= n;
le -= n;
n = pe - pp;
(void) memcpy(buf, pp, n);
pp = buf + n;
bytes = 65536 - n;
refill = 1;
} else {
/*
* Temporarily NULL terminate the line.
*/
hp = le;
hold = *le;
*le = 0;
if (callback && *ls != '#' && *ls != 0x1a && le > ls &&
(res = (*callback)((unsigned char *) ls, le - ls, lno,
client_data)) != 0)
done = 1;
else {
ls = ++le;
/*
* Handle the case of DOS CRLF sequences.
*/
if (le < pe && hold == '\n' && *le =='\r')
ls = ++le;
}
/*
* Increment the line number.
*/
lno++;
/*
* Restore the character at the end of the line.
*/
*hp = hold;
}
}
}
/*
* Return with the last line number processed.
*/
*lineno = lno;
return res;
}
static unsigned char a2i[128] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static unsigned char odigits[32] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static unsigned char ddigits[32] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static unsigned char hdigits[32] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03,
0x7e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
#define isdigok(m, d) (m[(d) >> 3] & (1 << ((d) & 7)))
static unsigned short
#ifdef __STDC__
my_atous(unsigned char *s, unsigned char **end, int base)
#else
my_atous(s, end, base)
unsigned char *s, **end;
int base;
#endif
{
unsigned short v;
unsigned char *dmap;
if (s == 0 || *s == 0)
return 0;
/*
* Make sure the radix is something recognizable. Default to 10.
*/
switch (base) {
case 8: dmap = odigits; break;
case 16: dmap = hdigits; break;
default: base = 10; dmap = ddigits; break;
}
/*
* Check for the special hex prefix.
*/
if (*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')) {
base = 16;
dmap = hdigits;
s += 2;
}
for (v = 0; isdigok(dmap, *s); s++)
v = (v * base) + a2i[(int) *s];
if (end != 0)
*end = s;
return v;
}
/********************************************************************
*
* Routines to load, unload, and use mapping tables to remap BDF fonts
* generated using ttf2bdf.
*
********************************************************************/
/*
* Strings used to store the registry and encoding values specified
* in the mapping table.
*/
static char *registry;
static char *encoding;
/*
* Trie node structure.
*/
typedef struct {
unsigned short key; /* Key value. */
unsigned short val; /* Data for the key. */
unsigned long sibs; /* Offset of siblings from trie beginning. */
unsigned long kids; /* Offset of children from trie beginning. */
} node_t;
/*
* The trie used for remapping codes.
*/
static node_t *nodes;
static unsigned long nodes_size = 0;
static unsigned long nodes_used = 0;
/*
* Gets the next available node in the trie.
*/
static unsigned long
#ifdef __STDC__
getnode(unsigned short key)
#else
getnode(key)
unsigned short key;
#endif
{
unsigned long loc;
node_t *np;
if (nodes_used == nodes_size) {
if (nodes_size == 0)
nodes = (node_t *) malloc(sizeof(node_t) << 7);
else
nodes = (node_t *) realloc((char *) nodes, sizeof(node_t) *
(nodes_size + 128));
np = nodes + nodes_size;
nodes_size += 128;
(void) memset((char *) np, 0, sizeof(node_t) << 7);
}
loc = nodes_used++;
np = nodes + loc;
np->kids = np->sibs = 0;
np->key = key;
return loc;
}
/*
* Inserts a node in the trie.
*/
static void
#ifdef __STDC__
trie_insert(unsigned short key, unsigned short val)
#else
trie_insert(key, val)
unsigned short key, val;
#endif
{
unsigned long i, n, t, l;
unsigned short codes[2];
/*
* Convert the incoming key into two codes to make the trie lookup more
* efficient.
*/
codes[0] = (key >> 8) & 0xff;
codes[1] = key & 0xff;
for (i = t = 0; i < 2; i++) {
if (nodes[t].kids == 0) {
n = getnode(codes[i]);
nodes[t].kids = t = n;
} else if (nodes[nodes[t].kids].key == codes[i])
t = nodes[t].kids;
else if (nodes[nodes[t].kids].key > codes[i]) {
n = getnode(codes[i]);
nodes[n].sibs = nodes[t].kids;
nodes[t].kids = t = n;
} else {
t = nodes[t].kids;
for (l = t; nodes[t].sibs && nodes[t].key < codes[i]; ) {
l = t;
t = nodes[t].sibs;
}
if (nodes[t].key < codes[i]) {
n = getnode(codes[i]);
nodes[t].sibs = t = n;
} else if (nodes[t].key > codes[i]) {
n = getnode(codes[i]);
nodes[n].sibs = t;
nodes[l].sibs = t = n;
}
}
}
/*
* Set the value in the leaf node.
*/
nodes[t].val = val;
}
/*
* List used by the routine that parses the map lines.
*/
static list_t list;
/*
* Routine to parse each line of the mapping file.
*/
static int
#ifdef __STDC__
add_mapping(unsigned char *line, unsigned long linelen, unsigned long lineno,
void *client_data)
#else
add_mapping(line, linelen, lineno, client_data)
unsigned char *line;
unsigned long linelen, lineno;
void *client_data;
#endif
{
unsigned short key, val;
/*
* Split the line into parts separted by one or more spaces or tabs.
*/
splitline((unsigned char *) " \t+", line, linelen, &list);
/*
* Check to see if the line starts with one of the keywords.
*/
if (memcmp((char *) list.field[0], "REGISTRY", 8) == 0) {
/*
* Collect the XLFD CHARSET_REGISTRY value.
*/
if (registry != 0)
free((char *) registry);
if ((val = strlen((char *) list.field[1])) == 0)
registry = 0;
else {
registry = (char *) malloc(val + 1);
(void) memcpy(registry, (char *) list.field[1], val + 1);
}
return 0;
}
if (memcmp((char *) list.field[0], "ENCODING", 8) == 0) {
/*
* Collect the XLFD CHARSET_ENCODING value.
*/
if (encoding != 0)
free((char *) encoding);
if ((val = strlen((char *) list.field[1])) == 0)
encoding = 0;
else {
encoding = (char *) malloc(val + 1);
(void) memcpy(encoding, (char *) list.field[1], val + 1);
}
return 0;
}
/*
* Get the second field value as the key (the Unicode value). Always
* assume the values are in hex.
*/
key = my_atous(list.field[1], 0, 16);
val = my_atous(list.field[0], 0, 16);
trie_insert(key, val);
return 0;
}
/********************************************************************
*
* API for mapping table support.
*
********************************************************************/
int
#ifdef __STDC__
ttf2bdf_load_map(FILE *in)
#else
ttf2bdf_load_map(in)
FILE *in;
#endif
{
unsigned long lineno;
/*
* Allocate some nodes initially.
*/
if (nodes_size == 0) {
nodes = (node_t *) malloc(sizeof(node_t) << 7);
nodes_size = 128;
}
/*
* Reset the trie in case more than one gets loaded for some reason.
*/
if (nodes_size > 0)
(void) memset((char *) nodes, 0, sizeof(node_t) * nodes_size);
nodes_used = 1;
return scanlines(fileno(in), add_mapping, 0, &lineno);
}
/*
* Routine that deallocates the mapping trie.
*/
void
#ifdef __STDC__
ttf2bdf_free_map(void)
#else
ttf2bdf_free_map()
#endif
{
if (registry != 0)
free((char *) registry);
if (encoding != 0)
free((char *) encoding);
registry = encoding = 0;
if (list.size > 0)
free((char *) list.field);
list.size = list.used = 0;
if (nodes_size > 0)
free((char *) nodes);
nodes_size = nodes_used = 0;
}
/*
* The routine that actually remaps the code by looking it up in the trie.
*/
int
#ifdef __STDC__
ttf2bdf_remap(unsigned short *code)
#else
ttf2bdf_remap(code)
unsigned short *code;
#endif
{
unsigned long i, n, t;
unsigned short c, codes[2];
/*
* If no mapping table was loaded, then simply return the code.
*/
if (nodes_used == 0)
return 1;
c = *code;
codes[0] = (c >> 8) & 0xff;
codes[1] = c & 0xff;
for (i = n = 0; i < 2; i++) {
t = nodes[n].kids;
if (t == 0)
return 0;
for (; nodes[t].sibs && nodes[t].key != codes[i]; t = nodes[t].sibs);
if (nodes[t].key != codes[i])
return 0;
n = t;
}
*code = nodes[n].val;
return 1;
}
void
#ifdef __STDC__
ttf2bdf_remap_charset(char **registry_name, char **encoding_name)
#else
ttf2bdf_remap_charset(registry_name, encoding_name)
char **registry_name, **encoding_name;
#endif
{
if (registry_name != 0)
*registry_name = registry;
if (encoding_name != 0)
*encoding_name = encoding;
}

64
contrib/ttf2bdf/remap.h Normal file
View File

@@ -0,0 +1,64 @@
/*
* Copyright 1996, 1997, 1998, 1999 Computing Research Labs,
* New Mexico State University
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _h_remap
#define _h_remap
/*
* $Id: remap.h,v 1.4 1999/05/03 17:07:04 mleisher Exp $
*/
#ifdef __cplusplus
extern "C" {
#endif
extern int ttf2bdf_load_map(
#ifdef __STDC__
FILE *in
#endif
);
extern void ttf2bdf_free_map(
#ifdef __STDC__
void
#endif
);
extern int ttf2bdf_remap(
#ifdef __STDC__
unsigned short *code
#endif
);
extern void ttf2bdf_remap_charset(
#ifdef __STDC__
char **registry_name,
char **encoding_name
#endif
);
#ifdef __cplusplus
}
#endif
#endif /* _h_remap */

1581
contrib/ttf2bdf/ttf2bdf.c Normal file

File diff suppressed because it is too large Load Diff

196
contrib/ttf2bdf/ttf2bdf.man Normal file
View File

@@ -0,0 +1,196 @@
.\"
.\" $Id: ttf2bdf.man,v 1.14 1999/10/21 16:31:54 mleisher Exp $
.\"
.TH TTF2BDF 1 "21 October 1999" "X Version 11"
.SH NAME
ttf2bdf \- TrueType to BDF font converter
.SH SYNOPSIS
.B ttf2bdf
[\fIoptions\fP] [\fIfont.ttf\fP]
.SH DESCRIPTION
.I ttf2bdf
will convert a TrueType font to a BDF font using the FreeType renderer.
.SH OPTIONS
.I ttf2bdf
accepts the following command line arguments:
.PP
.TP 8
.I -v
print warning messages when the font is converted.
.PP
.TP 8
.I -p n
set the desired point size (see default value by running the program with the
-h option).
.PP
.TP 8
.I -r n
set both the horizontal and the vertical resolution (see default value by
running the program with the -h option). The minimum is 10dpi and the maximum
is 1200dpi.
.PP
.TP 8
.I -rh n
set the horizontal resolution (see default value by running the program with
the -h option). The minimum is 10dpi and the maximum is 1200dpi.
.PP
.TP 8
.I -rv n
set the vertical resolution (see default value by running the program with
the -h option). The minimum is 10dpi and the maximum is 1200dpi.
.PP
.TP 8
.I -o outfile
sets the output filename (default output is to stdout).
.PP
.TP 8
.I -pid id
set the platform id for selecting the character map (see default value by
running the program with the -h option).
.PP
.TP 8
.I -eid id
set the encoding id for selecting the character map (see default value by
running the program with the -h option).
.PP
.TP 8
.I -c c
set the character spacing. This should be one of `P' for proportional,
`M' for monospace, or `C' for character cell. By default, the spacing
of a font will be automatically determined to be either `M' or `P'
according to values provided in the font.
.PP
.TP 8
.I -f name
set the foundry name used in the XLFD name. The default value is
`Freetype'.
.PP
.TP 8
.I -t name
set the typeface name used in the XLFD name. By default,
.I ttf2bdf
will attempt to get a name from the font first and then it will use the
name supplied with this command line option, and if all else fails, it
will use the name `Unknown'.
.PP
.TP 8
.I -w name
set the weight name used in the XLFD name. If this value is not
supplied, the default value is assumed to be `Medium'. Some common
values for this are `Thin', `Delicate', `ExtraLight', `Light', `Normal',
`Medium', `SemiCondensed', `Condensed', `SemiBold', `Bold', `Heavy',
`ExtraBold', and `ExtraHeavy'.
.PP
.TP 8
.I -s name
set the slant name used in the XLFD name. If this value is not
supplied, the default value is assumed to be `R', for Roman. Some common
values for this are `R' for Roman, `I' for Italic, `O' for Oblique, `RI'
for Reverse Italic, and `RO' for Reverse Oblique.
.PP
.TP 8
.I -k name
set the width name used in the XLFD name. The default is `Normal'.
.PP
.TP 8
.I -d name
set the additional style name used in the XLFD name. The default is an empty
string.
.PP
.TP 8
.I -u char
set the character used to replace the dashes/spaces in a font name. The
default is the space character.
.PP
.TP 8
.I -l subset
define a list of character codes which will be used to select a subset
of glyphs from the font. The syntax of the subset string is the same
as the syntax for selecting subsets in X11 XLFD font names. Example:
.sp
% ttf2bdf -l '60 70 80_90' font.ttf -o font.bdf
.sp
The command above will only generate the glyphs for codes 60, 70, and 80
through 90 inclusive. Glyphs that are not in the subset are not
generated.
.PP
.TP 8
.I -m mapfile
specifies a mapping file which will reencode the BDF font when it is
generated. Any glyphs with codes that do not have a mapping will not
be generated.
.sp
The remapping file should begin with two lines, one which starts with
REGISTRY followed by the character set registry and one which starts
with ENCODING followed by the encoding. An example from the
iso8859.2 file:
.sp
REGISTRY ISO8859
.br
ENCODING 2
.sp
The remapping data should be two columns of hexadecimal numbers, separated by
spaces or tabs. The first column should have the code which should be used in
the BDF font. The second column should be the hexadecimal code of the glyph
in the "cmap" table ttf2bdf is using. An example mapping file is provided
which will map fonts from Unicode (the default "cmap" table) to ISO8859-2.
.sp
Unicode is not the only option. If you choose another platform and
encoding ID on the command line, then the remapping is assumed to map
from the chosen platform and encoding to some other character set.
.SH "SEE ALSO"
xmbdfed(1), xfed(1), bdftopcf(1), bdftosnf(1)
.br
\fIGlyph Bitmap Distribution Format (BDF) Specification\fP, Application
Note 5005, Adobe System Inc, 1993
.br
\fIX Logical Font Description Conventions\fP, X Consortium
.SH ACKNOWLEDGMENTS
The FreeType project for providing the renderer!
.br
Robert Wilhelm <robert@physiol.med.tu-muenchen.de> for pointing out a
crucial problem with the pre-1.0 code.
.br
Lho Li-Da <ollie@ms1.hinet.net> for problem reports.
.br
Adrian Havill <havill@threeweb.ad.jp> for unintentionally pointing out a
missing feature.
.br
Richard Verhoeven <rcb5@win.tue.nl> for problem reports and patches.
.br
Choi Jun Ho <junker@jazz.snu.ac.kr> whose implementation provided some
nice new features.
.br
Pavel Kankovsky <peak@kerberos.troja.mff.cuni.cz> for providing some
critical metrics fixes and other improvements.
.br
Matti Koskinen <mjkoskin@sci.fi> for pointing out a problem.
.br
Eugene Bobin <gene@ftim.ustu.ru> for mapping tables and shell scripts.
.br
Oleg N. Yakovlev <yashka@optima.dnepropetrovsk.ua> for pointing out a problem.
.br
Bertrand Petit <elrond@phoe.frmug.org> for additional functionality.
.br
Roman Czyborra <czyborra@cs.tu-berlin.de> for pointing out some problems.
.br
Mike Blazer <blazer@mail.nevalink.ru> for some Window's compilation advice.
.br
Solofo Ramangalahy <solofo@mpi-sb.mpg.de> for contributing some mapping
tables.
Antoine Leca <Antoine.Leca@renault.fr> for mapping table suggestions.
.SH AUTHOR
Mark Leisher
.br
Computing Research Lab
.br
New Mexico State University
.br
Email: mleisher@crl.nmsu.edu

View File

@@ -0,0 +1,3 @@
t1asm
ttf2pfb
Makefile

View File

@@ -0,0 +1,16 @@
# Makefile for ttf2pfb and t1asm
all: ttf2pfb.exe t1asm.exe
ttf2pfb.exe: ttf2pfb.o
gcc -O -o ttf2pfb.exe ttf2pfb.o -lttf
ttf2pfb.o: ttf2pfb.c
gcc -O -c ttf2pfb.c
t1asm.exe: t1asm.o
gcc -O -o t1asm.exe t1asm.o -lttf
t1asm.o: t1asm.c
gcc -O -c t1asm.c

View File

@@ -0,0 +1,74 @@
# Makefile for ttf2pfb
#
# This Makefile assumes that you've already built and installed
# the FreeType library.
VPATH = @srcdir@
srcdir = @srcdir@
RM = @RM@
RMF = @RM@ -f
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
CC = @CC@
CPP = @CPP@
LIBTOOL = ../../libtool
MKINSTALLDIRS = $(srcdir)/../../mkinstalldirs
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
CFLAGS = @CFLAGS@ @XX_CFLAGS@
CPPFLAGS = @CPPFLAGS@ @DEFS@
FT_CFLAGS = $(CFLAGS) $(CPPFLAGS)
LDFLAGS = @LDFLAGS@ @LIBS@
LIBDIR = ../../lib
SRC = t1asm.c ttf2pfb.c
PROGRAMS = t1asm ttf2pfb
default all: $(PROGRAMS)
t1asm: t1asm.c
$(CC) $(CFLAGS) -o $@ $<
ttf2pfb: ttf2pfb.o $(LIBDIR)/libttf.la
$(LIBTOOL) --mode=link $(CC) $(FT_CFLAGS) -o $@ $< \
$(LIBDIR)/libttf.la $(LDFLAGS)
clean:
$(RMF) *.o *BAK *CKP *~ a.out core
realclean: clean
$(RMF) $(PROGRAMS)
$(RM) -rf .libs/
distclean: realclean
$(RMF) *~ *.orig core *.core
$(RMF) config.cache config.log config.status Makefile
.c.o:
$(CC) -c $(FT_CFLAGS) $<
install: $(PROGRAMS)
$(MKINSTALLDIRS) $(bindir)
for P in $(PROGRAMS) ; do \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$P $(bindir)/$$P ; \
done
$(INSTALL_PROGRAM) $(srcdir)/getafm $(bindir)/getafm
uninstall:
-for P in $(PROGRAMS) ; do \
$(LIBTOOL) --mode=uninstall $(RM) $(bindir)/$$P ; \
done
.PHONY: all clean realclean distclean install uninstall
# end of Makefile

40
contrib/ttf2pfb/TODO Normal file
View File

@@ -0,0 +1,40 @@
ttf2pfb is oriented towards support for CJK fonts containing several
thousand glyphs to be splitted into subfonts with 256 characters each usable
by TeX. Nevertheless, it is quite generic and works with normal ttf files
too.
Some features are still missing or should be added for convenience:
. Documentation. ttf2pbf explains itself; t1asm is a filter which converts
the (disassembled) pseudo font created by ttf2pfb into a real PFA font
(or PFB if you use the `-b' command line switch).
Example for an ordinary font:
ttf2pfb -v -m -enc Uni-T1.enc -f FooBar -o foobar.ps foobar.ttf
t1asm -b < foobar.ps > foobar.pfb
printafm foobar.pfb > foobar.afm
afm2tfm foobar.afm
Example for a CJK font in Big 5 encoding to be used with the CJK package
for LaTeX (note that the call creates just the first subfont):
ttf2pfb -c -pid 3 -eid 4 -plane 1 -f FooBar01 -o foobar01.ps foobar.ttf
t1asm -b < foobar01.ps > foobar01.pfb
printafm foobar01.pfb > foobar01.afm
afm2tfm foobar01.afm
. Inclusion of t1asm and t1binary into ttf2pfb so that ttf2pfb can directly
produce PFA and PFB files.
. Overlapping outlines produce incorrect shapes: The overlapping areas
appear white instead of black.
. A more flexible encoding file format (maybe similar to ttf2tfm) which can
handle glyph names.
. [t1asm has been slightly patched to allow partial font downloading with
dvips.]
. Note that compiling ttf2pfb with `-O2' doesn't work, most probably due to
a compiler bug (we've tested with gcc 2.7.2.1 and 2.7.2.3).

397
contrib/ttf2pfb/Uni-T1.enc Normal file
View File

@@ -0,0 +1,397 @@
#
# This file is a hack to provide some mapping for standard (non-CJK)
# TrueType fonts. It is intended as an intermediate step towards a
# `correct' implementation as in ttf2tfm.
#
# Here, we have Unicode to LaTeX's T1 encoding. An example call would be
#
# ttf2pfb -m -enc Uni-T1.enc ...
#
# Glyph names which can't be represented in Unicode have the character code
# 0xfffe.
# 0x00
0x00:
0x60 # /grave
0xb4 # /acute
0x02:
0xc6 # /circumflex
0xdc # /tilde
0x00:
0xa8 # /dieresis
0x02:
0xdd # /hungarumlaut
0xda # /ring
0xc7 # /caron
0xd8 # /breve
0xc9 # /macron
0xd9 # /dotaccent
0x00:
0xb8 # /cedilla
0x02:
0xdb # /ogonek
0x20:
0x1a # /quotesinglbase
0x39 # /guilsinglleft
0x3a # /guilsinglright
# 0x10
0x1c # /quotedblleft
0x1d # /quotedblright
0x1e # /quotedblbase
0x00:
0xab # /guillemotleft
0xbb # /guillemotright
0x20:
0x13 # /endash
0x14 # /emdash
0xff:
0xfe # /compwordmark
0xfe # /perthousandzero
0x01:
0x31 # /dotlessi
0xff:
0xfe # /dotlessj
0xfe # /ff
0xf0:
0x01 # /fi
0x02 # /fl
0xff:
0xfe # /ffi
0xfe # /ffl
# 0x20
0xfe # /visualspace
0x00:
0x21 # /exclam
0x22 # /quotedbl
0x23 # /numbersign
0x24 # /dollar
0x25 # /percent
0x26 # /ampersand
0x20:
0x19 # /quoteright
0x00:
0x28 # /parenleft
0x29 # /parenright
0x2a # /asterisk
0x2b # /plus
0x2c # /comma
0x2d # /hyphen
0x2e # /period
0x2f # /slash
# 0x30
0x30 # /zero
0x31 # /one
0x32 # /two
0x33 # /three
0x34 # /four
0x35 # /five
0x36 # /six
0x37 # /seven
0x38 # /eight
0x39 # /nine
0x3a # /colon
0x3b # /semicolon
0x3c # /less
0x3d # /equal
0x3e # /greater
0x3f # /question
# 0x40
0x40 # /at
0x41 # /A
0x42 # /B
0x43 # /C
0x44 # /D
0x45 # /E
0x46 # /F
0x47 # /G
0x48 # /H
0x49 # /I
0x4a # /J
0x4b # /K
0x4c # /L
0x4d # /M
0x4e # /N
0x4f # /O
# 0x50
0x50 # /P
0x51 # /Q
0x52 # /R
0x53 # /S
0x54 # /T
0x55 # /U
0x56 # /V
0x57 # /W
0x58 # /X
0x59 # /Y
0x5a # /Z
0x5b # /bracketleft
0x5c # /backslash
0x5d # /bracketright
0x5e # /asciicircum
0x5f # /underscore
# 0x60
0x20:
0x18 # /quoteleft
0x00:
0x61 # /a
0x62 # /b
0x63 # /c
0x64 # /d
0x65 # /e
0x66 # /f
0x67 # /g
0x68 # /h
0x69 # /i
0x6a # /j
0x6b # /k
0x6c # /l
0x6d # /m
0x6e # /n
0x6f # /o
# 0x70
0x70 # /p
0x71 # /q
0x72 # /r
0x73 # /s
0x74 # /t
0x75 # /u
0x76 # /v
0x77 # /w
0x78 # /x
0x79 # /y
0x7a # /z
0x7b # /braceleft
0x7c # /bar
0x7d # /braceright
0x7e # /asciitilde
0x2d # /hyphen
# 0x80
0x01:
0x02 # /Abreve
0x04 # /Aogonek
0x06 # /Cacute
0x0c # /Ccaron
0x0e # /Dcaron
0x1a # /Ecaron
0x18 # /Eogonek
0x1e # /Gbreve
0x39 # /Lacute
0x3d # /Lcaron
0x41 # /Lslash
0x43 # /Nacute
0x47 # /Ncaron
0x4a # /Eng
0x50 # /Odblacute
0x54 # /Racute
# 0x90
0x58 # /Rcaron
0x5a # /Sacute
0x60 # /Scaron
0x5e # /Scedilla
0x64 # /Tcaron
0x62 # /Tcedilla
0x70 # /Udblacute
0x6e # /Uring
0x78 # /Ydieresis
0x79 # /Zacute
0x7d # /Zcaron
0x7b # /Zdot
0x32 # /IJ
0x30 # /Idot
0x11 # /dmacron
0x00:
0xa7 # /section
# 0xA0
0x01:
0x03 # /abreve
0x05 # /aogonek
0x07 # /cacute
0x0d # /ccaron
0x0f # /dcaron
0x1b # /ecaron
0x19 # /eogonek
0x1f # /gbreve
0x3a # /lacute
0x3e # /lcaron
0x42 # /lslash
0x44 # /nacute
0x48 # /ncaron
0x4b # /eng
0x51 # /odblacute
0x55 # /racute
# 0xB0
0x59 # /rcaron
0x5b # /sacute
0x61 # /scaron
0x5f # /scedilla
0x65 # /tcaron
0x63 # /tcedilla
0x71 # /udblacute
0x6f # /uring
0x00:
0xff # /ydieresis
0x01:
0x7a # /zacute
0x7e # /zcaron
0x7c # /zdot
0x33 # /ij
0x00:
0xa1 # /exclamdown
0xbf # /questiondown
0xa3 # /sterling
# 0xC0
0xc0 # /Agrave
0xc1 # /Aacute
0xc2 # /Acircumflex
0xc3 # /Atilde
0xc4 # /Adieresis
0xc5 # /Aring
0xc6 # /AE
0xc7 # /Ccedilla
0xc8 # /Egrave
0xc9 # /Eacute
0xca # /Ecircumflex
0xcb # /Edieresis
0xcc # /Igrave
0xcd # /Iacute
0xce # /Icircumflex
0xcf # /Idieresis
# 0xD0
0xd0 # /Eth
0xd1 # /Ntilde
0xd2 # /Ograve
0xd3 # /Oacute
0xd4 # /Ocircumflex
0xd5 # /Otilde
0xd6 # /Odieresis
0x01:
0x52 # /OE
0x00:
0xd8 # /Oslash
0xd9 # /Ugrave
0xda # /Uacute
0xdb # /Ucircumflex
0xdc # /Udieresis
0xdd # /Yacute
0xde # /Thorn
0xff:
0xfe # /Germandbls
# 0xE0
0x00:
0xe0 # /agrave
0xe1 # /aacute
0xe2 # /acircumflex
0xe3 # /atilde
0xe4 # /adieresis
0xe5 # /aring
0xe6 # /ae
0xe7 # /ccedilla
0xe8 # /egrave
0xe9 # /eacute
0xea # /ecircumflex
0xeb # /edieresis
0xec # /igrave
0xed # /iacute
0xee # /icircumflex
0xef # /idieresis
# 0xF0
0xf0 # /eth
0xf1 # /ntilde
0xf2 # /ograve
0xf3 # /oacute
0xf4 # /ocircumflex
0xf5 # /otilde
0xf6 # /odieresis
0x01:
0x53 # /oe
0x00:
0xf8 # /oslash
0xf9 # /ugrave
0xfa # /uacute
0xfb # /ucircumflex
0xfc # /udieresis
0xfd # /yacute
0xfe # /thorn
0xdf # /germandbls
#eof

1553
contrib/ttf2pfb/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(../../lib/freetype.h)
AC_CANONICAL_SYSTEM
AC_PROG_CC
AC_PROG_CPP
CFLAGS="-g -O -DDEBUG"
OLDLIBS=$LIBS
LIBS="$LIBS -L../../lib/.libs"
CPPFLAGS="-I$srcdir/../../lib $CPPFLAGS"
AC_CHECK_LIB(ttf, TT_Init_FreeType, LIBS="$LIBS -lttf",[
AC_MSG_ERROR([Can't find ttf library! Compile FreeType first.])])
LIBS=$OLDLIBS
dnl get Compiler flags right.
if test "x$CC" = xgcc; then
XX_CFLAGS="-Wall -ansi -pedantic"
else
case "$host" in
alpha-dec-osf*)
XX_CFLAGS="-std1 -O2 -g3"
;;
*)
XX_CFLAGS=
;;
esac
fi
AC_SUBST(XX_CFLAGS)
AC_CHECK_PROG(RM, rm, rm)
AC_PROG_INSTALL
AC_STRUCT_TM
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
AC_OUTPUT(Makefile)
dnl end of configure.in

364
contrib/ttf2pfb/getafm Normal file
View File

@@ -0,0 +1,364 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: $0 font-name | gsnd -q - >font-name.afm" >&2
exit 1
fi
cat << EOF
%!
% produce .afm for $1
% (c) 1993 by Robert Joop <rj@rainbow.in-berlin.de>
% inspired by two other versions of this theme which are
% getafm 1.00 (c) AJCD
% and getafm.ps by an unknown author,
% modified by J. Daniel Smith <dsmith@mailhost.aa.cad.slb.com>
%
% modified by Joachim H. Kaiser <jhk@cmpnetmail.com>:
% - suggest a quiet gs run in usage
% - get font version info (from 'version', not 'Version')
% - add copyright field to output
% Metrics dictionary code added by AJCD, 7/6/93
/getafmdict 100 dict dup begin
/buf 256 string def
/buf2 16 string def
/prany % dict dictname printname -> dict
{
2 index 2 index cvn known
{
print % printname
( ) print
1 index exch cvn get =
}
{
(Comment /FontInfo contains no /) print
2 copy eq
{
= % printname
pop % dictname
}
{
exch
print % dictname
(, therefore no ) print
= % printname
}
ifelse
}
ifelse
}
bind def
/printfontname
{
(FontName)dup prany
}
bind def
/printfontinfo
{
dup /FontInfo known
{
dup /FontInfo get
(FullName)dup prany
(FamilyName)dup prany
(Weight)dup prany
(ItalicAngle)dup prany
(isFixedPitch)(IsFixedPitch) prany
(UnderlinePosition)dup prany
(UnderlineThickness)dup prany
(version)(Version) prany
(Notice)dup prany
(Copyright)dup prany
pop
}
{
(Comment Font lacks a /FontInfo!)=
}
ifelse
}
bind def
/prbbox % llx lly urx ury -> -
{
4 1 roll 3 1 roll exch % swap top 4 elements
4 { ( ) print buf cvs print } repeat
}
bind def
/getbbox % fontdict chardict character -> fontdict chardict llx lly urx ury
{
gsave
2 index setfont 0 0 moveto
false charpath flattenpath pathbbox
grestore
}
bind def
/printmiscinfo
{
dup /FontBBox known
{
(FontBBox) print
dup /FontBBox get aload pop prbbox ()=
}
{
(Comment missing required /FontBBox)=
quit
}
ifelse
2 copy exch get
dup /H known
1 index /x known and
1 index /d known and
1 index /p known and
dup /looksRoman exch def
{
(CapHeight ) print
(H) getbbox
ceiling cvi = pop pop pop
(XHeight ) print
(x) getbbox
ceiling cvi = pop pop pop
(Ascender ) print
(d) getbbox
ceiling cvi = pop pop pop
(Descender ) print
(p) getbbox
pop pop floor cvi = pop
}
{
(Comment font doesn't contain H, x, d and p; therefore no CapHeight, XHeight, Ascender and Descender)=
}
ifelse
pop
dup /Encoding get
[
[ (ISOLatin1Encoding) /ISOLatin1Encoding ]
[ (AdobeStandardEncoding) /StandardEncoding ]
]
{
aload pop dup where
{
exch get 2 index eq
{
(EncodingScheme ) print
buf cvs =
}
{
pop
}
ifelse
}
{
pop pop
}
ifelse
}
forall
pop
}
bind def
/printcharmetric
{
% chardictname fontdict charnamedict encoding charindex charname
4 index dup length dict dup begin exch
{
1 index /FID ne
2 index /UniqueID ne
and
{
1 index /Encoding eq { 256 array copy } if
def
}
{ pop pop }
ifelse
}
forall
end
dup /Encoding get 32 3 index put
/f2 exch definefont
setfont
(C ) print
1 index buf cvs print
( ; WX ) print
% Metrics entries are:
% 1 number: which is the character width
% an array of 2 numbers: which are the left sidebearing and width
% an array of 4 numbers: x & y left sidebearing, width and height
dup 5 index % /charname fontdict
dup /Metrics known {
/Metrics get exch 2 copy known {
get dup type /arraytype eq {
dup length 2 eq
{1 get} {2 get} ifelse
} if
round cvi buf cvs print
} {
pop pop ( ) stringwidth pop round cvi buf cvs print
} ifelse
} {
pop pop ( ) stringwidth pop round cvi buf cvs print
} ifelse
( ; N ) print
dup buf cvs print
( ; B) print
gsave
newpath 0 0 moveto
( ) true charpath flattenpath pathbbox
grestore
2 { ceiling cvi 4 1 roll } repeat
2 { floor cvi 4 1 roll } repeat
prbbox
looksRoman
{
[
[ /f [ /i /f /l ] ]
[ /ff [ /i /l ] ]
]
{
aload pop 1 index 3 index eq
{
{
1 index buf cvs
length
1 index buf2 cvs dup length
2 index add
buf
4 2 roll putinterval
buf 0
3 -1 roll getinterval
dup cvn
7 index
exch known
{
exch
( ; L ) print
buf2 cvs print
( ) print
print
}
{
pop pop
}
ifelse
}
forall
pop
}
{
pop pop
}
ifelse
}
forall
}
if
pop
( ;)=
}
bind def
/printcharmetrics
{
(StartCharMetrics ) print
2 copy exch get length 1 sub buf cvs =
256 dict dup begin
1 index /Encoding get
{ null def }
forall
end
% chardictname fontdict charnamedict
1 index /Encoding get
0 1 255
{
% encoding index
2 copy get
dup /.notdef eq { pop } { printcharmetric } ifelse
pop % index
} for
-1
3 index 5 index get
{
pop
dup /.notdef eq
{ pop }
{
% chardictname fontdict charnamedict encoding charindex charname
dup 4 index exch known
{ pop }
{ printcharmetric }
ifelse
}
ifelse
}
forall
% charnamedict encoding index
pop pop pop
(EndCharMetrics)=
}
bind def
/printfontmetrics
{
(StartFontMetrics 3.0)=
(Comment Produced by getafm 3.0 (which is by rj@rainbow.in-berlin.de))=
printfontname
printfontinfo
printmiscinfo
printcharmetrics
(EndFontMetrics)=
}
bind def
end def
/getafm
{
getafmdict begin
save exch
findfont 1000 scalefont
null
[ /CharDefs /CharData /CharProcs /CharStrings ]
{
2 index 1 index known { exch } if
pop
}
forall
dup null eq
{
(can't find dictionary with character data!)=
quit
}
if
exch % dictname fontdict
printfontmetrics
pop pop
restore
end
}
bind def
/$1 getafm
EOF

529
contrib/ttf2pfb/t1asm.c Normal file
View File

@@ -0,0 +1,529 @@
/* t1asm
**
** This program `assembles' Adobe Type-1 font programs in pseudo-PostScript
** form into either PFB or PFA format. The human readable/editable input is
** charstring- and eexec-encrypted as specified in the `Adobe Type 1 Font
** Format' version 1.1 (the `black book'). There is a companion program,
** t1disasm, which `disassembles' PFB and PFA files into a pseudo-PostScript
** file.
**
** Copyright (c) 1992 by I. Lee Hetherington, all rights reserved.
**
** Permission is hereby granted to use, modify, and distribute this program
** for any purpose provided this copyright notice and the one below remain
** intact.
**
** author: I. Lee Hetherington (ilh@lcs.mit.edu)
*/
#ifndef lint
static char sccsid[] =
"@(#) t1asm.c 1.2 10:09:46 5/22/92";
static char copyright[] =
"@(#) Copyright (c) 1992 by I. Lee Hetherington, all rights reserved.";
#endif
/* Note: this is ANSI C. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef MSDOS
#define WB "wb"
#else
#define WB "w"
#endif
#define BANNER "This is t1asm 1.2.\n"
#define LINESIZE 256
#define MAXBLOCKLEN ((1<<17)-6)
#define MINBLOCKLEN ((1<<8)-6)
#define MARKER 128
#define ASCII 1
#define BINARY 2
#define DONE 3
typedef unsigned char byte;
static FILE *ifp = stdin;
static FILE *ofp = stdout;
/* flags */
static int pfb = 0;
static int active = 0;
static int start_charstring = 0;
static int in_eexec = 0;
static char line[LINESIZE + 1];
/* lenIV and charstring start command */
static int lenIV = 4;
static char cs_start[10];
/* for charstring buffering */
static byte charstring_buf[65535];
static byte *charstring_bp;
/* for PFB block buffering */
static byte blockbuf[MAXBLOCKLEN];
static int blocklen = MAXBLOCKLEN;
static int blockpos = -1;
static int blocktyp = ASCII;
/* decryption stuff */
static unsigned short er, cr;
static unsigned short c1 = 52845, c2 = 22719;
/* table of charstring commands */
static struct command {
char *name;
int one, two;
} command_table[] = {
{ "callothersubr", 12, 16 },
{ "callsubr", 10, -1 },
{ "closepath", 9, -1 },
{ "div", 12, 12 },
{ "dotsection", 12, 0 },
{ "endchar", 14, -1 },
{ "escape", 12, -1 },
{ "hlineto", 6, -1 },
{ "hmoveto", 22, -1 },
{ "hsbw", 13, -1 },
{ "hstem", 1, -1 },
{ "hstem3", 12, 2 },
{ "hvcurveto", 31, -1 },
{ "pop", 12, 17 },
{ "return", 11, -1 },
{ "rlineto", 5, -1 },
{ "rmoveto", 21, -1 },
{ "rrcurveto", 8, -1 },
{ "sbw", 12, 7 },
{ "seac", 12, 6 },
{ "setcurrentpoint", 12, 33 },
{ "vhcurveto", 30, -1 },
{ "vlineto", 7, -1 },
{ "vmoveto", 4, -1 },
{ "vstem", 3, -1 },
{ "vstem3", 12, 1 },
}; /* alphabetical */
/* Two separate decryption functions because eexec and charstring decryption
must proceed in parallel. */
static byte eencrypt(byte plain)
{
byte cipher;
cipher = (plain ^ (er >> 8));
er = (cipher + er) * c1 + c2;
return cipher;
}
static byte cencrypt(byte plain)
{
byte cipher;
cipher = (plain ^ (cr >> 8));
cr = (cipher + cr) * c1 + c2;
return cipher;
}
/* This function flushes a buffered PFB block. */
static void output_block()
{
int i;
/* output four-byte block length */
fputc(blockpos & 0xff, ofp);
fputc((blockpos >> 8) & 0xff, ofp);
fputc((blockpos >> 16) & 0xff, ofp);
fputc((blockpos >> 24) & 0xff, ofp);
/* output block data */
for (i = 0; i < blockpos; i++)
fputc(blockbuf[i], ofp);
/* mark block buffer empty and uninitialized */
blockpos = -1;
}
/* This function outputs a single byte. If output is in PFB format then output
is buffered through blockbuf[]. If output is in PFA format, then output
will be hexadecimal if in_eexec is set, ASCII otherwise. */
static void output_byte(byte b)
{
static char *hexchar = "0123456789ABCDEF";
static int hexcol = 0;
if (pfb) {
/* PFB */
if (blockpos < 0) {
fputc(MARKER, ofp);
fputc(blocktyp, ofp);
blockpos = 0;
}
blockbuf[blockpos++] = b;
if (blockpos == blocklen)
output_block();
} else {
/* PFA */
if (in_eexec) {
/* trim hexadecimal lines to 64 columns */
if (hexcol >= 64) {
fputc('\n', ofp);
hexcol = 0;
}
fputc(hexchar[(b >> 4) & 0xf], ofp);
fputc(hexchar[b & 0xf], ofp);
hexcol += 2;
} else {
fputc(b, ofp);
}
}
}
/* This function outputs a byte through possible eexec encryption. */
static void eexec_byte(byte b)
{
if (in_eexec)
output_byte(eencrypt(b));
else
output_byte(b);
}
/* This function outputs a null-terminated string through possible eexec
encryption. */
static void eexec_string(char *string)
{
while (*string)
eexec_byte((byte) *string++);
}
/* This function gets ready for the eexec-encrypted data. If output is in
PFB format then flush current ASCII block and get ready for binary block.
We start encryption with four random (zero) bytes. */
static void eexec_start()
{
eexec_string(line);
if (pfb) {
output_block();
blocktyp = BINARY;
}
in_eexec = 1;
er = 55665;
eexec_byte(0);
eexec_byte(0);
eexec_byte(0);
eexec_byte(0);
}
/* This function wraps-up the eexec-encrypted data and writes ASCII trailer.
If output is in PFB format then this entails flushing binary block and
starting an ASCII block. */
static void eexec_end()
{
int i, j;
if (pfb) {
output_block();
blocktyp = ASCII;
} else {
fputc('\n', ofp);
}
in_eexec = 0;
for (i = 0; i < 7; i++) {
for (j = 0; j < 64; j++)
eexec_byte('0');
eexec_byte('\n');
}
eexec_string("cleartomark\n");
if (pfb) {
output_block();
fputc(MARKER, ofp);
fputc(DONE, ofp);
}
}
/* This function returns an input line of characters. A line is terminated by
length (including terminating null) greater than LINESIZE, a newline \n, or
when active (looking for charstrings) by '{'. When terminated by a newline
the newline is put into line[]. When terminated by '{', the '{' is not put
into line[], and the flag start_charstring is set to 1. */
static void getline()
{
int c;
char *p = line;
int comment = 0;
start_charstring = 0;
while (p < line + LINESIZE) {
c = fgetc(ifp);
if (c == EOF)
break;
if (c == '%')
comment = 1;
if (active && !comment && c == '{') {
start_charstring = 1;
break;
}
*p++ = (char) c;
if (c == '\n')
break;
}
*p = '\0';
}
/* This function is used by the binary search, bsearch(), for command names in
the command table. */
static int command_compare(const void *key, const void *item)
{
return strcmp((char *) key, ((struct command *) item)->name);
}
/* This function returns 1 if the string is an integer and 0 otherwise. */
static int is_integer(char *string)
{
if (isdigit(string[0]) || string[0] == '-' || string[0] == '+') {
while (*++string && isdigit(*string))
; /* deliberately empty */
if (!*string)
return 1;
}
return 0;
}
/* This function initializes charstring encryption. Note that this is called
at the beginning of every charstring. */
static void charstring_start()
{
int i;
charstring_bp = charstring_buf;
cr = 4330;
for (i = 0; i < lenIV; i++)
*charstring_bp++ = cencrypt((byte) 0);
}
/* This function encrypts and buffers a single byte of charstring data. */
static void charstring_byte(v)
int v;
{
byte b = ((unsigned int)v) & 0xff;
if (charstring_bp - charstring_buf > sizeof(charstring_buf)) {
fprintf(stderr, "error: charstring_buf full (%d bytes)\n",
sizeof(charstring_buf));
exit(1);
}
*charstring_bp++ = cencrypt(b);
}
/* This function outputs buffered, encrypted charstring data through possible
eexec encryption. */
static void charstring_end()
{
byte *bp;
sprintf(line, "%d %s ", charstring_bp - charstring_buf, cs_start);
eexec_string(line);
for (bp = charstring_buf; bp < charstring_bp; bp++)
eexec_byte(*bp);
}
/* This function generates the charstring representation of an integer. */
static void charstring_int(int num)
{
int x;
if (num >= -107 && num <= 107) {
charstring_byte(num + 139);
} else if (num >= 108 && num <= 1131) {
x = num - 108;
charstring_byte(x / 256 + 247);
charstring_byte(x % 256);
} else if (num >= -1131 && num <= -108) {
x = abs(num) - 108;
charstring_byte(x / 256 + 251);
charstring_byte(x % 256);
} else if (num >= (-2147483647-1) && num <= 2147483647) {
charstring_byte(255);
charstring_byte(num >> 24);
charstring_byte(num >> 16);
charstring_byte(num >> 8);
charstring_byte(num);
} else {
fprintf(stderr,
"error: cannot format the integer %d, too large\n", num);
exit(1);
}
}
/* This function parses an entire charstring into integers and commands,
outputting bytes through the charstring buffer. */
static void parse_charstring()
{
struct command *cp;
charstring_start();
while (fscanf(ifp, "%s", line) == 1) {
if (line[0] == '%') {
/* eat comment to end of line */
while (fgetc(ifp) != '\n' && !feof(ifp))
; /* deliberately empty */
continue;
}
if (line[0] == '}')
break;
if (is_integer(line)) {
charstring_int(atoi(line));
} else {
cp = (struct command *)
bsearch((void *) line, (void *) command_table,
sizeof(command_table) / sizeof(struct command),
sizeof(struct command),
command_compare);
if (cp) {
charstring_byte(cp->one);
if (cp->two >= 0)
charstring_byte(cp->two);
} else {
fprintf(stderr, "error: cannot use `%s' in charstring\n", cp->name);
exit(1);
}
}
}
charstring_end();
}
static void usage()
{
fprintf(stderr,
"usage: t1asm [-b] [-l block-length] [input [output]]\n");
fprintf(stderr,
"\n-b means output in PFB format, otherwise PFA format.\n");
fprintf(stderr,
"The block length applies to the length of blocks in the\n");
fprintf(stderr,
"PFB output file; the default is to use the largest possible.\n");
exit(1);
}
int main(int argc, char **argv)
{
char *p, *q, *r;
int c;
extern char *optarg;
extern int optind;
extern int getopt(int argc, char **argv, char *optstring);
fprintf(stderr, "%s", BANNER);
/* interpret command line arguments using getopt */
while ((c = getopt(argc, argv, "bl:")) != -1)
switch (c) {
case 'b':
pfb = 1;
break;
case 'l':
blocklen = atoi(optarg);
if (blocklen < MINBLOCKLEN) {
blocklen = MINBLOCKLEN;
fprintf(stderr,
"warning: using minimum block length of %d\n",
blocklen);
} else if (blocklen > MAXBLOCKLEN) {
blocklen = MAXBLOCKLEN;
fprintf(stderr,
"warning: using maximum block length of %d\n",
blocklen);
}
break;
default:
usage();
break;
}
if (argc - optind > 2)
usage();
/* possibly open input & output files */
if (argc - optind >= 1) {
ifp = fopen(argv[optind], "r");
if (!ifp) {
fprintf(stderr, "error: cannot open %s for reading\n", argv[1]);
exit(1);
}
}
if (argc - optind >= 2) {
ofp = fopen(argv[optind + 1], WB);
if (!ofp) {
fprintf(stderr, "error: cannot open %s for writing\n", argv[2]);
exit(1);
}
}
/* Finally, we loop until no more input. Some special things to look for
are the `currentfile eexec' line, the beginning of the `/Subrs'
definition, the definition of `/lenIV', and the definition of the
charstring start command which has `...string currentfile...' in it. */
while (!feof(ifp) && !ferror(ifp)) {
getline();
if (strcmp(line, "currentfile eexec\n") == 0) {
eexec_start();
continue;
} else if (strstr(line, "/Subrs") && isspace(line[6])) {
active = 1;
} else if ((p = strstr(line, "/lenIV"))) {
sscanf(p, "%*s %d", &lenIV);
} else if ((p = strstr(line, "string currentfile"))) {
/* locate the name of the charstring start command */
*p = '\0'; /* damage line[] */
q = strrchr(line, '/');
if (q) {
r = cs_start;
++q;
while (!isspace(*q) && *q != '{')
*r++ = *q++;
*r = '\0';
}
*p = 's'; /* repair line[] */
}
/* output line data */
eexec_string(line);
if (start_charstring) {
if (!cs_start[0]) {
fprintf(stderr, "error: couldn't find charstring start command\n");
exit(1);
}
parse_charstring();
}
}
eexec_end();
fclose(ifp);
fclose(ofp);
return 0;
}

1725
contrib/ttf2pfb/ttf2pfb.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
ttf2tfm
ttf2pk
.libs
MakeSub
config.status
config.cache
config.log
Makefile

3
contrib/ttf2pk/BUGS Normal file
View File

@@ -0,0 +1,3 @@
Some characters (Arial A) have a bounding box that extends outside the
character width... such a character will get an italic correction.

View File

@@ -0,0 +1,6 @@
# This file is part of the ttf2pk package
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@

View File

@@ -0,0 +1,71 @@
# Makefile for ttf2pk -- loyer@enst.fr, wl@gnu.org
#
# This Makefile assumes that you've already built and installed
# the FreeType library.
#
# It builds the ttf2pk and ttf2tfm for emx-gcc.
#
# You will need dmake.
#
# Use this file while with the following statement:
#
# dmake -r -f Makefile.dm
.IMPORT: COMSPEC
SHELL := $(COMSPEC)
SHELLFLAGS := /c
GROUPSHELL := $(SHELL)
GROUPFLAGS := $(SHELLFLAGS)
GROUPSUFFIX := .bat
SHELLMETAS := *"?<>&|
CC = gcc
LIBDIR = ../../lib
INCDIR = -I$(LIBDIR) -I.
# CFLAGS = -Wall -O2 -g $(INCDIR) -fbounds-checking -DHAVE_EMTEXDIR -DMSDOS
CFLAGS = -Wall -O2 -s $(INCDIR) -DHAVE_EMTEXDIR -DMSDOS
SRC = case.c emdir.c emtexdir.c errormsg.c filesrch.c ligkern.c newobj.c \
parse.c pklib.c subfont.c texenc.c tfmaux.c ttf2pk.c ttf2tfm.c \
ttfaux.c ttfenc.c ttflib.c vplaux.c
ttf2pkobjs = emdir.o emtexdir.o errormsg.o filesrch.o ligkern.o newobj.o \
parse.o pklib.o subfont.o texenc.o ttf2pk.o ttfenc.o ttflib.o
ttf2tfmobjs = case.o emdir.o emtexdir.o errormsg.o filesrch.o ligkern.o \
newobj.o parse.o subfont.o texenc.o tfmaux.o ttf2tfm.o \
ttfaux.o ttfenc.o vplaux.o
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.exe:
$(CC) $(CFLAGS) -o $@ @$(mktmp $(&:t"\n")\n)
PROGRAMS = ttf2pk.exe ttf2tfm.exe
.PHONY: all clean distclean
all: $(PROGRAMS)
ttf2pk.exe: $(ttf2pkobjs) $(LIBDIR)/libttf.a
ttf2tfm.exe: $(ttf2tfmobjs) $(LIBDIR)/libttf.a
clean:
-[
del *.o
]
distclean: clean
-[
del dep.end
del *.exe
del core
]
#end of Makefile.dm

116
contrib/ttf2pk/Makefile.in Normal file
View File

@@ -0,0 +1,116 @@
# Makefile for ttf2pk -- loyer@enst.fr, wl@gnu.org
#
# This Makefile assumes that you've already built and installed
# the FreeType library.
VPATH = @srcdir@
srcdir = @srcdir@
RM = @RM@
RMF = @RM@ -f
RMDIR = @RMDIR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
CC = @CC@
CPP = @CPP@
LIBTOOL = ../../libtool
MKINSTALLDIRS = $(srcdir)/../../mkinstalldirs
include MakeSub
CFLAGS = @CFLAGS@ @XX_CFLAGS@
CPPFLAGS = @CPPFLAGS@ @DEFS@
FT_CFLAGS = $(CFLAGS) $(CPPFLAGS)
LDFLAGS = @LDFLAGS@ @LIBS@
LIBDIR = ../../lib
SRC = $(srcdir)/case.c \
$(srcdir)/errormsg.c \
$(srcdir)/filesrch.c \
$(srcdir)/ligkern.c \
$(srcdir)/newobj.c \
$(srcdir)/parse.c \
$(srcdir)/pklib.c \
$(srcdir)/subfont.c \
$(srcdir)/texenc.c \
$(srcdir)/tfmaux.c \
$(srcdir)/ttf2pk.c \
$(srcdir)/ttf2tfm.c \
$(srcdir)/ttfaux.c \
$(srcdir)/ttfenc.c \
$(srcdir)/ttflib.c \
$(srcdir)/vplaux.c
ttf2pkobjs = errormsg.o filesrch.o ligkern.o newobj.o parse.o pklib.o \
subfont.o texenc.o ttf2pk.o ttfenc.o ttflib.o
ttf2tfmobjs = case.o errormsg.o filesrch.o ligkern.o newobj.o parse.o \
subfont.o texenc.o tfmaux.o ttf2tfm.o ttfaux.o ttfenc.o \
vplaux.o
.c.o:
$(CC) -c $(FT_CFLAGS) $<
PROGRAMS = ttf2pk ttf2tfm
default all: $(PROGRAMS)
ttf2pk: $(ttf2pkobjs) $(LIBDIR)/libttf.la
$(LIBTOOL) --mode=link $(CC) $(FT_CFLAGS) -o ttf2pk $(ttf2pkobjs) \
$(LIBDIR)/libttf.la $(LDFLAGS)
ttf2tfm: $(ttf2tfmobjs) $(LIBDIR)/libttf.la
$(LIBTOOL) --mode=link $(CC) $(FT_CFLAGS) -o ttf2tfm $(ttf2tfmobjs) \
$(LIBDIR)/libttf.la $(LDFLAGS)
install: $(PROGRAMS)
$(MKINSTALLDIRS) $(bindir) $(mandir)/man1
for P in $(PROGRAMS) ; do \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$P $(bindir)/$$P ; \
$(INSTALL_DATA) $(srcdir)/$$P.1 $(mandir)/man1 ; \
done
uninstall:
-for P in $(PROGRAMS) ; do \
$(LIBTOOL) --mode=uninstall $(RM) $(bindir)/$$P ; \
$(RMF) $(mandir)/man1/$$P.1 ; \
done
clean: do_clean
distclean: do_clean
-$(RMF) dep.end $(PROGRAMS)
-$(RMF) *~ *.orig core *.core
-$(RMF) config.cache config.log config.status Makefile MakeSub
-$(RMF) .libs/*
-$(RMDIR) .libs
do_clean:
-$(RMF) *.o
depend:
(echo '/^#.* PUT NO STUFF BELOW/,$$d' ; echo w ; echo q) | \
ed - Makefile
echo '# Dependencies generated by make depend: PUT NO STUFF BELOW' \
>> Makefile
for file in $(SRC) ; do \
$(CPP) $(CPPFLAGS) $$file | \
sed -n -e 's|^# [1-9][0-9]* "\([^/].*\.h\)".*|\1|p' \
-e 's|^# [1-9][0-9]* "\($(srcdir)/.*\.h\)".*|\1|p' | \
sed -e 's|/\./|.|g' -e "s/^/`basename $$file .c`.o: /" ; \
done | \
sort -u | \
awk '{ if (LINE == 1) \
{ line = last = $$1 } \
else if ($$1 != last) \
{ print line ; line = last = $$1 } \
line = line " " $$2 } \
END { print line }' >> Makefile
# Dependencies generated by make depend: PUT NO STUFF BELOW

104
contrib/ttf2pk/README Normal file
View File

@@ -0,0 +1,104 @@
This directory contains ttf2tfm and ttf2pk, two utilities based on
afm2tfm (dvipsk distribution),
gsftopkk (dvipsk distribution),
and the FreeType rasterizer for TrueType fonts.
Compile the FreeType library first! It is recommended to use the kpathsea
library if you want to use the programs with web2c resp. teTeX. Source files
for emTeX-like search routines are included; similarly, support for MiKTeX
file searching routines is available if `MIKTEX' is defined during
compilation. Nevertheless, as a last resort, you can compile both programs
without a search library too.
The kpathsea library is *not* part of the ttf2pk package (see notes below).
Under UNIX-like systems say
./configure --prefix=/usr/local/TeX --with-kpathsea-dir=<DIR>
make
make install
for a normal compilation and installation. Replace `/usr/local/TeX' with a
path to your TeX distribution.
[Note 1:
Try to find `libkpathsea.*' on your system. Use the directory above this
one as the argument for --with-kpathsea-dir. This should work in most
cases. If you can't find the library, you probably have a web2c package
with statically linked binaries. This means that you have to get the web2c
sources from CTAN, configure it with something like
./configure --prefix=/usr/local/TeX --datadir=/usr/local/TeX \
--enable-shared --disable-static
according to your setup; then change to the kpathsea directory and say
`make' and `make install' (Do the latter with caution not to overwrite
binaries like kpsewhich).
It even works with the source tree from the TeX Live CD 3! You just have
to add a proper --srcdir option to the configure script.
Unfortunately, teTeX-0.4 uses a very old kpathsea library version without
automatical shared-library support, thus you have to install the static
libraries:
.) unpack the sources (basically you need only the contents of kpse-2.6
and the two subdirs `kpathsea' and `make'.
.) say
./configure --prefix=...
make
in the kpse-2.6 directory
.) say
make install-library
in the kpathsea subdirectory. See Note 2 also.
DON'T USE A NEWER KPATHSEA VERSION IF YOU USE teTeX 0.4 BINARIES! Newer
kpathsea versions are not compatible with version 2.6.
Note 2:
It seems that c-auto.h created during the kpathsea library compiling
process won't be installed for some older web2c versions. You should add
it manually, i.e., copy <web2c source tree>/kpathsea/c-auto.h to the
location where the other kpathsea header files have been installed.
Note 3:
If you want to use the --srcdir option of the configure script, you must
compile FreeType with --srcdir too. You have to use the same directory
structure to make it work (i.e., if you have said for FreeType
`./configure --srcdir=foo', and you are in the `bar' directory, FreeType's
configure script will generate all the needed subdirs for compiling
FreeType. You've then manually to add the directory `bar/contrib/ttf2pk';
there you should start to say ./configure --srcdir=foo/contrib/ttf2pk').]
Use Makefile.dm for emx + dmake and say
dmake -r -f Makefile.dm
[Note: It should work with djgpp too, but I haven't tested this.]
ttf2pk and ttf2tfm are already part of MiKTeX.
Primary author of afm2tfm: T. Rokicki,
Primary author of gsftopk: P.Vojta
Primary author of the kpathsea library,
afm2tfm/gsftopk adaptation: K. Berry.
--
Frederic Loyer <loyer@ensta.fr>
Werner Lemberg <wl@gnu.org>

22
contrib/ttf2pk/TODO Normal file
View File

@@ -0,0 +1,22 @@
. multiple configuration files similar to newer versions of gsftopk(k).
. support for different horizontal and vertical resolutions.
. character composition via the vpl file.
. using GSUB for accessing small caps (if available).
. enabling -v and -V at the same time.
. Omega support
. afm output
. possibility to create `real' fonts, i.e., avoiding virtual fonts for small
caps etc. -- some dvi previewers still can't handle virtual fonts. Due to
the huge amount of work to support this it is rather unlikely that I'll do
it.
. using hash tables to store glyph names for better performance
. show replacement glyphs too in glyph listings

23
contrib/ttf2pk/c-auto.h Normal file
View File

@@ -0,0 +1,23 @@
/*
* c-auto.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef C_AUTO_H
#define C_AUTO_H
/*
* We need to get kpathsea's configuration file.
*/
#include "kpathsea/c-auto.h"
#endif /* C_AUTO_H */
/* end */

179
contrib/ttf2pk/case.c Normal file
View File

@@ -0,0 +1,179 @@
/*
* case.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#include <stdlib.h> /* for definition of NULL */
#include "case.h"
/* This is a table of uppercase/lowercase pairs which can't be deduced */
/* by lowercasing the uppercase Adobe glyph name. */
/* It has been extracted from the ucs2ps.um database compiled by */
/* Bjorn Brox <brox@corena.no>. */
Case casetable[] =
{
{"afii10017", "afii10065"},
{"afii10018", "afii10066"},
{"afii10019", "afii10067"},
{"afii10020", "afii10068"},
{"afii10021", "afii10069"},
{"afii10022", "afii10070"},
{"afii10023", "afii10071"},
{"afii10024", "afii10072"},
{"afii10025", "afii10073"},
{"afii10026", "afii10074"},
{"afii10027", "afii10075"},
{"afii10028", "afii10076"},
{"afii10029", "afii10077"},
{"afii10030", "afii10078"},
{"afii10031", "afii10079"},
{"afii10032", "afii10080"},
{"afii10033", "afii10081"},
{"afii10034", "afii10082"},
{"afii10035", "afii10083"},
{"afii10036", "afii10084"},
{"afii10037", "afii10085"},
{"afii10038", "afii10086"},
{"afii10039", "afii10087"},
{"afii10040", "afii10088"},
{"afii10041", "afii10089"},
{"afii10042", "afii10090"},
{"afii10043", "afii10091"},
{"afii10044", "afii10092"},
{"afii10045", "afii10093"},
{"afii10046", "afii10094"},
{"afii10047", "afii10095"},
{"afii10048", "afii10096"},
{"afii10049", "afii10097"},
{"afii10050", "afii10098"},
{"afii10051", "afii10099"},
{"afii10052", "afii10100"},
{"afii10053", "afii10101"},
{"afii10054", "afii10102"},
{"afii10055", "afii10103"},
{"afii10056", "afii10104"},
{"afii10057", "afii10105"},
{"afii10058", "afii10106"},
{"afii10059", "afii10107"},
{"afii10060", "afii10108"},
{"afii10061", "afii10109"},
{"afii10062", "afii10110"},
{"afii10145", "afii10193"},
{"afii10146", "afii10194"},
{"afii10147", "afii10195"},
{"afii10148", "afii10196"},
{"afii10149", "afii10197"},
{"afii10152", "afii10200"},
{"afii10202", "afii10154"},
{"afii10155", "afii10203"},
{"afii10156", "afii10204"},
{"afii10157", "afii10205"},
{"afii10158", "afii10206"},
{"afii10160", "afii10208"},
{"afii10161", "afii10209"},
{"afii10162", "afii10210"},
{"afii10163", "afii10211"},
{"afii10164", "afii10212"},
{"afii10166", "afii10214"},
{"afii10167", "afii10215"},
{"afii10168", "afii10216"},
{"afii10170", "afii10218"},
{"afii10171", "afii10219"},
{"afii10172", "afii10220"},
{"afii10173", "afii10221"},
{"afii10174", "afii10222"},
{"afii10176", "afii10224"},
{"afii10178", "afii10226"},
{"afii10179", "afii10227"},
{"afii10181", "afii10229"},
{"afii10182", "afii10230"},
{"afii10184", "afii10232"},
{"afii10185", "afii10233"},
{"afii10187", "afii10235"},
{"afii10188", "afii10236"},
{"afii10190", "afii10238"},
{"afii10785", "afii10833"},
{"afii10786", "afii10834"},
{"afii10787", "afii10835"},
{"afii10795", "afii10843"},
{"afii10798", "afii10846"},
{"afii10799", "afii10847"},
{"afii10800", "afii10848"},
{"afii10801", "afii10849"},
{"afii64308", "afii64436"},
{"afii10803", "afii10851"},
{"afii10808", "afii10856"},
{"afii10809", "afii10857"},
{"afii10810", "afii10858"},
{"afii10811", "afii10859"},
{"afii10817", "afii10865"},
{"afii10818", "afii10866"},
{"afii10819", "afii10867"},
{"afii10822", "afii10870"},
{"afii10827", "afii10875"},
{"afii10914", "afii10962"},
{"afii10920", "afii10968"},
{"afii10924", "afii10972"},
{"afii10927", "afii10975"},
{"afii10929", "afii10977"},
{"afii10930", "afii10978"},
{"afii10931", "afii10979"},
{"afii10932", "afii10980"},
{"afii10934", "afii10982"},
{"afii10943", "afii10991"},
{"afii10944", "afii10992"},
{"afii10951", "afii10967"},
/*{? "ash"} */
{"Beta", "beta1"},
{"Bhook", "bhooktop"},
{"Chook", "chooktop"},
/*{"Oopen" "cturn" ?} */
{"Dbar1", "dbar"},
{"Dhook", "dhooktop"},
{"Dmacron", "dmacron3"},
{"Dslash", "dmacron"},
{"I", "dotlessi"},
{"J", "dotlessj"},
/*{"Dbar", "drighttail" ?} */
/*{"Dbar" "drthook" ?} */
/*{"Dslash", ?} */
{"Fhook", "fscript"},
{"Ghook", "ghooktop"},
{"Ibar", "ibarred"},
{"I", "iundotted"},
{"Kappa", "kappa1"},
{"Khook", "khooktop"},
{"S", "longs"},
{"mcapturn", "mturn"},
{"mcapturn", "mturned"},
{"Mu", "mu1"},
{"Nhook", "nlefthookatleft"},
{"Nhook", "nlftlfthook"},
{"Obar", "obarred"},
{"Pi", "omega1"},
{"Phi", "phi1"},
{"Phi", "philatin"},
{"Pi", "pi1"},
{"Rho", "rho1"},
{"Sigma", "sigma1"},
{"Sigma", "sigmafinal"},
{"Sigma", "sigmalunate"},
{"S", "slong"},
{"Theta", "theta1"},
{"Thook", "thooktop"},
{"Trthook", "trighttail"},
{"Upsilon2", "upsilon"},
{"Vcursive", "vscript"},
{NULL, NULL}
};
/* end */

27
contrib/ttf2pk/case.h Normal file
View File

@@ -0,0 +1,27 @@
/*
* case.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef CASE_H
#define CASE_H
struct _Case
{
char *upper;
char *lower;
};
typedef struct _Case Case;
extern Case casetable[];
#endif /* CASE_H */
/* end */

1700
contrib/ttf2pk/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,87 @@
dnl This file is part of the ttf2pk package
dnl Process this file with autoconf to produce a configure script.
dnl Some tests are omitted since we assume that you've built the
dnl FreeType library successfully.
AC_INIT(../../lib/freetype.h)
AC_CANONICAL_SYSTEM
AC_PROG_CC
AC_PROG_CPP
AC_ARG_WITH(kpathsea-dir,
[ --with-kpathsea-dir=DIR Location of the kpathsea base dir (/usr/local)],[
if test x$withval = xyes; then
AC_MSG_WARN(Usage is: --with-kpathsea-dir=basedir)
else
if test x$withval = xno; then
AC_MSG_WARN(Usage is: --with-kpathsea-dir=basedir)
else
kpathsea_dir=$withval
fi
fi
])
if test -n "$kpathsea_dir"; then
LIBS="$LIBS -L$kpathsea_dir/lib"
CPPFLAGS="$CPPFLAGS -I$kpathsea_dir/include -I$srcdir"
dnl the function kpse_set_program_name() is available since kpathsea 3.2
AC_CHECK_LIB(kpathsea, kpse_set_program_name, [[]], AC_DEFINE(OLD_KPATHSEA))
AC_CHECK_LIB(kpathsea, kpse_init_prog, ,[
AC_MSG_ERROR([Can't find kpathsea library! Use --with-kpathsea-dir option.])])
dnl the header file kpathsea.h doesn't exist in kpathsea 2.6 and before
AC_CHECK_HEADER(kpathsea/kpathsea.h, [[]], AC_DEFINE(VERY_OLD_KPATHSEA))
AC_CHECK_HEADER(kpathsea/c-auto.h, ,[
AC_MSG_ERROR([Can't find kpathsea include files! Use --with-kpathsea-dir option.])])
else
CPPFLAGS="$CPPFLAGS -I$srcdir"
fi
AC_CHECK_LIB(m, floor)
AC_CHECK_LIB(intl, gettext)
OLDLIBS=$LIBS
LIBS="$LIBS -L../../lib/.libs"
CPPFLAGS="-I$srcdir/../../lib $CPPFLAGS"
AC_CHECK_LIB(ttf, TT_Init_FreeType, LIBS="$LIBS -lttf",[
AC_MSG_ERROR([Can't find ttf library! Compile FreeType first.])])
LIBS=$OLDLIBS
dnl get Compiler flags right.
if test "x$CC" = xgcc; then
XX_CFLAGS="-Wall -pedantic"
else
case "$host" in
alpha-dec-osf*)
XX_CFLAGS="-std1 -O2 -g3"
;;
*)
XX_CFLAGS=
;;
esac
fi
AC_SUBST(XX_CFLAGS)
AC_CHECK_PROG(RM, rm, rm)
AC_CHECK_PROG(RMDIR, rmdir, rmdir)
AC_PROG_INSTALL
if test -z "$kpathsea_dir"; then
AC_MSG_WARN([
The binaries will be compiled without file search library support!
For kpathsea support use the --with-kpathsea-dir option.
])
fi
AC_OUTPUT(Makefile MakeSub)
dnl end of configure.in

View File

@@ -0,0 +1,65 @@
# Big5.sfd
#
# subfont numbers for Big 5 encoding and its corresponding code ranges
# to be used with the CJK package for LaTeX.
01 0xA140_0xA17E 0xA1A1_0xA1FE 0xA240_0xA27E 0xA2A1_0xA2C4
02 0xA2C5_0xA2FE 0xA340_0xA37E 0xA3A1_0xA3FE 0xA440_0xA468
03 0xA469_0xA47E 0xA4A1_0xA4FE 0xA540_0xA57E 0xA5A1_0xA5ED
04 0xA5EE_0xA5FE 0xA640_0xA67E 0xA6A1_0xA6FE 0xA740_0xA77E 0xA7A1_0xA7B3
05 0xA7B4_0xA7FE 0xA840_0xA87E 0xA8A1_0xA8FE 0xA940_0xA957
06 0xA958_0xA97E 0xA9A1_0xA9FE 0xAA40_0xAA7E 0xAAA1_0xAADC
07 0xAADD_0xAAFE 0xAB40_0xAB7E 0xABA1_0xABFE 0xAC40_0xAC7E 0xACA1_0xACA2
08 0xACA3_0xACFE 0xAD40_0xAD7E 0xADA1_0xADFE 0xAE40_0xAE46
09 0xAE47_0xAE7E 0xAEA1_0xAEFE 0xAF40_0xAF7E 0xAFA1_0xAFCB
10 0xAFCC_0xAFFE 0xB040_0xB07E 0xB0A1_0xB0FE 0xB140_0xB16F
11 0xB170_0xB17E 0xB1A1_0xB1FE 0xB240_0xB27E 0xB2A1_0xB2F4
12 0xB2F5_0xB2FE 0xB340_0xB37E 0xB3A1_0xB3FE 0xB440_0xB47E 0xB4A1_0xB4BA
13 0xB4BB_0xB4FE 0xB540_0xB57E 0xB5A1_0xB5FE 0xB640_0xB65E
14 0xB65F_0xB67E 0xB6A1_0xB6FE 0xB740_0xB77E 0xB7A1_0xB7E3
15 0xB7E4_0xB7FE 0xB840_0xB87E 0xB8A1_0xB8FE 0xB940_0xB97E 0xB9A1_0xB9A9
16 0xB9AA_0xB9FE 0xBA40_0xBA7E 0xBAA1_0xBAFE 0xBB40_0xBB4D
17 0xBB4E_0xBB7E 0xBBA1_0xBBFE 0xBC40_0xBC7E 0xBCA1_0xBCD2
18 0xBCD3_0xBCFE 0xBD40_0xBD7E 0xBDA1_0xBDFE 0xBE40_0xBE76
19 0xBE77_0xBE7E 0xBEA1_0xBEFE 0xBF40_0xBF7E 0xBFA1_0xBFFB
20 0xBFFC_0xBFFE 0xC040_0xC07E 0xC0A1_0xC0FE 0xC140_0xC17E 0xC1A1_0xC1C1
21 0xC1C2_0xC1FE 0xC240_0xC27E 0xC2A1_0xC2FE 0xC340_0xC365
22 0xC366_0xC37E 0xC3A1_0xC3FE 0xC440_0xC47E 0xC4A1_0xC4EA
23 0xC4EB_0xC4FE 0xC540_0xC57E 0xC5A1_0xC5FE 0xC640_0xC67E 0xC6A1_0xC6B0
24 0xC6B1_0xC6FE 0xC740_0xC77E 0xC7A1_0xC7FE 0xC840_0xC854
25 0xC855_0xC87E 0xC8A1_0xC8FE 0xC940_0xC97E 0xC9A1_0xC9D9
26 0xC9DA_0xC9FE 0xCA40_0xCA7E 0xCAA1_0xCAFE 0xCB40_0xCB7D
27 0xCB7E 0xCBA1_0xCBFE 0xCC40_0xCC7E 0xCCA1_0xCCFE 0xCD40_0xCD43
28 0xCD44_0xCD7E 0xCDA1_0xCDFE 0xCE40_0xCE7E 0xCEA1_0xCEC8
29 0xCEC9_0xCEFE 0xCF40_0xCF7E 0xCFA1_0xCFFE 0xD040_0xD06C
30 0xD06D_0xD07E 0xD0A1_0xD0FE 0xD140_0xD17E 0xD1A1_0xD1F1
31 0xD1F2_0xD1FE 0xD240_0xD27E 0xD2A1_0xD2FE 0xD340_0xD37E 0xD3A1_0xD3B7
32 0xD3B8_0xD3FE 0xD440_0xD47E 0xD4A1_0xD4FE 0xD540_0xD55B
33 0xD55C_0xD57E 0xD5A1_0xD5FE 0xD640_0xD67E 0xD6A1_0xD6E0
34 0xD6E1_0xD6FE 0xD740_0xD77E 0xD7A1_0xD7FE 0xD840_0xD87E 0xD8A1_0xD8A6
35 0xD8A7_0xD8FE 0xD940_0xD97E 0xD9A1_0xD9FE 0xDA40_0xDA4A
36 0xDA4B_0xDA7E 0xDAA1_0xDAFE 0xDB40_0xDB7E 0xDBA1_0xDBCF
37 0xDBD0_0xDBFE 0xDC40_0xDC7E 0xDCA1_0xDCFE 0xDD40_0xDD73
38 0xDD74_0xDD7E 0xDDA1_0xDDFE 0xDE40_0xDE7E 0xDEA1_0xDEF8
39 0xDEF9_0xDEFE 0xDF40_0xDF7E 0xDFA1_0xDFFE 0xE040_0xE07E 0xE0A1_0xE0BE
40 0xE0BF_0xE0FE 0xE140_0xE17E 0xE1A1_0xE1FE 0xE240_0xE262
41 0xE263_0xE27E 0xE2A1_0xE2FE 0xE340_0xE37E 0xE3A1_0xE3E7
42 0xE3E8_0xE3FE 0xE440_0xE47E 0xE4A1_0xE4FE 0xE540_0xE57E 0xE5A1_0xE5AD
43 0xE5AE_0xE5FE 0xE640_0xE67E 0xE6A1_0xE6FE 0xE740_0xE751
44 0xE752_0xE77E 0xE7A1_0xE7FE 0xE840_0xE87E 0xE8A1_0xE8D6
45 0xE8D7_0xE8FE 0xE940_0xE97E 0xE9A1_0xE9FE 0xEA40_0xEA7A
46 0xEA7B_0xEA7E 0xEAA1_0xEAFE 0xEB40_0xEB7E 0xEBA1_0xEBFE 0xEC40
47 0xEC41_0xEC7E 0xECA1_0xECFE 0xED40_0xED7E 0xEDA1_0xEDC5
48 0xEDC6_0xEDFE 0xEE40_0xEE7E 0xEEA1_0xEEFE 0xEF40_0xEF69
49 0xEF6A_0xEF7E 0xEFA1_0xEFFE 0xF040_0xF07E 0xF0A1_0xF0EE
50 0xF0EF_0xF0FE 0xF140_0xF17E 0xF1A1_0xF1FE 0xF240_0xF27E 0xF2A1_0xF2B4
51 0xF2B5_0xF2FE 0xF340_0xF37E 0xF3A1_0xF3FE 0xF440_0xF458
52 0xF459_0xF47E 0xF4A1_0xF4FE 0xF540_0xF57E 0xF5A1_0xF5DD
53 0xF5DE_0xF5FE 0xF640_0xF67E 0xF6A1_0xF6FE 0xF740_0xF77E 0xF7A1_0xF7A3
54 0xF7A4_0xF7FE 0xF840_0xF87E 0xF8A1_0xF8FE 0xF940_0xF947
55 0xF948_0xF97E 0xF9A1_0xF9FE 0xFA40_0xFA7E 0xFAA1_0xFACC
56 0xFACD_0xFAFE 0xFB40_0xFB7E 0xFBA1_0xFBFE 0xFC40_0xFC70
57 0xFC71_0xFC7E 0xFCA1_0xFCFE 0xFD40_0xFD7E 0xFDA1_0xFDF5
58 0xFDF6_0xFDFE 0xFE40_0xFE7E 0xFEA1_0xFEFE
# eof

119
contrib/ttf2pk/data/ET5.enc Normal file
View File

@@ -0,0 +1,119 @@
% ET5.enc
%
%
% This is LaTeX ET5 encoding for Vietnamese.
%
%
% LIGKERN question quoteleft =: questiondown ;
% LIGKERN exclam quoteleft =: exclamdown ;
% LIGKERN hyphen hyphen =: endash ;
% LIGKERN endash hyphen =: emdash ;
% LIGKERN quoteleft quoteleft =: quotedblleft ;
% LIGKERN quoteright quoteright =: quotedblright ;
% LIGKERN comma comma =: quotedblbase ;
%
% LIGKERN f i =: fi ;
% LIGKERN f l =: fl ;
% LIGKERN f f =: ff ;
% LIGKERN ff i =: ffi ;
% LIGKERN ff l =: ffl ;
%
% We blow away kerns to and from spaces (TeX doesn't have a
% space) and also remove any kerns from the numbers.
%
% LIGKERN space {} * ; * {} space ;
% LIGKERN zero {} * ; * {} zero ;
% LIGKERN one {} * ; * {} one ;
% LIGKERN two {} * ; * {} two ;
% LIGKERN three {} * ; * {} three ;
% LIGKERN four {} * ; * {} four ;
% LIGKERN five {} * ; * {} five ;
% LIGKERN six {} * ; * {} six ;
% LIGKERN seven {} * ; * {} seven ;
% LIGKERN eight {} * ; * {} eight ;
% LIGKERN nine {} * ; * {} nine ;
/ET5encoding [
% 0x00
/Abrevehookabove /Abrevetilde /Acircumflextilde /Yhookabove
/Ytilde /Ydotbelow /Sigma /Upsilon
/Phi /Psi /Omega /ff
/fi /fl /ffi /ffl
% 0x10
/dotlessi /dotlessj /grave /acute
/caron /breve /macron /ring
/cedilla /germandbls /ae /oe
/oslash /AE /OE /Oslash
% 0x20
/.notdef /exclam /quotedblright /numbersign
/dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus
/comma /hyphen /period /slash
% 0x30
/zero /one /two /three
/four /five /six /seven
/eight /nine /colon /semicolon
/exclamdown /equal /questiondown /question
% 0x40
/at /A /B /C
/D /E /F /G
/H /I /J /K
/L /M /N /O
% 0x50
/P /Q /R /S
/T /U /V /W
/X /Y /Z /bracketleft
/quotedblleft /bracketright /circumflex /dotaccent
% 0x60
/quoteleft /a /b /c
/d /e /f /g
/h /i /j /k
/l /m /n /o
% 0x70
/p /q /r /s
/t /u /v /w
/x /y /z /endash
/emdash /hungarumlaut /tilde /dieresis
% 0x80
/Adotbelow /Abreveacute /Abrevegrave /Abrevedotbelow
/Acircumflexacute /Acircumflexgrave /Acircumflexhookabove /Acircumflexdotbelow
/Etilde /Edotbelow /Ecircumflexacute /Ecircumflexgrave
/Ecircumflexhookabove /Ecircumflextilde /Ecircumflexdotbelow /Ocircumflexacute
% 0x90
/Ocircumflexgrave /Ocircumflexhookabove /Ocircumflextilde /Ocircumflexdotbelow
/Ohorndotbelow /Ohornacute /Ohorngrave /Ohornhookabove
/Idotbelow /Ohookabove /Odotbelow /Ihookabove
/Uhookabove /Utilde /Udotbelow /Ygrave
% 0xA0
/Otilde /abreveacute /abrevegrave /abrevedotbelow
/acircumflexacute /acircumflexgrave /acircumflexhookabove /acircumflexdotbelow
/etilde /edotbelow /ecircumflexacute /ecircumflexgrave
/ecircumflexhookabove /ecircumflextilde /ecircumflexdotbelow /ocircumflexacute
% 0xB0
/ocircumflexgrave /ocircumflexhookabove /ocircumflextilde /Ohorntilde
/Ohorn /ocircumflexdotbelow /ohorngrave /ohornhookabove
/idotbelow /Uhorndotbelow /Uhornacute /Uhorngrave
/Uhornhookabove /ohorn /ohornacute /Uhorn
% 0xC0
/Agrave /Aacute /Acircumflex /Atilde
/Ahookabove /Abreve /abrevehookabove /abrevetilde
/Egrave /Eacute /Ecircumflex /Ehookabove
/Igrave /Iacute /Itilde /ygrave
% 0xD0
/Dbar /uhornacute /Ograve /Oacute
/Ocircumflex /adotbelow /yhookabove /uhorngrave
/uhornhookabove /Ugrave /Uacute /ytilde
/ydotbelow /Yacute /ohorntilde /uhorn
% 0xE0
/agrave /aacute /acircumflex /atilde
/ahookabove /abreve /uhorntilde /acircumflextilde
/egrave /eacute /ecircumflex /ehookabove
/igrave /iacute /itilde /ihookabove
% 0xF0
/dbar /uhorndotbelow /ograve /oacute
/ocircumflex /otilde /ohookabove /odotbelow
/udotbelow /ugrave /uacute /utilde
/uhookabove /yacute /ohorndotbelow /Uhorntilde
] def
% eof

View File

@@ -0,0 +1,49 @@
# EUC.sfd
#
# subfont numbers for character sets in EUC encoding and its corresponding
# code ranges to be used with the CJK package for LaTeX.
#
# Examples for such character sets:
#
# GB 2312-1980,
# KS X 1001:1992 (=KS C 5601-1992),
# JIS X 0208:1997,
# CNS 11643-1992 planes 1-7.
01 0xA1A1_0xA1FE 0xA2A1_0xA2FE 0xA3A1_0xA3E4
02 0xA3E5_0xA3FE 0xA4A1_0xA4FE 0xA5A1_0xA5FE 0xA6A1_0xA6CA
03 0xA6CB_0xA6FE 0xA7A1_0xA7FE 0xA8A1_0xA8FE 0xA9A1_0xA9B0
04 0xA9B1_0xA9FE 0xAAA1_0xAAFE 0xABA1_0xABF4
05 0xABF5_0xABFE 0xACA1_0xACFE 0xADA1_0xADFE 0xAEA1_0xAEDA
06 0xAEDB_0xAEFE 0xAFA1_0xAFFE 0xB0A1_0xB0FE 0xB1A1_0xB1C0
07 0xB1C1_0xB1FE 0xB2A1_0xB2FE 0xB3A1_0xB3FE 0xB4A1_0xB4A6
08 0xB4A7_0xB4FE 0xB5A1_0xB5FE 0xB6A1_0xB6EA
09 0xB6EB_0xB6FE 0xB7A1_0xB7FE 0xB8A1_0xB8FE 0xB9A1_0xB9D0
10 0xB9D1_0xB9FE 0xBAA1_0xBAFE 0xBBA1_0xBBFE 0xBCA1_0xBCB6
11 0xBCB7_0xBCFE 0xBDA1_0xBDFE 0xBEA1_0xBEFA
12 0xBEFB_0xBEFE 0xBFA1_0xBFFE 0xC0A1_0xC0FE 0xC1A1_0xC1E0
13 0xC1E1_0xC1FE 0xC2A1_0xC2FE 0xC3A1_0xC3FE 0xC4A1_0xC4C6
14 0xC4C7_0xC4FE 0xC5A1_0xC5FE 0xC6A1_0xC6FE 0xC7A1_0xC7AC
15 0xC7AD_0xC7FE 0xC8A1_0xC8FE 0xC9A1_0xC9F0
16 0xC9F1_0xC9FE 0xCAA1_0xCAFE 0xCBA1_0xCBFE 0xCCA1_0xCCD6
17 0xCCD7_0xCCFE 0xCDA1_0xCDFE 0xCEA1_0xCEFE 0xCFA1_0xCFBC
18 0xCFBD_0xCFFE 0xD0A1_0xD0FE 0xD1A1_0xD1FE 0xD2A1_0xD2A2
19 0xD2A3_0xD2FE 0xD3A1_0xD3FE 0xD4A1_0xD4E6
20 0xD4E7_0xD4FE 0xD5A1_0xD5FE 0xD6A1_0xD6FE 0xD7A1_0xD7CC
21 0xD7CD_0xD7FE 0xD8A1_0xD8FE 0xD9A1_0xD9FE 0xDAA1_0xDAB2
22 0xDAB3_0xDAFE 0xDBA1_0xDBFE 0xDCA1_0xDCF6
23 0xDCF7_0xDCFE 0xDDA1_0xDDFE 0xDEA1_0xDEFE 0xDFA1_0xDFDC
24 0xDFDD_0xDFFE 0xE0A1_0xE0FE 0xE1A1_0xE1FE 0xE2A1_0xE2C2
25 0xE2C3_0xE2FE 0xE3A1_0xE3FE 0xE4A1_0xE4FE 0xE5A1_0xE5A8
26 0xE5A9_0xE5FE 0xE6A1_0xE6FE 0xE7A1_0xE7EC
27 0xE7ED_0xE7FE 0xE8A1_0xE8FE 0xE9A1_0xE9FE 0xEAA1_0xEAD2
28 0xEAD3_0xEAFE 0xEBA1_0xEBFE 0xECA1_0xECFE 0xEDA1_0xEDB8
29 0xEDB9_0xEDFE 0xEEA1_0xEEFE 0xEFA1_0xEFFC
30 0xEFFD_0xEFFE 0xF0A1_0xF0FE 0xF1A1_0xF1FE 0xF2A1_0xF2E2
31 0xF2E3_0xF2FE 0xF3A1_0xF3FE 0xF4A1_0xF4FE 0xF5A1_0xF5C8
32 0xF5C9_0xF5FE 0xF6A1_0xF6FE 0xF7A1_0xF7FE 0xF8A1_0xF8AE
33 0xF8AF_0xF8FE 0xF9A1_0xF9FE 0xFAA1_0xFAF2
34 0xFAF3_0xFAFE 0xFBA1_0xFBFE 0xFCA1_0xFCFE 0xFDA1_0xFDD8
35 0xFDD9_0xFDFE 0xFEA1_0xFEFE
# eof

View File

@@ -0,0 +1,52 @@
# SJIS.sfd
#
# subfont numbers for SJIS encoding and its corresponding code ranges
# to be used with the CJK package for LaTeX.
01 0x8140_0x817E 0x8180_0x81FC 0x8240_0x827E 0x8280_0x8284
02 0x8285_0x82FC 0x8340_0x837E 0x8380_0x83C8
03 0x83C9_0x83FC 0x8440_0x847E 0x8480_0x84FC 0x8540_0x854F
04 0x8550_0x857E 0x8580_0x85FC 0x8640_0x867E 0x8680_0x8694
05 0x8695_0x86FC 0x8740_0x877E 0x8780_0x87D8
06 0x87D9_0x87FC 0x8840_0x887E 0x8880_0x88FC 0x8940_0x895F
07 0x8960_0x897E 0x8980_0x89FC 0x8A40_0x8A7E 0x8A80_0x8AA4
08 0x8AA5_0x8AFC 0x8B40_0x8B7E 0x8B80_0x8BE8
09 0x8BE9_0x8BFC 0x8C40_0x8C7E 0x8C80_0x8CFC 0x8D40_0x8D6F
10 0x8D70_0x8D7E 0x8D80_0x8DFC 0x8E40_0x8E7E 0x8E80_0x8EB4
11 0x8EB5_0x8EFC 0x8F40_0x8F7E 0x8F80_0x8FF8
12 0x8FF9_0x8FFC 0x9040_0x907E 0x9080_0x90FC 0x9140_0x917E 0x9180
13 0x9181_0x91FC 0x9240_0x927E 0x9280_0x92C4
14 0x92C5_0x92FC 0x9340_0x937E 0x9380_0x93FC 0x9440_0x944B
15 0x944C_0x947E 0x9480_0x94FC 0x9540_0x957E 0x9580_0x9590
16 0x9591_0x95FC 0x9640_0x967E 0x9680_0x96D4
17 0x96D5_0x96FC 0x9740_0x977E 0x9780_0x97FC 0x9840_0x985B
18 0x985C_0x987E 0x9880_0x98FC 0x9940_0x997E 0x9980_0x99A0
19 0x99A1_0x99FC 0x9A40_0x9A7E 0x9A80_0x9AE4
20 0x9AE5_0x9AFC 0x9B40_0x9B7E 0x9B80_0x9BFC 0x9C40_0x9C6B
21 0x9C6C_0x9C7E 0x9C80_0x9CFC 0x9D40_0x9D7E 0x9D80_0x9DB0
22 0x9DB1_0x9DFC 0x9E40_0x9E7E 0x9E80_0x9EF4
23 0x9EF5_0x9EFC 0x9F40_0x9F7E 0x9F80_0x9FFC 0xE040_0xE07B
24 0xE07C_0xE07E 0xE080_0xE0FC 0xE140_0xE17E 0xE180_0xE1C0
25 0xE1C1_0xE1FC 0xE240_0xE27E 0xE280_0xE2FC 0xE340_0xE347
26 0xE348_0xE37E 0xE380_0xE3FC 0xE440_0xE47E 0xE480_0xE48C
27 0xE48D_0xE4FC 0xE540_0xE57E 0xE580_0xE5D0
28 0xE5D1_0xE5FC 0xE640_0xE67E 0xE680_0xE6FC 0xE740_0xE757
29 0xE758_0xE77E 0xE780_0xE7FC 0xE840_0xE87E 0xE880_0xE89C
30 0xE89D_0xE8FC 0xE940_0xE97E 0xE980_0xE9E0
31 0xE9E1_0xE9FC 0xEA40_0xEA7E 0xEA80_0xEAFC 0xEB40_0xEB67
32 0xEB68_0xEB7E 0xEB80_0xEBFC 0xEC40_0xEC7E 0xEC80_0xECAC
33 0xECAD_0xECFC 0xED40_0xED7E 0xED80_0xEDF0
34 0xEDF1_0xEDFC 0xEE40_0xEE7E 0xEE80_0xEEFC 0xEF40_0xEF77
35 0xEF78_0xEF7E 0xEF80_0xEFFC 0xF040_0xF07E 0xF080_0xF0BC
36 0xF0BD_0xF0FC 0xF140_0xF17E 0xF180_0xF1FC 0xF240_0xF243
37 0xF244_0xF27E 0xF280_0xF2FC 0xF340_0xF37E 0xF380_0xF388
38 0xF389_0xF3FC 0xF440_0xF47E 0xF480_0xF4CC
39 0xF4CD_0xF4FC 0xF540_0xF57E 0xF580_0xF5FC 0xF640_0xF653
40 0xF654_0xF67E 0xF680_0xF6FC 0xF740_0xF77E 0xF780_0xF798
41 0xF799_0xF7FC 0xF840_0xF87E 0xF880_0xF8DC
42 0xF8DD_0xF8FC 0xF940_0xF97E 0xF980_0xF9FC 0xFA40_0xFA63
43 0xFA64_0xFA7E 0xFA80_0xFAFC 0xFB40_0xFB7E 0xFB80_0xFBA8
44 0xFBA9_0xFBFC 0xFC40_0xFC7E 0xFC80_0xFCEC
45 0xFCED_0xFCFC
# eof

View File

@@ -0,0 +1,128 @@
% T1-WGL4.enc
%
%
% This is LaTeX T1 encoding for WGL4 encoded TrueType fonts
% (e.g. from Windows 95)
%
%
% Note that /hyphen appears twice (for the T1 code points `hyphen' 0x2d
% and `hyphenchar' 0x7f).
%
%
% LIGKERN space l =: lslash ;
% LIGKERN space L =: Lslash ;
% LIGKERN question quoteleft =: questiondown ;
% LIGKERN exclam quoteleft =: exclamdown ;
% LIGKERN hyphen hyphen =: endash ;
% LIGKERN endash hyphen =: emdash ;
% LIGKERN quoteleft quoteleft =: quotedblleft ;
% LIGKERN quoteright quoteright =: quotedblright ;
% LIGKERN comma comma =: quotedblbase ;
% LIGKERN less less =: guillemotleft ;
% LIGKERN greater greater =: guillemotright ;
%
% LIGKERN f i =: fi ;
% LIGKERN f l =: fl ;
% LIGKERN f f =: ff ;
% LIGKERN ff i =: ffi ;
% LIGKERN ff l =: ffl ;
%
% We blow away kerns to and from spaces (TeX doesn't have a
% space) and also remove any kerns from the numbers.
%
% LIGKERN space {} * ; * {} space ;
% LIGKERN zero {} * ; * {} zero ;
% LIGKERN one {} * ; * {} one ;
% LIGKERN two {} * ; * {} two ;
% LIGKERN three {} * ; * {} three ;
% LIGKERN four {} * ; * {} four ;
% LIGKERN five {} * ; * {} five ;
% LIGKERN six {} * ; * {} six ;
% LIGKERN seven {} * ; * {} seven ;
% LIGKERN eight {} * ; * {} eight ;
% LIGKERN nine {} * ; * {} nine ;
/T1Encoding [ % now 256 chars follow
% 0x00
/grave /acute /circumflex /tilde
/dieresis /hungarumlaut /ring /caron
/breve /macron /dotaccent /cedilla
/ogonek /quotesinglbase /guilsinglleft /guilsinglright
% 0x10
/quotedblleft /quotedblright /quotedblbase /guillemotleft
/guillemotright /endash /emdash /compwordmark
/perthousandzero /dotlessi /dotlessj /ff
/fi /fl /ffi /ffl
% 0x20
/visualspace /exclam /quotedbl /numbersign
/dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus
/comma /hyphen /period /slash
% 0x30
/zero /one /two /three
/four /five /six /seven
/eight /nine /colon /semicolon
/less /equal /greater /question
% 0x40
/at /A /B /C
/D /E /F /G
/H /I /J /K
/L /M /N /O
% 0x50
/P /Q /R /S
/T /U /V /W
/X /Y /Z /bracketleft
/backslash /bracketright /asciicircum /underscore
% 0x60
/quoteleft /a /b /c
/d /e /f /g
/h /i /j /k
/l /m /n /o
% 0x70
/p /q /r /s
/t /u /v /w
/x /y /z /braceleft
/bar /braceright /asciitilde /hyphen
% 0x80
/Abreve /Aogonek /Cacute /Ccaron
/Dcaron /Ecaron /Eogonek /Gbreve
/Lacute /Lcaron /Lslash /Nacute
/Ncaron /Eng /Odblacute /Racute
% 0x90
/Rcaron /Sacute /Scaron /Scedilla
/Tcaron /Tcedilla /Udblacute /Uring
/Ydieresis /Zacute /Zcaron /Zdot
/IJ /Idot /dmacron /section
% 0xA0
/abreve /aogonek /cacute /ccaron
/dcaron /ecaron /eogonek /gbreve
/lacute /lcaron /lslash /nacute
/ncaron /eng /odblacute /racute
% 0xB0
/rcaron /sacute /scaron /scedilla
/tcaron /tcedilla /udblacute /uring
/ydieresis /zacute /zcaron /zdot
/ij /exclamdown /questiondown /sterling
% 0xC0
/Agrave /Aacute /Acircumflex /Atilde
/Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis
/Igrave /Iacute /Icircumflex /Idieresis
% 0xD0
/Eth /Ntilde /Ograve /Oacute
/Ocircumflex /Otilde /Odieresis /OE
/Oslash /Ugrave /Uacute /Ucircumflex
/Udieresis /Yacute /Thorn /Germandbls
% 0xE0
/agrave /aacute /acircumflex /atilde
/adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis
/igrave /iacute /icircumflex /idieresis
% 0xF0
/eth /ntilde /ograve /oacute
/ocircumflex /otilde /odieresis /oe
/oslash /ugrave /uacute /ucircumflex
/udieresis /yacute /thorn /germandbls
] def
% eof

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1114
contrib/ttf2pk/data/UGB.sfd Normal file

File diff suppressed because it is too large Load Diff

3002
contrib/ttf2pk/data/UGBK.sfd Normal file

File diff suppressed because it is too large Load Diff

1114
contrib/ttf2pk/data/UJIS.sfd Normal file

File diff suppressed because it is too large Load Diff

1114
contrib/ttf2pk/data/UKS.sfd Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,265 @@
# Unicode.sfd
#
# subfont numbers for Unicode encoding and its corresponding code ranges
# to be used with the CJK package for LaTeX.
00 0x0_0xFF
01 0x100_0x1FF
02 0x200_0x2FF
03 0x300_0x3FF
04 0x400_0x4FF
05 0x500_0x5FF
06 0x600_0x6FF
07 0x700_0x7FF
08 0x800_0x8FF
09 0x900_0x9FF
0a 0xA00_0xAFF
0b 0xB00_0xBFF
0c 0xC00_0xCFF
0d 0xD00_0xDFF
0e 0xE00_0xEFF
0f 0xF00_0xFFF
10 0x1000_0x10FF
11 0x1100_0x11FF
12 0x1200_0x12FF
13 0x1300_0x13FF
14 0x1400_0x14FF
15 0x1500_0x15FF
16 0x1600_0x16FF
17 0x1700_0x17FF
18 0x1800_0x18FF
19 0x1900_0x19FF
1a 0x1A00_0x1AFF
1b 0x1B00_0x1BFF
1c 0x1C00_0x1CFF
1d 0x1D00_0x1DFF
1e 0x1E00_0x1EFF
1f 0x1F00_0x1FFF
20 0x2000_0x20FF
21 0x2100_0x21FF
22 0x2200_0x22FF
23 0x2300_0x23FF
24 0x2400_0x24FF
25 0x2500_0x25FF
26 0x2600_0x26FF
27 0x2700_0x27FF
28 0x2800_0x28FF
29 0x2900_0x29FF
2a 0x2A00_0x2AFF
2b 0x2B00_0x2BFF
2c 0x2C00_0x2CFF
2d 0x2D00_0x2DFF
2e 0x2E00_0x2EFF
2f 0x2F00_0x2FFF
30 0x3000_0x30FF
31 0x3100_0x31FF
32 0x3200_0x32FF
33 0x3300_0x33FF
34 0x3400_0x34FF
35 0x3500_0x35FF
36 0x3600_0x36FF
37 0x3700_0x37FF
38 0x3800_0x38FF
39 0x3900_0x39FF
3a 0x3A00_0x3AFF
3b 0x3B00_0x3BFF
3c 0x3C00_0x3CFF
3d 0x3D00_0x3DFF
3e 0x3E00_0x3EFF
3f 0x3F00_0x3FFF
40 0x4000_0x40FF
41 0x4100_0x41FF
42 0x4200_0x42FF
43 0x4300_0x43FF
44 0x4400_0x44FF
45 0x4500_0x45FF
46 0x4600_0x46FF
47 0x4700_0x47FF
48 0x4800_0x48FF
49 0x4900_0x49FF
4a 0x4A00_0x4AFF
4b 0x4B00_0x4BFF
4c 0x4C00_0x4CFF
4d 0x4D00_0x4DFF
4e 0x4E00_0x4EFF
4f 0x4F00_0x4FFF
50 0x5000_0x50FF
51 0x5100_0x51FF
52 0x5200_0x52FF
53 0x5300_0x53FF
54 0x5400_0x54FF
55 0x5500_0x55FF
56 0x5600_0x56FF
57 0x5700_0x57FF
58 0x5800_0x58FF
59 0x5900_0x59FF
5a 0x5A00_0x5AFF
5b 0x5B00_0x5BFF
5c 0x5C00_0x5CFF
5d 0x5D00_0x5DFF
5e 0x5E00_0x5EFF
5f 0x5F00_0x5FFF
60 0x6000_0x60FF
61 0x6100_0x61FF
62 0x6200_0x62FF
63 0x6300_0x63FF
64 0x6400_0x64FF
65 0x6500_0x65FF
66 0x6600_0x66FF
67 0x6700_0x67FF
68 0x6800_0x68FF
69 0x6900_0x69FF
6a 0x6A00_0x6AFF
6b 0x6B00_0x6BFF
6c 0x6C00_0x6CFF
6d 0x6D00_0x6DFF
6e 0x6E00_0x6EFF
6f 0x6F00_0x6FFF
70 0x7000_0x70FF
71 0x7100_0x71FF
72 0x7200_0x72FF
73 0x7300_0x73FF
74 0x7400_0x74FF
75 0x7500_0x75FF
76 0x7600_0x76FF
77 0x7700_0x77FF
78 0x7800_0x78FF
79 0x7900_0x79FF
7a 0x7A00_0x7AFF
7b 0x7B00_0x7BFF
7c 0x7C00_0x7CFF
7d 0x7D00_0x7DFF
7e 0x7E00_0x7EFF
7f 0x7F00_0x7FFF
80 0x8000_0x80FF
81 0x8100_0x81FF
82 0x8200_0x82FF
83 0x8300_0x83FF
84 0x8400_0x84FF
85 0x8500_0x85FF
86 0x8600_0x86FF
87 0x8700_0x87FF
88 0x8800_0x88FF
89 0x8900_0x89FF
8a 0x8A00_0x8AFF
8b 0x8B00_0x8BFF
8c 0x8C00_0x8CFF
8d 0x8D00_0x8DFF
8e 0x8E00_0x8EFF
8f 0x8F00_0x8FFF
90 0x9000_0x90FF
91 0x9100_0x91FF
92 0x9200_0x92FF
93 0x9300_0x93FF
94 0x9400_0x94FF
95 0x9500_0x95FF
96 0x9600_0x96FF
97 0x9700_0x97FF
98 0x9800_0x98FF
99 0x9900_0x99FF
9a 0x9A00_0x9AFF
9b 0x9B00_0x9BFF
9c 0x9C00_0x9CFF
9d 0x9D00_0x9DFF
9e 0x9E00_0x9EFF
9f 0x9F00_0x9FFF
a0 0xA000_0xA0FF
a1 0xA100_0xA1FF
a2 0xA200_0xA2FF
a3 0xA300_0xA3FF
a4 0xA400_0xA4FF
a5 0xA500_0xA5FF
a6 0xA600_0xA6FF
a7 0xA700_0xA7FF
a8 0xA800_0xA8FF
a9 0xA900_0xA9FF
aa 0xAA00_0xAAFF
ab 0xAB00_0xABFF
ac 0xAC00_0xACFF
ad 0xAD00_0xADFF
ae 0xAE00_0xAEFF
af 0xAF00_0xAFFF
b0 0xB000_0xB0FF
b1 0xB100_0xB1FF
b2 0xB200_0xB2FF
b3 0xB300_0xB3FF
b4 0xB400_0xB4FF
b5 0xB500_0xB5FF
b6 0xB600_0xB6FF
b7 0xB700_0xB7FF
b8 0xB800_0xB8FF
b9 0xB900_0xB9FF
ba 0xBA00_0xBAFF
bb 0xBB00_0xBBFF
bc 0xBC00_0xBCFF
bd 0xBD00_0xBDFF
be 0xBE00_0xBEFF
bf 0xBF00_0xBFFF
c0 0xC000_0xC0FF
c1 0xC100_0xC1FF
c2 0xC200_0xC2FF
c3 0xC300_0xC3FF
c4 0xC400_0xC4FF
c5 0xC500_0xC5FF
c6 0xC600_0xC6FF
c7 0xC700_0xC7FF
c8 0xC800_0xC8FF
c9 0xC900_0xC9FF
ca 0xCA00_0xCAFF
cb 0xCB00_0xCBFF
cc 0xCC00_0xCCFF
cd 0xCD00_0xCDFF
ce 0xCE00_0xCEFF
cf 0xCF00_0xCFFF
d0 0xD000_0xD0FF
d1 0xD100_0xD1FF
d2 0xD200_0xD2FF
d3 0xD300_0xD3FF
d4 0xD400_0xD4FF
d5 0xD500_0xD5FF
d6 0xD600_0xD6FF
d7 0xD700_0xD7FF
# Surrogates
#
# d8 0xD800_0xD8FF
# d9 0xD900_0xD9FF
# da 0xDA00_0xDAFF
# db 0xDB00_0xDBFF
dc 0xDC00_0xDCFF
dd 0xDD00_0xDDFF
de 0xDE00_0xDEFF
df 0xDF00_0xDFFF
e0 0xE000_0xE0FF
e1 0xE100_0xE1FF
e2 0xE200_0xE2FF
e3 0xE300_0xE3FF
e4 0xE400_0xE4FF
e5 0xE500_0xE5FF
e6 0xE600_0xE6FF
e7 0xE700_0xE7FF
e8 0xE800_0xE8FF
e9 0xE900_0xE9FF
ea 0xEA00_0xEAFF
eb 0xEB00_0xEBFF
ec 0xEC00_0xECFF
ed 0xED00_0xEDFF
ee 0xEE00_0xEEFF
ef 0xEF00_0xEFFF
f0 0xF000_0xF0FF
f1 0xF100_0xF1FF
f2 0xF200_0xF2FF
f3 0xF300_0xF3FF
f4 0xF400_0xF4FF
f5 0xF500_0xF5FF
f6 0xF600_0xF6FF
f7 0xF700_0xF7FF
f8 0xF800_0xF8FF
f9 0xF900_0xF9FF
fa 0xFA00_0xFAFF
fb 0xFB00_0xFBFF
fc 0xFC00_0xFCFF
fd 0xFD00_0xFDFF
fe 0xFE00_0xFEFF
ff 0xFF00_0xFFFF
# eof

244
contrib/ttf2pk/data/VPS.rpl Normal file
View File

@@ -0,0 +1,244 @@
% VPS.rpl
%
%
% This file maps VPS encoding for Vietnamese to Adobe glyph names used
% in the file ET5.enc.
%
% VPS is a commonly used program to write Vietnamese.
%
% This file has been tested with the font vpsdlac.ttf using cmap (3,0)
.c0x0002 Adotbelow
.c0x0003 Acircumflexdotbelow
.c0x0004 Abrevedotbelow
.c0x0005 Edotbelow
.c0x0006 Ecircumflexdotbelow
.c0x0015 Uhorndotbelow
.c0x0019 Ydotbelow
.c0x001c Acircumflextilde
.c0x001d Uhorntilde
.c0x0020 space
.c0x0021 exclam
.c0x0022 quotedbl
.c0x0023 numbersign
.c0x0024 dollar
.c0x0025 percent
.c0x0026 ampersand
.c0x0027 quotesingle
.c0x0028 parenleft
.c0x0029 parenright
.c0x002a asterisk
.c0x002b plus
.c0x002c comma
.c0x002d hyphen
.c0x002e period
.c0x002f slash
.c0x0030 zero
.c0x0031 one
.c0x0032 two
.c0x0033 three
.c0x0034 four
.c0x0035 five
.c0x0036 six
.c0x0037 seven
.c0x0038 eight
.c0x0039 nine
.c0x003a colon
.c0x003b semicolon
.c0x003c less
.c0x003d equal
.c0x003e greater
.c0x003f question
.c0x0040 at
.c0x0041 A
.c0x0042 B
.c0x0043 C
.c0x0044 D
.c0x0045 E
.c0x0046 F
.c0x0047 G
.c0x0048 H
.c0x0049 I
.c0x004a J
.c0x004b K
.c0x004c L
.c0x004d M
.c0x004e N
.c0x004f O
.c0x0050 P
.c0x0051 Q
.c0x0052 R
.c0x0053 S
.c0x0054 T
.c0x0055 U
.c0x0056 V
.c0x0057 W
.c0x0058 X
.c0x0059 Y
.c0x005a Z
.c0x005b bracketleft
.c0x005c backslash
.c0x005d bracketright
.c0x005e asciicircum
.c0x005f underscore
.c0x0060 grave
.c0x0061 a
.c0x0062 b
.c0x0063 c
.c0x0064 d
.c0x0065 e
.c0x0066 f
.c0x0067 g
.c0x0068 h
.c0x0069 i
.c0x006a j
.c0x006b k
.c0x006c l
.c0x006d m
.c0x006e n
.c0x006f o
.c0x0070 p
.c0x0071 q
.c0x0072 r
.c0x0073 s
.c0x0074 t
.c0x0075 u
.c0x0076 v
.c0x0077 w
.c0x0078 x
.c0x0079 y
.c0x007a z
.c0x007b braceleft
.c0x007c bar
.c0x007d braceright
.c0x007e asciitilde
.c0x0080 Agrave
.c0x0081 Ahookabove
.c0x008d Abreveacute
.c0x008e Abrevegrave
.c0x008f Abrevehookabove
.c0x0090 Ecircumflexacute
.c0x009d Ohornacute
.c0x009e Ohorngrave
.c0x00a0 nbspace
.c0x00a1 abreveacute
.c0x00a2 abrevegrave
.c0x00a3 abrevehookabove
.c0x00a4 abrevetilde
.c0x00a5 abrevedotbelow
.c0x00a6 Ohorntilde
.c0x00a7 ohornacute
.c0x00a8 Ugrave
.c0x00a9 ohorngrave
.c0x00aa ohornhookabove
.c0x00ab ohorntilde
.c0x00ac Utilde
.c0x00ad Uhornacute
.c0x00ae ohorndotbelow
.c0x00af Uhorngrave
.c0x00b0 ocircumflexhookabove
.c0x00b1 Uhornhookabove
.c0x00b2 Ygrave
.c0x00b3 Ytilde
.c0x00b4 Iacute
.c0x00b5 Igrave
.c0x00b6 ocircumflexdotbelow
.c0x00b8 Itilde
.c0x00b9 Oacute
.c0x00ba uhornhookabove
.c0x00bb uhorntilde
.c0x00bc Ograve
.c0x00bd Ohookabove
.c0x00be Otilde
.c0x00bf uhorndotbelow
.c0x00c0 acircumflexgrave
.c0x00c1 Aacute
.c0x00c2 Acircumflex
.c0x00c3 acircumflexacute
.c0x00c4 acircumflexhookabove
.c0x00c5 acircumflextilde
.c0x00c6 acircumflexdotbelow
.c0x00c7 dbar
.c0x00c8 ehookabove
.c0x00c9 Eacute
.c0x00ca Ecircumflex
.c0x00cb edotbelow
.c0x00cc ihookabove
.c0x00cd ecircumflextilde
.c0x00ce idotbelow
.c0x00cf ytilde
.c0x00d0 Uhorn
.c0x00d1 Uhookabove
.c0x00d2 ocircumflexgrave
.c0x00d3 ocircumflexacute
.c0x00d4 Ocircumflex
.c0x00d5 ohookabove
.c0x00d6 ohorn
.c0x00d7 Egrave
.c0x00d8 uhorngrave
.c0x00d9 uhornacute
.c0x00da Uacute
.c0x00db utilde
.c0x00dc uhorn
.c0x00dd Yacute
.c0x00de Ehookabove
.c0x00df germandbls
.c0x00e0 agrave
.c0x00e1 aacute
.c0x00e2 acircumflex
.c0x00e3 atilde
.c0x00e4 ahookabove
.c0x00e5 adotbelow
.c0x00e6 abreve
.c0x00e7 ccedilla
.c0x00e8 egrave
.c0x00e9 eacute
.c0x00ea ecircumflex
.c0x00eb etilde
.c0x00ec igrave
.c0x00ed iacute
.c0x00ee icircumflex
.c0x00ef itilde
.c0x00f0 Abrevetilde
.c0x00f1 Dbar
.c0x00f2 ograve
.c0x00f3 oacute
.c0x00f4 ocircumflex
.c0x00f5 otilde
.c0x00f6 odieresis
.c0x00f7 Ohorn
.c0x00f8 udotbelow
.c0x00f9 ugrave
.c0x00fa uacute
.c0x00fb uhookabove
.c0x00fc udieresis
.c0x00fd Yhookabove
.c0x00fe Etilde
.c0x00ff ygrave
.c0x0152 ecircumflexdotbelow
.c0x0153 ydotbelow
.c0x0160 ecircumflexgrave
.c0x0161 yacute
.c0x0178 Ohornhookabove
.c0x0192 Acircumflexacute
.c0x02c6 Abreve
.c0x02dc Ocircumflexhookabove
.c0x2013 Ocircumflexacute
.c0x2014 Ocircumflexgrave
.c0x2018 quoteleft
.c0x2019 quoteright
.c0x201a Atilde
.c0x201c Ecircumflexgrave
.c0x201d Ecircumflexhookabove
.c0x201e Acircumflexgrave
.c0x2020 odotbelow
.c0x2021 ocircumflextilde
.c0x2022 Ecircumflextilde
.c0x2026 Acircumflexhookabove
.c0x2030 ecircumflexacute
.c0x2039 ecircumflexhookabove
.c0x203a yhookabove
.c0x2122 Ocircumflextilde
.c0x2219 Ihookabove
% eof

View File

@@ -0,0 +1,18 @@
% These entries are just examples!
arials arial.ttf Slant=0.25
arial arial.ttf Slant=0 Extend=1 Pid = 1 Eid = 0
arialx arial.ttf Slant=0 Extend=1.5
times times.ttf Encoding=T1-WGL4.enc \
.g0xc7=ring .g0xc9=caron .g0xc4=dotlessi
times95 times95.ttf Encoding=T1-WGL4.enc
ntukai@Big5@ ntu_kai.ttf Pid = 3 Eid = 4
cyberb@Unicode@ cyberbit.ttf
% the next entry maps the Unicode encoded font to Big 5 encoding; thus you
% can say \begin{CJK}{Big5}{...} (this is an environment from the CJK
% package for LaTeX).
mingli@UBig5@ mingliu.ttc Fontindex = 0

334
contrib/ttf2pk/dvidrv.btm Normal file
View File

@@ -0,0 +1,334 @@
::
:: This is dvidrv.btm, a batch file for 4DOS/4OS2 written by
:: Werner Lemberg <wl@gnu.org> partially based on the
:: dvidrv.btm file of the 4allTeX package written by Phons Bloemen.
::
:: It is a replacement for dvidrv.exe of the emTeX package.
::
:: Additional features: support of ps2pk
:: support of ttf2pk
:: support of hbf2gf for HBFs (Hanzi bitmap fonts)
::
:: Only quadratic printer modes are supported for ttf2pk!
::
:: All needed binaries will be searched in the path.
iff %# lt 2 then
echo ``
echo Usage: %0 dvi-driver dvi-file [parameters]
quit
endiff
setlocal
:: we set a default value only if the corresponding environment variable
:: is empty. The `=' must follow the variable name immediately.
alias set_def `iff "%[%@word["=",0,%1]]" eq "" then %+ set %& %+ endiff`
:: =========================================
:: ======== User defined variables. ========
:: =========================================
::
:: Can be overridden in the environment (except %ps2pk, %ttf2pk, %hbf2gf,
:: %pre_dpi, and %post_dpi).
:: Set these values to `no' for the programs you don't want to use.
set ps2pk=yes
set ttf2pk=yes
set hbf2gf=yes
:: where the PK files will be installed created by ps2pk, ttf2pk, and
:: hbf2gf.
:: dvidrv.btm adds `\modeless\XXXdpi' to this string (see below for the
:: exact string).
set_def pkdir=%emtexdir\pixel\tmp\pk
:: where the TrueType fonts reside. Supports trailing `!' and `!!'.
set_def ttfonts=%emtexdir\fonts\truetype
:: where auxiliary files of ttf2pk are located. Supports trailing `!'
:: and `!!'.
set_def ttfcfg=%emtexdir\ttf2pk
:: where the HBF files reside. Supports trailing `!' and `!!'.
set_def hbfonts=%emtexdir\fonts\hbf
:: where the hbf2gf config files are. Supports trailing `!' and `!!'.
set_def hbfcfg=%emtexdir\hbf2gf
:: the dpi-subdirectory has various forms; the most common are XXXdpi and
:: dpiXXX, e.g. 300dpi and dpi300. Here we define two variables which
:: control this behaviour.
:: [dpiXXX is used for TDS compatible TeX trees.]
set pre_dpi=dpi
set post_dpi=
:: ================================================
:: ======== End of user defined variables. ========
:: ================================================
:: the base name for log files etc.
set basename=%@name[%1]
:: do we run dvips?
iff "%basename" ne "dvips" then
goto nodvips1
endiff
:: we delete dvips.mfj if it exists.
del dvips.mfj >& nul
:: now we run dvips with all supplied parameters.
%&
:: do we have to generate fonts?
iff exist dvips.mfj then
goto generate_fonts
endiff
:: else all is done.
goto end
:nodvips1
:: here we call the dvi driver with all supplied parameters.
%& -pj:%basename.mfj
:: do we have to generate fonts?
iff errorlevel 8 then
goto generate_fonts
endiff
:: else all is done.
goto end
:generate_fonts
gosub call_mfjob
:: do we run dvips?
iff "%basename" ne "dvips" then
goto nodvips2
endiff
:: we now call dvips a second time
%&
:: since no fonts will be generated in the second run we remove dvips.mfj
del dvips.mfj >& nul
goto end
:nodvips2
:: we call the dvi driver a second time (without font generation).
%& -pj -fm
del %basename.mfj >& nul
goto end
:: this is the main subroutine which calls mfjob and then parses the mfjob
:: file for fonts which can be handled by ps2pk, ttf2pk, or hbf2gf.
:call_mfjob
:: this alias prints a message on the screen and writes it into the logfile.
alias echolog=`echo %& | tee /a %basename.mlg`
echo ======== DVIDRV.BTM logfile ======== > %basename.mlg
echo Commandline: dvidrv.btm %& >> %basename.mlg
echo `` >> %basename.mlg
echo basename=%basename >> %basename.mlg
echo emtexdir=%emtexdir >> %basename.mlg
echo dvidrvfonts=%dvidrvfonts >> %basename.mlg
echo mfinput=%mfinput >> %basename.mlg
echo mfjobopt=%mfjobopt >> %basename.mlg
echo textfm=%textfm >> %basename.mlg
echo psfonts=%psfonts >> %basename.mlg
echo ttfonts=%ttfonts >> %basename.mlg
echo ttfcfg=%ttfcfg >> %basename.mlg
echo hbfonts=%hbfonts >> %basename.mlg
echo hbfcfg=%hbfcfg >> %basename.mlg
echo `` >> %basename.mlg
iff "%@search[mfjob]" eq "" then
echolog MFJOB not found in the path.
echolog Can't generate PK fonts from METAFONT automatically.
echo ``
quit
endiff
:: now we call mfjob.
echolog mfjob %mfjobopt -g%basename.mfl %basename.mfj
mfjob %mfjobopt -g%basename.mfl %basename.mfj
iff %? gt 0 then
echolog ``
echolog Something went wrong while running METAFONT.
echolog Look into the log files...
echolog ``
endiff
:: after running mfjob we scan the mfjob input file for fonts which can
:: be handled by ps2pk, ttf2pk, or hbf2gf.
set lnnr=0
set totlines=%@lines[%basename.mfj]
do while %lnnr le %totlines
:: input a line.
set scratch=%@line[%basename.mfj,%lnnr]
set lnnr=%@inc[%lnnr]
:: get resolutions (METAFONT mode will be ignored).
:: example:
:: mode=lqlores[180 180];
iff %@index[%scratch,mode] ge 0 then
set temp=%@word["[]",1,%scratch]
set xdpi=%@word[0,%temp]
set ydpi=%@word[1,%temp]
endiff
:: get fontname and magnification; we then compute the font resolutions
:: (rounded to the nearest integer---there is no necessity to adjust
:: these values further because of possible rounding errors since both
:: emTeX's dvi drivers and dvips check neighbored values too).
:: example:
:: {font=cmr10; mag=0.5;}
iff %@index[%scratch,{font] ge 0 then
set testfont=%@word["=;",1,%scratch]
set temp=%@word["=;",3,%scratch]
:: we use highest arithmetic precision for these calculations.
:: Additionally we write 1/2 instead of 0.5 to avoid problems with
:: countries which use a comma instead of a colon as the decimal
:: separator.
set fontresx=%@int[%@eval[%xdpi*%temp+1/2=8]]
set fontresy=%@int[%@eval[%ydpi*%temp+1/2=8]]
set pksubdir=modeless\%[pre_dpi]%[fontresx]%post_dpi
set success=0
:: check whether %testfont leads to a PS font (we call ps2pkmfj).
iff %success == 0 .and. "%ps2pk" eq "yes" then
gosub call_ps2pk
endiff
:: check whether %testfont leads to a TrueType font.
iff %success == 0 .and. "%ttf2pk" eq "yes" then
gosub call_ttf2pk
endiff
:: check whether %testfont leads to a HBF file.
iff %success == 0 .and. "%hbf2gf" eq "yes" then
gosub call_hbf2gf
endiff
endiff
enddo
iff exist %basename.mfp then
echo `` >> %basename.mlg
echo `` >> %basename.mlg
echo ======== PS2PK logfile ======== >> %basename.mlg
echo `` >> %basename.mlg
type %basename.mfp >> %basename.mlg
echo `` >> %basename.mlg
del %basename.mfp >& nul
endiff
iff exist %basename.mfl then
echo `` >> %basename.mlg
type %basename.mfl >> %basename.mlg
echo `` >> %basename.mlg
del %basename.mfl >& nul
endiff
return
:call_ttf2pk
iff "%@search[ttf2pk]" eq "" then
echolog TTF2PK not found in the path.
echolog Can't generate PK fonts from TrueType fonts automatically.
echo ``
quit
endiff
echolog ttf2pk -q -n %testfont %fontresx
ttf2pk -q -n %testfont %fontresx
iff %? == 0 then
echolog Font %pkdir\%pksubdir\%testfont.pk generated.
mkdir /s %pkdir\%pksubdir >& nul
move %testfont.pk %pkdir\%pksubdir >& nul
set success=1
elseiff %? == 2 then
echolog (%lnnr/%totlines): Font %testfont is no TrueType font.
set success=0
else
echolog Error running TTF2PK for font %testfont!
endiff
return
:call_hbf2gf
iff "%@search[hbf2gf]" eq "" then
echolog HBF2GF not found in the path.
echolog Can't generate PK fonts from HBF files automatically.
echo ``
quit
endiff
echolog hbf2gf -q -p -n %testfont %fontresx %fontresy
hbf2gf -q -p -n %testfont %fontresx %fontresy
iff %? == 0 then
echolog Font %pkdir\%pksubdir\%testfont.pk generated.
mkdir /s %pkdir\%pksubdir >& nul
gftopk %testfont.gf %testfont.pk
move %testfont.pk %pkdir\%pksubdir >& nul
del %testfont.gf >& nul
set success=1
elseiff %? == 2 then
echolog (%lnnr/%totlines): Font %testfont is no HBF.
set success=0
else
echolog Error running HBF2GF for font %testfont!
endiff
return
:call_ps2pk
iff not exist %pkdir\%pksubdir\%testfont.pk then
iff "%@search[ps2pkmfj]" eq "" .or. "%@search[ps2pk]" eq "" then
echolog PS2PKMFJ and/or PS2PK not found in the path.
echolog Can't generate PK fonts from PostScript fonts automatically.
echo ``
quit
endiff
echolog ps2pkmfj -X%fontresx -Y%fontresy %testfont %testfont.pk
ps2pkmfj -X%fontresx -Y%fontresy %testfont %testfont.pk | input %%pspkline
iff errorlevel != 1 then
%pspkline >> %basename.mfp
iff %? == 0 then
echolog Font %pkdir\%pksubdir\%testfont.pk generated.
mkdir /s %pkdir\%pksubdir >& nul
move %testfont.pk %pkdir\%pksubdir >& nul
success=1
else
echolog Error running PS2PK for font %testfont!
endiff
else
echolog (%lnnr/%totlines): Font %testfont is no PS font.
success=0
endiff
else
echolog Font %pkdir\%pksubdir\%testfont.pk already exists.
endiff
return
:end
endlocal
:: ==== end of dvidrv.btm ====

56
contrib/ttf2pk/dvidrv.doc Normal file
View File

@@ -0,0 +1,56 @@
Using dvidrv.btm [emTeX for DOS and OS/2]
-------------------------------------------
This batch file does the same as MakeTeXPK does; it is a replacement for
dvidrv.exe of emTeX which can handle ttf2pk, hbf2gf, and ps2pk additionally
(the ps2pk part is untested yet; it uses ps2pkmfj of the 4allTeX
distribution and was basically copied from a similar script, also part of
4allTeX).
First of all, create and install a set of TFM files as described in the
previous section.
Then configure the following variables in dvidrv.btm:
ps2pk ... set it to `yes' if you want to use this program
ttf2pk ... ditto
hbf2gf ... ditto
pkdir ... the place where PK files created by ps2pk, ttf2pk,
or hbf2gf should go to. dvidrv.btm adds
`\modeless\XXXdpi' resp. `\modeless\dpiXXX' to this
string (depending on the variables `pre_dpi' and
`post_dpi')
ttfonts ... where the TrueType fonts files reside
ttfcfg ... where the auxiliary data files of ttf2pk reside
hbfonts ... where the HBF files reside
hbfcfg ... the place where the hbf2gf configuration files are
The last four variables in the above list support trailing `!' and `!!' for
recursive directory searching (see the dvidrv.doc of the emTeX package for
details).
Alternatively, you can set these variables in the environment; please note
that no spaces are allowed before and after the equal sign, e.g.
set foo=bar
is OK, but
set foo = bar
will fail.
Rename dvidrv.exe to dvidrv.ori or something similar and copy dvidrv.btm to
a directory in the path.
Don't forget to update the DVIDRVFONTS and TEXTFM environment variables if
necessary.
Under OS/2 dvips will call mfjob or hbf2gf itself; under DOS it will create
a batch file which must be called afterwards.
--- end of dvidrv.doc ---

109
contrib/ttf2pk/emdir.c Normal file
View File

@@ -0,0 +1,109 @@
/* emdir.c -- Written by Eberhard Mattes, donated to the public domain */
#include "emdir.h"
#ifdef OS2
#undef HPS
#define INCL_DOSFILEMGR
#include <os2.h>
#include <string.h>
#define FHDIR(b) (*(HDIR *)(b)->reserved)
static void fconv (struct ll_findbuffer *dst, const FILEFINDBUF *src)
{
dst->attr = src->attrFile;
dst->time = *(unsigned *)&src->ftimeLastWrite;
dst->date = *(unsigned *)&src->fdateLastWrite;
dst->size = src->cbFile;
strcpy (dst->name, src->achName);
}
int ll_findfirst (const char *path, int attr, struct ll_findbuffer *buffer)
{
USHORT rc;
ULONG count;
HDIR hdir;
FILEFINDBUF ffbuf;
hdir = HDIR_CREATE;
count = 1;
rc = DosFindFirst ((PSZ)path, &hdir, attr, &ffbuf, sizeof (ffbuf),
&count, 0L);
if (rc != 0 || count != 1)
return 0;
FHDIR (buffer) = hdir;
fconv (buffer, &ffbuf);
return 1;
}
int ll_findnext (struct ll_findbuffer *buffer)
{
USHORT rc;
ULONG count;
HDIR hdir;
FILEFINDBUF ffbuf;
hdir = FHDIR (buffer);
count = 1;
rc = DosFindNext (hdir, &ffbuf, sizeof (ffbuf), &count);
if (rc != 0 || count != 1)
{
DosFindClose (hdir);
return 0;
}
fconv (buffer, &ffbuf);
return 1;
}
#elif defined(DJGPP)
/* djgpp support by Hartmut Schirmer (hsc@techfak.uni-kiel.de), May 30, 1997 */
#include <dos.h>
#include <dir.h>
static int ll_attr = 0;
int ll_findnext (struct ll_findbuffer *buffer)
{
int res;
do {
res = _dos_findnext ((struct find_t *)buffer);
if (res != 0) return 0;
} while ( (buffer->attrib&ll_attr) == 0);
return 1;
}
int ll_findfirst (const char *path, int attr, struct ll_findbuffer *buffer)
{
int res;
ll_attr = attr;
res = _dos_findfirst((char *)path, attr, (struct find_t *)buffer);
if (res != 0) return 0;
if ( (buffer->attrib&ll_attr) == 0)
return ll_findnext(buffer);
return 1;
}
#elif !defined(__EMX__) /* if not OS2 nor DJGPP nor __EMX__ defined */
/* Not tested */
#include <dos.h>
int ll_findfirst (const char *path, int attr, struct ll_findbuffer *buffer)
{
return _dos_findfirst (path, attr, (struct find_t *)buffer) == 0;
}
int ll_findnext (struct ll_findbuffer *buffer)
{
return _dos_findnext ((struct find_t *)buffer) == 0;
}
#endif

25
contrib/ttf2pk/emdir.h Normal file
View File

@@ -0,0 +1,25 @@
/* emdir.h -- Written by Eberhard Mattes, donated to the public domain */
#if defined(DJGPP)
/* djgpp support by Hartmut Schirmer (hsc@techfak.uni-kiel.de), May 30, 1997 */
#include <dos.h>
#define ll_findbuffer find_t
#define attr attrib
#else
struct ll_findbuffer
{
char reserved[21];
unsigned char attr;
unsigned time;
unsigned date;
long size;
char name[257];
};
#endif
int ll_findfirst (const char *path, int attr, struct ll_findbuffer *buffer);
int ll_findnext (struct ll_findbuffer *buffer);

405
contrib/ttf2pk/emtexdir.c Normal file
View File

@@ -0,0 +1,405 @@
/* emtexdir.c -- written by Eberhard Mattes, donated to the public domain */
#if defined (__EMX__)
#include <emx/syscalls.h>
#else
#include "emdir.h"
#endif
#if defined(DJGPP) || defined(GO32)
#include <unistd.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <io.h>
#include "emtexdir.h"
#define FALSE 0
#define TRUE 1
void (*emtex_dir_find_callback)(const char *name, int ok) = NULL;
static int setup_add (struct emtex_dir *dst, const char *path)
{
char *p;
if (dst->used >= dst->alloc)
{
dst->alloc += 8;
dst->list = realloc (dst->list, dst->alloc * sizeof (*dst->list));
if (dst->list == NULL)
return (FALSE);
}
p = strdup (path);
if (p == NULL)
return (FALSE);
dst->list[dst->used++] = p;
return (TRUE);
}
static int setup_subdir (struct emtex_dir *dst, char *path, size_t add,
unsigned flags, int recurse)
{
int ok, i, end, len;
#if defined (__EMX__)
struct _find find;
#else
struct ll_findbuffer find;
#endif
i = dst->used;
strcpy (path + add, "*.*");
#if defined (__EMX__)
ok = __findfirst (path, 0x10, &find) == 0;
#else
ok = ll_findfirst (path, 0x10, &find);
#endif
while (ok)
{
if ((find.attr & 0x10)
&& !(strcmp (find.name, ".") == 0 || strcmp (find.name, "..") == 0))
{
len = strlen (find.name);
memcpy (path + add, find.name, len);
path[add+len] = '\\';
path[add+len+1] = 0;
if (!setup_add (dst, path))
return (FALSE);
}
#if defined (__EMX__)
ok = __findnext (&find) == 0;
#else
ok = ll_findnext (&find);
#endif
}
if (recurse)
{
end = dst->used;
while (i < end)
{
strcpy (path, dst->list[i]);
if (!setup_subdir (dst, path, strlen (path), flags, TRUE))
return (FALSE);
++i;
}
}
return (TRUE);
}
static int setup_dir (struct emtex_dir *dst, char *path,
const char *base_dir, size_t base_dir_len,
const char *sub_dir,
unsigned flags)
{
size_t i, len;
memcpy (path, base_dir, base_dir_len);
i = base_dir_len;
if ((flags & EDS_BANG) && sub_dir == NULL)
{
flags &= ~(EDS_ONESUBDIR|EDS_ALLSUBDIR);
if (i >= 2 && path[i-1] == '!' && path[i-2] == '!')
{
flags |= EDS_ALLSUBDIR;
i -= 2;
}
else if (i >= 1 && path[i-1] == '!')
{
flags |= EDS_ONESUBDIR;
--i;
}
}
if (sub_dir != NULL && *sub_dir != 0)
{
if (i != 0 && path[i-1] != ':' && path[i-1] != '/' && path[i-1] != '\\')
path[i++] = '\\';
len = strlen (sub_dir);
memcpy (path+i, sub_dir, len);
i += len;
}
if (path[i-1] != ':' && path[i-1] != '/' && path[i-1] != '\\')
path[i++] = '\\';
path[i] = 0;
if (!setup_add (dst, path))
return (FALSE);
if (flags & EDS_ALLSUBDIR)
return (setup_subdir (dst, path, i, flags, TRUE));
else if (flags & EDS_ONESUBDIR)
return (setup_subdir (dst, path, i, flags, FALSE));
else
return (TRUE);
}
/*static */int setup_list (struct emtex_dir *dst, char *path,
const char *list, unsigned flags)
{
const char *end;
size_t i;
for (;;)
{
while (*list == ' ' || *list == '\t')
++list;
if (*list == 0)
return (TRUE);
end = list;
while (*end != 0 && *end != ';')
++end;
i = end - list;
while (i > 0 && (list[i-1] == ' ' || list[i-1] == '\t'))
--i;
if (i != 0 && !setup_dir (dst, path, list, i, NULL, flags))
return (FALSE);
if (*end == 0)
return (TRUE);
list = end + 1;
}
}
int emtex_dir_setup (struct emtex_dir *ed, const char *env, const char *dir,
unsigned flags)
{
const char *val;
char path[260];
ed->alloc = 0;
ed->used = 0;
ed->list = NULL;
if (env != NULL && (val = getenv (env)) != NULL)
return (setup_list (ed, path, val, flags));
else if ((val = getenv ("EMTEXDIR")) != NULL)
return (setup_dir (ed, path, val, strlen (val), dir, flags));
else
return (setup_dir (ed, path, "\\emtex", 6, dir, flags));
}
static void pretty (char *path, unsigned flags)
{
char *p;
if (flags & EDF_FSLASH)
for (p = path; *p != 0; ++p)
if (*p == '\\')
*p = '/';
}
#define ADDCHAR(C) \
if (dst_size < 1) return (EDT_TOOLONG); \
*dst++ = (C); --dst_size
int emtex_dir_trunc (char *dst, size_t dst_size, const char *src,
unsigned flags, int method)
{
int len, truncated, dot;
if (src[0] != 0 && src[1] == ':')
{
ADDCHAR (src[0]);
ADDCHAR (src[1]);
src += 2;
}
truncated = FALSE; dot = FALSE; len = 0;
for (;;)
{
switch (*src)
{
case 0:
ADDCHAR (0);
return (truncated ? EDT_CHANGED : EDT_UNCHANGED);
case ':':
return (EDT_INVALID);
case '/':
case '\\':
ADDCHAR (*src);
len = 0; dot = FALSE;
break;
case '.':
if (dot)
return (EDT_INVALID);
ADDCHAR (*src);
/* ".." is allowed -- don't return EDT_INVALID for the next
dot. */
if (!(len == 0 && src[1] == '.'
&& (src[2] == 0 || src[2] == '/' || src[2] == '\\')))
{
len = 0; dot = TRUE;
}
break;
default:
if (dot && len == 3)
truncated = TRUE;
else if (!dot && len == 8)
{
truncated = TRUE;
if (method == 0)
{
dst[-3] = dst[-2];
dst[-2] = dst[-1];
dst[-1] = *src;
}
}
else
{
ADDCHAR (*src);
++len;
}
break;
}
++src;
}
}
static int find2 (const char *name, unsigned flags)
{
int ok;
ok = (access (name, 4) == 0);
if (flags & EDF_TRACE)
emtex_dir_find_callback (name, ok);
return (ok);
}
static int find1 (char *path, size_t path_size, const char *dir,
const char *fname, unsigned flags)
{
char buf[260];
int method, rc;
size_t len, tmp;
len = 0;
if (dir != NULL)
{
tmp = strlen (dir);
if (tmp >= sizeof (buf))
return (FALSE);
memcpy (buf, dir, tmp);
len = tmp;
}
tmp = strlen (fname);
if (len + tmp >= sizeof (buf))
return (FALSE);
memcpy (buf + len, fname, tmp + 1);
len += tmp;
#if 0 /* wkim */
/* disabled for Win95's long file name support */
/* -- Wonkoo Kim (wkim+@pitt.edu), May 18, 1997 */
if (_osmode == DOS_MODE)
{
rc = emtex_dir_trunc (path, path_size, buf, flags, EDT_5_PLUS_3);
if ((rc == EDT_UNCHANGED || rc == EDT_CHANGED) && find2 (path, flags))
{
pretty (path, flags);
return (TRUE);
}
rc = emtex_dir_trunc (path, path_size, buf, flags, EDT_8);
if (rc == EDT_CHANGED && find2 (path, flags))
{
pretty (path, flags);
return (TRUE);
}
return (FALSE);
}
else
#endif /* wkim */
{
if (len < path_size && find2 (buf, flags))
{
memcpy (path, buf, len + 1);
pretty (path, flags);
return (TRUE);
}
for (method = 0; method < 2; ++method)
{
rc = emtex_dir_trunc (path, path_size, buf, flags, method);
if (rc == EDT_CHANGED && find2 (path, flags))
{
pretty (path, flags);
return (TRUE);
}
}
return (FALSE);
}
}
int emtex_dir_find (char *path, size_t path_size,
const struct emtex_dir *ed,
const char *fname, unsigned flags)
{
int i, absp;
const char *p;
absp = FALSE;
for (p = fname; *p != 0; ++p)
if (*p == ':' || *p == '/' || *p == '\\')
{
absp = TRUE;
break;
}
if (absp)
return (find1 (path, path_size, NULL, fname, flags));
if ((flags & EDF_CWD) && find1 (path, path_size, NULL, fname, flags))
return (TRUE);
for (i = 0; i < ed->used; ++i)
if (find1 (path, path_size, ed->list[i], fname, flags))
return (TRUE);
return (FALSE);
}
#if defined (TEST)
#include <stdio.h>
int main (int argc, char *argv[])
{
struct emtex_dir ed;
int i;
unsigned flags1, flags2;
char path[260];
if (argc != 6)
{
puts ("Usage: emtexdir <flags> <flags> <env> <dir> <fname>");
return (1);
}
flags1 = (unsigned)strtol (argv[1], NULL, 0);
flags2 = (unsigned)strtol (argv[2], NULL, 0);
if (!emtex_dir_setup (&ed, argv[3], argv[4], flags1))
{
fputs ("emtex_dir_setup failed\n", stderr);
return (2);
}
printf ("Directories:\n");
for (i = 0; i < ed.used; ++i)
printf (" %s\n", ed.list[i]);
if (!emtex_dir_find (path, sizeof (path), &ed, argv[5], flags2))
puts ("File not found");
else
printf ("Path: %s\n", path);
return (0);
}
#endif

57
contrib/ttf2pk/emtexdir.h Normal file
View File

@@ -0,0 +1,57 @@
/* emtexdir.h -- written by Eberhard Mattes, donated to the public domain */
#if !defined (_EMTEXDIR_H)
#define _EMTEXDIR_H
#if defined (__cplusplus)
extern "C" {
#endif
/* Flags for emtex_dir_setup */
#define EDS_ONESUBDIR 0x0001
#define EDS_ALLSUBDIR 0x0002
#define EDS_BANG 0x0004
/* Flags for emtex_dir_find */
#define EDF_CWD 0x0001
#define EDF_FSLASH 0x0002
#define EDF_TRACE 0x8000
/* Methods for emtex_dir_trunc */
#define EDT_5_PLUS_3 0 /* 5+3.3 */
#define EDT_8 1 /* 8.3 */
/* Return values for emtex_dir_trunc */
#define EDT_UNCHANGED 0 /* Path name not changed */
#define EDT_CHANGED 1 /* Path name truncated */
#define EDT_TOOLONG 2 /* Path name too long */
#define EDT_INVALID 3 /* Path name invalid */
struct emtex_dir
{
char **list;
int used;
int alloc;
};
extern void (*emtex_dir_find_callback)(const char *name, int ok);
int emtex_dir_setup (struct emtex_dir *ed, const char *env, const char *dir,
unsigned flags);
int emtex_dir_find (char *path, size_t path_size, const struct emtex_dir *ed,
const char *fname, unsigned flags);
int emtex_dir_trunc (char *dst, size_t dst_size, const char *src,
unsigned flags, int method);
#if defined (__cplusplus)
}
#endif
#endif /* !defined (_EMTEXDIR_H) */

96
contrib/ttf2pk/errormsg.c Normal file
View File

@@ -0,0 +1,96 @@
/*
* errormsg.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#include <stdio.h>
#include <stddef.h> /* for size_t */
#include <stdarg.h>
#include <stdlib.h>
#include "errormsg.h"
extern char progname[]; /* the origin of the error/warning message */
/*
* Print error message and quit.
*/
void
oops(const char *message,
...)
{
va_list args;
va_start(args, message);
fprintf(stderr, "%s: ERROR: ", progname);
vfprintf(stderr, message, args);
va_end(args);
putc('\n', stderr);
exit(1);
}
/*
* Print error message, a buffer, a '^' at the buffer offset, and quit.
*/
void
boops(const char *buffer,
size_t offset,
const char *message,
...)
{
va_list args;
va_start(args, message);
fprintf(stderr, "%s: ERROR: ", progname);
vfprintf(stderr, message, args);
va_end(args);
putc('\n', stderr);
if (*buffer)
{
fprintf(stderr, "%s\n", buffer);
while (offset)
{
fprintf(stderr, " ");
offset--;
}
fprintf(stderr, "^\n");
}
exit(1);
}
/*
* Print warning message and continue.
*/
void
warning(const char *message,
...)
{
va_list args;
va_start(args, message);
fprintf(stderr, "%s: WARNING: ", progname);
vfprintf(stderr, message, args);
va_end(args);
putc('\n', stderr);
}
/* end */

43
contrib/ttf2pk/errormsg.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* errormsg.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef ERRORMSG_H
#define ERRORMSG_H
/*
Disable some annoying warnings when you compile with -W3. Namely the
warnings about missing __cdecl specifiers at some places where they are
not really needed because the compiler can generate them.
This is relevant only if you compile with -Gr option, i.e., use fastcall
calling convention.
This is needed for fpTeX.
*/
#ifdef WIN32
#pragma warning (disable : 4007 4096)
#endif
void oops(const char *message,
...);
void boops(const char *buffer,
size_t offset,
const char *message,
...);
void warning(const char *message,
...);
#endif /* ERRORMSG_H */
/* end */

602
contrib/ttf2pk/filesrch.c Normal file
View File

@@ -0,0 +1,602 @@
/*
* filesrch.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
/*
* Interface to the system specific TeX file search routines.
*/
#include <stddef.h> /* for size_t */
#include <stdlib.h>
#include <string.h>
#include "filesrch.h"
#include "newobj.h"
/****************************
* kpathsea library support *
****************************/
#if defined(HAVE_LIBKPATHSEA)
#ifdef VERY_OLD_KPATHSEA
#include "kpathsea/proginit.h"
#include "kpathsea/progname.h"
#include "kpathsea/tex-glyph.h"
#else
#include "kpathsea/kpathsea.h"
#endif
#ifdef KPSEDLL
/* this is kpathsea 3.3 and newer */
extern KPSEDLL char *kpathsea_version_string;
#else
extern DllImport char *kpathsea_version_string;
#endif
/*
* Initialize kpathsea library; arguments are the full name of the
* executable (e.g. `/usr/bin/ttf2pk') and two identification strings;
* the former for the program itself (to have texmf.cnf constructs like
* `TFMFONTS.ttf2pk'), the latter for the environment (to have environment
* constructs like `TTF2PKMAKEPK').
*/
void
TeX_search_init(char *exec_name,
char *program_identifier,
char *env_identifier)
{
#ifdef OLD_KPATHSEA
kpse_set_progname(exec_name);
#else
kpse_set_program_name(exec_name, program_identifier);
#endif
#ifdef VERY_OLD_KPATHSEA
kpse_init_prog(env_identifier, 300, "cx", true, "cmr10");
#else
kpse_init_prog(env_identifier, 300, "cx", "cmr10");
#endif
}
char *
TeX_search_version(void)
{
return kpathsea_version_string;
}
char *
TeX_search_tfm(char **name)
{
/* no extra extension handling necessary */
return kpse_find_file(*name, kpse_tfm_format, True);
}
char *
TeX_search_encoding_file(char **name)
{
handle_extension(name, ".enc");
#ifdef OLD_KPATHSEA
#ifdef VERY_OLD_KPATHSEA
return kpse_find_file(*name, kpse_dvips_header_format, True);
#else
return kpse_find_file(*name, kpse_tex_ps_header_format, True);
#endif
#else
return kpse_find_file(*name, kpse_program_text_format, True);
#endif
}
char *
TeX_search_replacement_file(char **name)
{
handle_extension(name, ".rpl");
#ifdef OLD_KPATHSEA
#ifdef VERY_OLD_KPATHSEA
return kpse_find_file(*name, kpse_dvips_header_format, True);
#else
return kpse_find_file(*name, kpse_tex_ps_header_format, True);
#endif
#else
return kpse_find_file(*name, kpse_program_text_format, True);
#endif
}
char *
TeX_search_sfd_file(char **name)
{
handle_extension(name, ".sfd");
#ifdef OLD_KPATHSEA
#ifdef VERY_OLD_KPATHSEA
return kpse_find_file(*name, kpse_dvips_header_format, True);
#else
return kpse_find_file(*name, kpse_tex_ps_header_format, True);
#endif
#else
return kpse_find_file(*name, kpse_program_text_format, True);
#endif
}
char *
TeX_search_config_file(char **name)
{
/* no extra extension handling necessary */
#ifdef OLD_KPATHSEA
return kpse_find_file(*name, kpse_dvips_config_format, True);
#else
return kpse_find_file(*name, kpse_program_text_format, True);
#endif
}
char *
TeX_search_ttf_file(char **name)
{
#ifdef OLD_KPATHSEA
size_t l;
char* real_name;
l = strlen(*name);
handle_extension(name, ".ttf");
#ifdef VERY_OLD_KPATHSEA
real_name = kpse_find_file(*name, kpse_dvips_header_format, True);
#else
real_name = kpse_find_file(*name, kpse_type1_format, True);
#endif
/* test for .ttc, but only if no extension was given initially */
if (!real_name && l != strlen(*name))
{
(*name)[strlen(*name) - 1] = 'c';
#ifdef VERY_OLD_KPATHSEA
real_name = kpse_find_file(*name, kpse_dvips_header_format, True);
#else
real_name = kpse_find_file(*name, kpse_type1_format, True);
#endif
}
return real_name;
#else /* OLD_KPATHSEA */
/* no extra extension handling necessary */
return kpse_find_file(*name, kpse_truetype_format, True);
#endif
}
/****************************
* emtexdir library support *
****************************/
#elif defined(HAVE_EMTEXDIR)
#include "emtexdir.h"
#include "errormsg.h"
extern int setup_list(struct emtex_dir *dst, char *path,
const char *list, unsigned flags);
char emtex_version_string[] = "emTeXdir";
struct emtex_dir tfm_path,
enc_path,
rpl_path,
sfd_path,
cfg_path,
ttf_path;
/*
* We slightly modify emtex_dir_setup() to output a warning in case
* the environment variable isn't set properly.
*/
static int
dir_setup(struct emtex_dir *ed,
const char *env,
const char *dir,
unsigned flags)
{
const char *val;
char path[260];
ed->alloc = 0;
ed->used = 0;
ed->list = NULL;
if (env != NULL && (val = getenv(env)) != NULL)
return setup_list(ed, path, val, flags);
else
warning("Environment variable %s not set; use current directory.", env);
return True;
}
static char *
file_find(char *name, struct emtex_dir *list)
{
char buffer[1024];
if (emtex_dir_find(buffer, sizeof (buffer), list, name, EDF_CWD))
return newstring(buffer);
return NULL;
}
/*
* Initialize emtexdir library; arguments are the full name of the
* executable (e.g. `c:\bin\ttf2pk.exe') and two identification strings;
* the former for the program itself, the latter for the environment.
* We ignore all of them.
*/
void
TeX_search_init(char *exec_name,
char *program_identifier,
char *env_identifier)
{
if (!dir_setup(&tfm_path, "TEXTFM", NULL, EDS_BANG))
oops("Cannot setup search path for tfm files");
if (!dir_setup(&enc_path, "TTFCFG", NULL, EDS_BANG))
oops("Cannot setup search path for encoding files");
#if 0
if (!dir_setup(&rpl_path, "TTFCFG", NULL, EDS_BANG))
oops("Cannot setup search path for replacement files");
if (!dir_setup(&sfd_path, "TTFCFG", NULL, EDS_BANG))
oops("Cannot setup search path for subfont definition files");
if (!dir_setup(&cfg_path, "TTFCFG", NULL, EDS_BANG))
oops("Cannot setup search path for configuration file");
#else
rpl_path = sfd_path = cfg_path = enc_path;
#endif
if (!dir_setup(&ttf_path, "TTFONTS", NULL, EDS_BANG))
oops("Cannot setup search path for TrueType font files");
}
char *
TeX_search_version(void)
{
return emtex_version_string;
}
char *
TeX_search_tfm(char **name)
{
handle_extension(name, ".tfm");
return file_find(*name, &tfm_path);
}
char *
TeX_search_encoding_file(char **name)
{
handle_extension(name, ".enc");
return file_find(*name, &enc_path);
}
char *
TeX_search_replacement_file(char **name)
{
handle_extension(name, ".rpl");
return file_find(*name, &rpl_path);
}
char *
TeX_search_sfd_file(char **name)
{
handle_extension(name, ".sfd");
return file_find(*name, &sfd_path);
}
char *
TeX_search_config_file(char **name)
{
/* no extra extension handling necessary */
return file_find(*name, &cfg_path);
}
char *
TeX_search_ttf_file(char **name)
{
size_t l;
char* real_name;
l = strlen(*name);
handle_extension(name, ".ttf");
real_name = file_find(*name, &ttf_path);
/* test for .ttc, but only if no extension was given initially */
if (!real_name && l != strlen(*name))
{
(*name)[strlen(*name) - 1] = 'c';
real_name = file_find(*name, &ttf_path);
}
return real_name;
}
/**************************
* MiKTeX library support *
**************************/
#elif defined(MIKTEX)
#include "miktex.h"
void
TeX_search_init(char *exec_name,
char *program_identifier,
char *env_identifier)
{
/* empty */
}
char *
TeX_search_version(void)
{
char buf[200];
strcpy(buf, "MiKTeX ");
miktex_get_miktex_version_string_ex(buf + 7, sizeof (buf) - 7);
return buf;
}
char *
TeX_search_tfm(char **name)
{
char result[_MAX_PATH];
if (!miktex_find_tfm_file(*name, result))
return 0;
return strdup(result);
}
char *
TeX_search_encoding_file(char **name)
{
char result[_MAX_PATH];
if (!miktex_find_enc_file(*name, result))
return 0;
return strdup(result);
}
char *
TeX_search_replacement_file(char **name)
{
char result[_MAX_PATH];
handle_extension(name, ".rpl");
if (!miktex_find_input_file("ttf2tfm", *name, result))
return 0;
return strdup(result);
}
char *
TeX_search_sfd_file(char **name)
{
char result[_MAX_PATH];
handle_extension(name, ".sfd");
if (!miktex_find_input_file("ttf2tfm", *name, result))
return 0;
return strdup(result);
}
char *
TeX_search_config_file(char **name)
{
char result[_MAX_PATH];
if (!miktex_find_input_file("ttf2tfm", *name, result))
return 0;
return strdup(result);
}
char *
TeX_search_ttf_file(char **name)
{
char result[_MAX_PATH];
if (!miktex_find_ttf_file(*name, result))
return 0;
return strdup(result);
}
/**********************
* no library support *
**********************/
#else
#include <stdio.h>
char version_string[] = "no search library";
void
TeX_search_init(char *exec_name,
char *program_identifier,
char *env_identifier)
{
/* empty */
}
char *
TeX_search_version(void)
{
return version_string;
}
char *
TeX_search_tfm(char **name)
{
handle_extension(name, ".tfm");
return *name;
}
char *
TeX_search_encoding_file(char **name)
{
handle_extension(name, ".enc");
return *name;
}
char *
TeX_search_replacement_file(char **name)
{
handle_extension(name, ".rpl");
return *name;
}
char *
TeX_search_sfd_file(char **name)
{
handle_extension(name, ".sfd");
return *name;
}
char *
TeX_search_config_file(char **name)
{
/* no extra extension handling necessary */
return *name;
}
/* we only handle .ttf extension */
char *
TeX_search_ttf_file(char **name)
{
handle_extension(name, ".ttf");
return *name;
}
#endif
void
get_tfm_fullname(Font *fnt)
{
size_t len = 0;
if (fnt->fullname)
free(fnt->fullname);
if (fnt->outname)
len += strlen(fnt->outname);
if (fnt->subfont_name)
len += strlen(fnt->subfont_name);
if (fnt->outname_postfix)
len += strlen(fnt->outname_postfix);
len++;
fnt->fullname = (char *)mymalloc(len);
fnt->fullname[0] = '\0';
if (fnt->outname)
strcat(fnt->fullname, fnt->outname);
if (fnt->subfont_name)
strcat(fnt->fullname, fnt->subfont_name);
if (fnt->outname_postfix)
strcat(fnt->fullname, fnt->outname_postfix);
}
/*
* This function takes the address of a pointer to a string allocated
* with malloc() and checks whether it has an extension. If not, a default
* extension given as a second argument will be appended using first
* realloc() and then strcat().
*
* '/', ':', and '\\' will be recognized as directory separators.
*/
void
handle_extension(char **stringp,
char *extension)
{
int i, lastext = -1;
for (i = 0; (*stringp)[i]; i++)
if ((*stringp)[i] == '.')
lastext = i;
else if ((*stringp)[i] == '/' ||
(*stringp)[i] == ':' ||
(*stringp)[i] == '\\')
lastext = -1;
if (lastext == -1)
{
*stringp = (char *)myrealloc((void *)*stringp,
strlen(*stringp) + strlen(extension) + 1);
strcat(*stringp, extension);
}
}
/* end */

51
contrib/ttf2pk/filesrch.h Normal file
View File

@@ -0,0 +1,51 @@
/*
* filesrch.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef FILESRCH_H
#define FILESRCH_H
#include "ttf2tfm.h"
/*
* Arguments are the full program name and two identification strings
* (for the program and the environment).
*/
void TeX_search_init(char *exec_name,
char *program_identifier,
char *env_identifier);
/*
* The next function returns a version string.
*/
char *TeX_search_version(void);
/*
* The following functions take a file name (either relative or absolute),
* probably append a default extension, and return the complete path to the
* file.
*/
char *TeX_search_tfm(char **name);
char *TeX_search_encoding_file(char **name);
char *TeX_search_replacement_file(char **name);
char *TeX_search_sfd_file(char **name);
char *TeX_search_config_file(char **name);
char *TeX_search_ttf_file(char **name);
void get_tfm_fullname(Font *fnt);
void handle_extension(char **stringp,
char *extension);
#endif /* FILESRCH_H */
/* end */

275
contrib/ttf2pk/ligkern.c Normal file
View File

@@ -0,0 +1,275 @@
/*
* ligkern.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#include <string.h>
#include <stdlib.h>
#include <stddef.h> /* for size_t */
#include <ctype.h>
#include "ttf2tfm.h"
#include "ligkern.h"
#include "ttfenc.h"
#include "texenc.h"
#include "newobj.h"
#include "errormsg.h"
static char *
paramstring(char **curp)
{
register char *p, *q;
p = *curp;
while (*p && !isspace(*p))
p++;
q = *curp;
if (*p != '\0')
*p++ = '\0';
while (isspace(*p))
p++;
*curp = p;
return q;
}
/*
* Some routines to remove kerns that match certain patterns.
*/
static kern *
rmkernmatch(kern *k,
char *s)
{
kern *nk;
while (k && strcmp(k->succ, s) == 0)
k = k->next;
if (k)
{
for (nk = k; nk; nk = nk->next)
while (nk->next && strcmp(nk->next->succ, s) == 0)
nk->next = nk->next->next;
}
return k;
}
/*
* Recursive to one level.
*/
static void
rmkern(char *s1, char *s2,
ttfinfo *ti,
Font *fnt)
{
if (ti == NULL)
{
if (strcmp(s1, "*") == 0)
{
for (ti = fnt->charlist; ti; ti = ti->next)
rmkern(s1, s2, ti, fnt);
return;
}
else
{
ti = findadobe(s1, fnt->charlist);
if (ti == NULL)
return;
}
}
if (strcmp(s2, "*") == 0)
ti->kerns = NULL; /* drop them on the floor */
else
ti->kerns = rmkernmatch(ti->kerns, s2);
}
/*
* Make the kerning for character S1 equivalent to that for S2.
* If either S1 or S2 do not exist, do nothing.
* If S1 already has kerning, do nothing.
*/
static void
addkern(char *s1, char *s2,
Font *fnt)
{
ttfinfo *ti1 = findadobe(s1, fnt->charlist);
ttfinfo *ti2 = findadobe(s2, fnt->charlist);
if (ti1 && ti2 && !ti1->kerns)
{
/* Put the new one at the head of the list, since order is immaterial. */
ttfptr *ap = (ttfptr *)mymalloc(sizeof (ttfptr));
ap->next = ti2->kern_equivs;
ap->ch = ti1;
ti2->kern_equivs = ap;
}
}
/*
* Reads a ligkern line, if this is one. Assumes the first character
* passed is `%'.
*/
void
checkligkern(char *s, Font *fnt)
{
char *mlist[5];
char *os;
char *orig_s, *pos;
size_t offset[5];
int n;
os = newstring(s);
orig_s = s;
s++;
while (isspace(*s))
s++;
if (strncmp(s, "LIGKERN", 7) == 0)
{
fnt->sawligkern = True;
s += 7;
while (isspace(*s))
s++;
pos = s;
while (*pos)
{
for (n = 0; n < 5;)
{
if (*pos == '\0')
break;
offset[n] = pos - orig_s;
mlist[n] = paramstring(&pos);
if (strcmp(mlist[n], ";") == 0)
break;
n++;
}
if (n > 4)
boops(os, pos - orig_s, "Too many parameters in lig kern data.");
if (n < 3)
boops(os, pos - orig_s, "Too few parameters in lig kern data.");
if (n == 3 && strcmp(mlist[1], "{}") == 0) /* rmkern command */
rmkern(mlist[0], mlist[2], (ttfinfo *)0, fnt);
else if (n == 3 && strcmp(mlist[1], "<>") == 0) /* addkern */
addkern(mlist[0], mlist[2], fnt);
else if (n == 3 && strcmp(mlist[0], "||") == 0 &&
strcmp(mlist[1], "=") == 0) /* bc command */
{
ttfinfo *ti = findadobe("||", fnt->charlist);
if (fnt->boundarychar != -1)
boops(os, offset[0], "Multiple boundary character commands?");
if (sscanf(mlist[2], "%d", &n) != 1)
boops(os, offset[2],
"Expected number assignment for boundary char.");
if (n < 0 || n > 0xFF)
boops(os, offset[2], "Boundary character number must be 0..0xFF.");
fnt->boundarychar = n;
if (ti == NULL)
oops("Internal error: boundary char.");
ti->outcode = n; /* prime the pump, so to speak, for lig/kerns */
}
else if (n == 4)
{
int op = -1;
ttfinfo *ti;
for (n = 0; encligops[n]; n++)
if (strcmp(mlist[2], encligops[n]) == 0)
{
op = n;
break;
}
if (op < 0)
boops(os, offset[2], "Bad ligature op specified.");
if (NULL != (ti = findadobe(mlist[0], fnt->charlist)))
{
lig *lig;
if (findadobe(mlist[2], fnt->charlist))
/* remove coincident kerns */
rmkern(mlist[0], mlist[1], ti, fnt);
if (strcmp(mlist[3], "||") == 0)
boops(os, offset[3], "You can't lig to the boundary character!");
if (!fnt->fixedpitch) /* fixed pitch fonts get *0* ligs */
{
for (lig = ti->ligs; lig; lig = lig->next)
if (strcmp(lig->succ, mlist[1]) == 0)
break; /* we'll re-use this structure */
if (lig == NULL)
{
lig = newlig();
lig->succ = newstring(mlist[1]);
lig->next = ti->ligs;
ti->ligs = lig;
}
lig->sub = newstring(mlist[3]);
lig->op = op;
if (strcmp(mlist[1], "||") == 0)
{
lig->boundleft = 1;
if (strcmp(mlist[0], "||") == 0)
boops(os, offset[0],
"You can't lig boundarychar boundarychar!");
}
else
lig->boundleft = 0;
}
}
}
else
boops(os, offset[0], "Bad form in LIGKERN command.");
}
}
free(os);
}
void
getligkerndefaults(Font *fnt)
{
int i;
char *buffer;
for (i = 0; staticligkern[i]; i++)
{
buffer = newstring(staticligkern[i]);
checkligkern(buffer, fnt);
free(buffer);
}
}
/* end */

23
contrib/ttf2pk/ligkern.h Normal file
View File

@@ -0,0 +1,23 @@
/*
* ligkern.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef LIGKERN_H
#define LIGKERN_H
#include "ttf2tfm.h"
void checkligkern(char *s, Font *fnt);
void getligkerndefaults(Font *fnt);
#endif /* LIGKERN_H */
/* end */

352
contrib/ttf2pk/newobj.c Normal file
View File

@@ -0,0 +1,352 @@
/*
* newobj.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#include <stdlib.h>
#include <stddef.h> /* for size_t */
#include <string.h>
#include "newobj.h"
#include "ttf2tfm.h"
#include "errormsg.h"
#include "texenc.h"
void *
mymalloc(size_t len)
{
void *p;
#ifdef SMALLMALLOC
if (len > 65500L)
oops("Cannot allocate more than 64kByte.");
#endif
if (len)
p = malloc(len);
else
p = malloc(1);
if (p == NULL)
oops("Out of memory.");
return p;
}
void *
myrealloc(void *oldp, size_t len)
{
void *p;
#ifdef SMALLMALLOC
if (len > 65500L)
oops("Cannot allocate more than 64kByte.");
#endif
if (len)
p = realloc(oldp, len);
else
p = realloc(oldp, 1);
if (p == NULL)
oops("Out of memory.");
return p;
}
/*
* This routine gets a line from a file, supporting continuation with
* '\' as the last character on the line.
*
* In case of error, NULL is returned. If EOF is reached a pointer to
* a null string is returned. The final newline will be retained.
*/
char *
get_line(FILE *f)
{
size_t linelen, len;
char *buffer;
int c;
linelen = 80;
len = 0;
buffer = (char *)mymalloc(linelen);
while (1)
{
c = fgetc(f);
buffer[len++] = c;
if (len == linelen - 1)
{
linelen += 80;
buffer = (char *)myrealloc(buffer, linelen);
}
again:
switch (c)
{
case '\\':
c = fgetc(f);
if (c == '\n')
{
len--;
break;
}
else
{
buffer[len++] = c;
goto again;
}
case '\n':
buffer[len] = '\0';
return buffer;
case EOF:
buffer[len - 1] = '\0';
if (feof(f))
return buffer;
else
return NULL;
default:
break;
}
}
}
/*
* getline() is a wrapper function for get_line(). It returns `False' in
* case of error and expects a pointer to a buffer to store the current
* line. Additionally, the final newline character is stripped.
*/
Boolean
getline(char **bufferp, FILE *f)
{
size_t l;
*bufferp = get_line(f);
if (!(*bufferp && **bufferp))
return 0;
l = strlen(*bufferp);
if (l > 0)
(*bufferp)[l - 1] = '\0';
return 1;
}
char *
newstring(char *s)
{
char *q;
if (s)
{
q = mymalloc(strlen(s) + 1);
(void)strcpy(q, s);
return q;
}
else
return NULL;
}
ttfinfo *
newchar(Font *fnt)
{
register ttfinfo *ti;
ti = (ttfinfo *)mymalloc(sizeof (ttfinfo));
ti->next = fnt->charlist;
ti->charcode = -1;
ti->glyphindex = -1;
ti->incode = -1;
ti->outcode = -1;
ti->adobename = NULL;
ti->width = -1;
ti->llx = -1;
ti->lly = -1;
ti->urx = -1;
ti->ury = -1;
ti->ligs = NULL;
ti->kerns = NULL;
ti->kern_equivs = NULL;
ti->pccs = NULL;
ti->constructed = False;
ti->wptr = 0;
ti->hptr = 0;
ti->dptr = 0;
ti->iptr = 0;
fnt->charlist = ti;
return ti;
}
kern *
newkern(void)
{
register kern *nk;
nk = (kern *)mymalloc(sizeof (kern));
nk->next = NULL;
nk->succ = NULL;
nk->delta = 0;
return nk;
}
pcc *
newpcc(void)
{
register pcc *np;
np = (pcc *)mymalloc(sizeof (pcc));
np->next = NULL;
np->partname = NULL;
np->xoffset = 0;
np->yoffset = 0;
return np;
}
lig *
newlig(void)
{
register lig *nl;
nl = (lig *)mymalloc(sizeof (lig));
nl->next = NULL;
nl->succ = NULL;
nl->sub = NULL;
nl->op = 0; /* the default =: op */
nl->boundleft = 0;
return nl;
}
stringlist *
newstringlist(void)
{
register stringlist *sl;
sl = (stringlist *)mymalloc(sizeof (stringlist));
sl->next = NULL;
sl->old_name = NULL;
sl->new_name = NULL;
sl->single_replacement = False;
return sl;
}
void
init_font_structure(Font *fnt)
{
int i;
fnt->ttfname = NULL;
fnt->tfm_path = NULL;
fnt->tfm_ext = NULL;
fnt->outname = NULL;
fnt->subfont_name = NULL;
fnt->outname_postfix = NULL;
fnt->fullname = NULL;
fnt->vplout = NULL;
fnt->tfmout = NULL;
fnt->inencname = NULL;
fnt->inencoding = NULL;
fnt->replacements = NULL;
fnt->replacementname = NULL;
fnt->outencname = NULL;
fnt->outencoding = NULL;
fnt->sfdname = NULL;
fnt->sawligkern = False;
fnt->subfont_ligs = False;
fnt->charlist = NULL;
fnt->boundarychar = -1;
fnt->codingscheme = default_codingscheme;
fnt->titlebuf = NULL;
fnt->units_per_em = 0;
fnt->italicangle = 0.0;
fnt->fixedpitch = 0;
fnt->fontindex = 0;
fnt->pid = 3;
fnt->eid = 1;
fnt->xheight = 400;
fnt->fontspace = 0;
fnt->y_offset = 0.25;
fnt->efactor = 1.0;
fnt->slant = 0;
fnt->capheight = 0.8;
fnt->PSnames = No;
fnt->rotate = No;
fnt->efactorparam = NULL;
fnt->slantparam = NULL;
fnt->fontindexparam = NULL;
fnt->pidparam = NULL;
fnt->eidparam = NULL;
fnt->y_offsetparam = NULL;
for (i = 0; i < 256; i++)
{
fnt->inencptrs[i] = NULL;
fnt->outencptrs[i] = NULL;
fnt->uppercase[i] = NULL;
fnt->lowercase[i] = NULL;
fnt->sf_code[i] = -1;
fnt->nextout[i] = -1; /* encoding chains have length 0 */
}
}
/* end */

43
contrib/ttf2pk/newobj.h Normal file
View File

@@ -0,0 +1,43 @@
/*
* newobj.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef NEWOBJ_H
#define NEWOBJ_H
#include <stdio.h>
#include "ttf2tfm.h"
#if (defined(MSDOS) && defined(__TURBOC__)) || \
(defined(OS2) && defined(_MSC_VER))
#define SMALLMALLOC
#endif
void *mymalloc(size_t len);
void *mycalloc(size_t len);
void *myrealloc(void *oldp, size_t len);
char *get_line(FILE *f);
Boolean getline(char **bufferp, FILE *f);
char *newstring(char *s);
ttfinfo *newchar(Font *fnt);
kern *newkern(void);
pcc *newpcc(void);
lig *newlig(void);
stringlist *newstringlist(void);
void init_font_structure(Font *fnt);
#endif /* NEWOBJ_H */
/* end */

304
contrib/ttf2pk/parse.c Normal file
View File

@@ -0,0 +1,304 @@
/*
* parse.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h> /* for size_t */
#include <ctype.h>
#include <string.h>
#include "ttf2tfm.h"
#include "errormsg.h"
#include "newobj.h"
#include "ligkern.h"
#include "texenc.h"
#include "parse.h"
#include "filesrch.h"
/*
* Here we get a token from the encoding file. We parse just as much
* PostScript as we expect to find in an encoding file. We allow
* commented lines and names like 0, .notdef, _foo_. We do not allow
* //abc.
*
* `bufferp' is a pointer to the current line; the offset of the beginning
* of the token to be parsed relative to `bufferp' will be returned in
* `offsetp'. On the first call of gettoken() `init' must be set to 1 and
* to 0 on the following calls.
*
* If `ignoreligkern' is `True', no LIGKERN data will be extracted from the
* encoding file.
*
* Don't modify `bufferp'!
*
* The memory management of `bufferp' will be done by gettoken() itself;
* nevertheless, it returns a pointer to the current token which should be
* freed after it has been used.
*/
static char *
gettoken(char **bufferp, size_t *offsetp, FILE *f, Font *fnt,
Boolean ignoreligkern, Boolean init)
{
char *p, *q;
char tempchar;
static char *curp;
if (init)
curp = NULL;
while (1)
{
while (curp == NULL || *curp == '\0')
{
if (*bufferp)
free(*bufferp);
if (getline(bufferp, f) == False)
oops("Premature end in encoding file.");
curp = *bufferp;
for (p = *bufferp; *p; p++)
if (*p == '%')
{
if (ignoreligkern == False)
checkligkern(p, fnt);
*p = '\0';
break;
}
}
while (isspace(*curp))
curp++;
*offsetp = curp - *bufferp;
if (*curp)
{
if (*curp == '[' || *curp == ']' ||
*curp == '{' || *curp == '}')
q = curp++;
else if (*curp == '/' ||
*curp == '-' || *curp == '_' || *curp == '.' ||
('0' <= *curp && *curp <= '9') ||
('a' <= *curp && *curp <= 'z') ||
('A' <= *curp && *curp <= 'Z'))
{
q = curp++;
while (*curp == '-' || *curp == '_' || *curp == '.' ||
('0' <= *curp && *curp <= '9') ||
('a' <= *curp && *curp <= 'z') ||
('A' <= *curp && *curp <= 'Z'))
curp++;
}
else
q = curp;
tempchar = *curp;
*curp = '\0';
p = newstring(q);
*curp = tempchar;
return p;
}
}
}
/*
* This routine reads in an encoding file, given the name. It returns
* the final total structure. It performs a number of consistency checks.
*/
encoding *
readencoding(char **enc, Font *fnt, Boolean ignoreligkern)
{
char *real_encname;
FILE *enc_file;
char *p, *q, c;
char *buffer;
char numbuf[9];
size_t offset;
int i;
long l;
encoding *e = (encoding *)mymalloc(sizeof (encoding));
if (enc && *enc)
{
real_encname = TeX_search_encoding_file(enc);
if (!real_encname)
oops("Cannot find encoding file `%s'.", *enc);
enc_file = fopen(real_encname, "rt");
if (enc_file == NULL)
oops("Cannot open encoding file `%s'.", real_encname);
buffer = NULL;
p = gettoken(&buffer, &offset, enc_file, fnt, ignoreligkern, True);
if (*p != '/' || p[1] == '\0')
boops(buffer, offset,
"First token in encoding must be literal encoding name.");
e->name = newstring(p + 1);
free(p);
p = gettoken(&buffer, &offset, enc_file, fnt, ignoreligkern, False);
if (strcmp(p, "["))
boops(buffer, offset,
"Second token in encoding must be mark ([) token.");
free(p);
for (i = 0; i < 256; i++)
{
p = gettoken(&buffer, &offset, enc_file, fnt, ignoreligkern, False);
if (*p != '/' || p[1] == 0)
boops(buffer, offset,
"Tokens 3 to 257 in encoding must be literal names.");
/* now we test for a generic code point resp. glyph index value */
c = p[2];
if (p[1] == '.' && (c == 'c' || c == 'g') && '0' <= p[3] && p[3] <= '9')
{
l = strtol(p + 3, &q, 0);
if (*q != '\0' || l < 0 || l > 0xFFFF)
boops(buffer, offset, "Invalid encoding token.");
sprintf(numbuf, ".%c0x%x", c, (unsigned int)l);
e->vec[i] = newstring(numbuf);
}
else
e->vec[i] = newstring(p + 1);
free(p);
}
p = gettoken(&buffer, &offset, enc_file, fnt, ignoreligkern, False);
if (strcmp(p, "]"))
boops(buffer, offset,
"Token 258 in encoding must be make-array (]).");
free(p);
while (getline(&buffer, enc_file))
{
for (p = buffer; *p; p++)
if (*p == '%')
{
if (ignoreligkern == False)
checkligkern(p, fnt);
*p = '\0';
break;
}
}
fclose(enc_file);
if (ignoreligkern == False && fnt->sawligkern == False)
getligkerndefaults(fnt);
}
else
{
if (ignoreligkern == False)
{
e = &staticencoding;
getligkerndefaults(fnt);
}
else
e = NULL;
}
return e;
}
/*
* We scan a glyph replacement file.
* `%' is the comment character.
*/
void
get_replacements(Font *fnt)
{
char *real_replacement_name;
FILE *replacement_file;
char *buffer = NULL, *oldbuffer = NULL;
char *p;
char *old_name, *new_name;
stringlist *sl;
if (!fnt->replacementname)
return;
real_replacement_name = TeX_search_replacement_file(&fnt->replacementname);
if (!real_replacement_name)
oops("Cannot find replacement file `%s'.", fnt->replacementname);
replacement_file = fopen(real_replacement_name, "rt");
if (replacement_file == NULL)
oops("Cannot open replacement file `%s'.", real_replacement_name);
while (getline(&buffer, replacement_file))
{
for (p = buffer; *p; p++)
if (*p == '%')
{
*p = '\0';
break;
}
if (oldbuffer)
free(oldbuffer);
oldbuffer = newstring(buffer);
p = buffer;
while (isspace(*p))
p++;
if (!*p)
continue;
old_name = p;
while (*p && !isspace(*p))
p++;
if (*p)
*p++ = '\0';
while (*p && isspace(*p))
p++;
if (!*p)
boops(oldbuffer, old_name - oldbuffer, "Replacement glyph missing.");
new_name = p;
while (*p && !isspace(*p))
p++;
if (*p)
*p++ = '\0';
while (*p && isspace(*p))
p++;
if (*p)
boops(oldbuffer, p - oldbuffer, "Invalid replacement syntax.");
sl = newstringlist();
sl->new_name = newstring(new_name);
sl->old_name = newstring(old_name);
sl->next = fnt->replacements;
fnt->replacements = sl;
}
fclose(replacement_file);
}
/* end */

22
contrib/ttf2pk/parse.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* parse.h
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
#ifndef PARSE_H
#define PARSE_H
#include "ttf2tfm.h"
encoding *readencoding(char **enc, Font *fnt, Boolean ignoreligkern);
void get_replacements(Font *fnt);
#endif /* PARSE_H */
/* end */

872
contrib/ttf2pk/pklib.c Normal file
View File

@@ -0,0 +1,872 @@
/*
* pklib.c
*
* This file is part of the ttf2pk package.
*
* Copyright 1997-1999 by
* Frederic Loyer <loyer@ensta.fr>
* Werner Lemberg <wl@gnu.org>
*/
/*
* This code has been derived from the program gsftopk.
* Here the original copyright.
*/
/*
* Copyright (c) 1994 Paul Vojta. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h> /* for size_t */
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include "newobj.h"
#include "pklib.h"
#include "errormsg.h"
#include "filesrch.h"
#ifndef MAXPATHLEN
#define MAXPATHLEN 256
#endif
#define PK_PRE (char)247
#define PK_ID 89
#define PK_POST (char)245
#define PK_NOP (char)246
int dpi;
FILE *pk_file;
/*
* Information from the .tfm file.
*/
int tfm_lengths[12];
#define lh tfm_lengths[1]
#define bc tfm_lengths[2]
#define ec tfm_lengths[3]
#define nw tfm_lengths[4]
long checksum;
long design;
byte width_index[256];
long tfm_widths[256];
/*
* Information on the bitmap currently being worked on.
*/
byte *bitmap;
int width;
int skip;
int height;
int hoff;
int voff;
int bytes_wide;
size_t bm_size;
byte *bitmap_end;
int pk_len;
/*
* Here's the path searching stuff. First the typedefs and variables.
*/
static char searchpath[MAXPATHLEN + 1];
#define HUNKSIZE (MAXPATHLEN + 2)
struct spacenode /* used for storage of directory names */
{
struct spacenode *next;
char *sp_end; /* end of data for this chunk */
char sp[HUNKSIZE];
} firstnode;
static FILE *
search_tfm(char **name)
{
char *p;
FILE *f;
p = TeX_search_tfm(name);
if (p == NULL)
return NULL;
strcpy(searchpath, p);
f = fopen(searchpath, "rb");
return f;
}
static long
getlong(FILE *f)
{
unsigned long value;
value = (unsigned long)getc(f) << 24;
value |= (unsigned long)getc(f) << 16;
value |= (unsigned long)getc(f) << 8;
value |= (unsigned long)getc(f);
return value;
}
char line[82];
static byte masks[] = {0, 1, 3, 7, 017, 037, 077, 0177, 0377};
byte flag;
int pk_dyn_f;
int pk_dyn_g;
int base; /* cost of this character if pk_dyn_f = 0 */
int deltas[13]; /* cost of increasing pk_dyn_f from i to i+1 */
/*
* Add up statistics for putting out the given shift count.
*/
static void
tallyup(int n)
{
int m;
if (n > 208)
{
++base;
n -= 192;
for (m = 0x100; m != 0 && m < n; m <<= 4)
base += 2;
if (m != 0 && (m = (m - n) / 15) < 13)
deltas[m] += 2;
}
else if (n > 13)
++deltas[(208 - n) / 15];
else
--deltas[n - 1];
}
/*
* Routines for storing the shift counts.
*/
static Boolean odd = False;
static byte part;
static void
pk_put_nyb(int n)
{
if (odd)
{
*bitmap_end++ = (part << 4) | n;
odd = False;
}
else
{
part = n;
odd = True;
}
}
static void
pk_put_long(int n)
{
if (n >= 16)
{
pk_put_nyb(0);
pk_put_long(n / 16);
}
pk_put_nyb(n % 16);
}
static void
pk_put_count(int n)
{
if (n > pk_dyn_f)
{
if (n > pk_dyn_g)
pk_put_long(n - pk_dyn_g + 15);
else
{
pk_put_nyb(pk_dyn_f + (n - pk_dyn_f + 15) / 16);
pk_put_nyb((n - pk_dyn_f - 1) % 16);
}
}
else
pk_put_nyb(n);
}
static void
trim_bitmap(void)
{
byte *p;
byte mask;
/* clear out garbage bits in bitmap */
if (width % 8 != 0)
{
mask = ~masks[8 - width % 8];
for (p = bitmap + bytes_wide - 1; p < bitmap_end; p += bytes_wide)
*p &= mask;
}
/* Find the bounding box of the bitmap. */
/* trim top */
skip = 0;
mask = 0;
for (;;)
{
if (bitmap >= bitmap_end) /* if bitmap is empty */
{
width = height = hoff = voff = 0;
return;
}
p = bitmap + bytes_wide;
while (p > bitmap)
mask |= *--p;
if (mask)
break;
++skip;
bitmap += bytes_wide;
}
height -= skip;
voff -= skip;
#ifdef DEBUG
if (skip < 2 || skip > 3)
printf("Character has %d empty rows at top\n", skip);
#endif
/* trim bottom */
skip = 0;
mask = 0;
for (;;)
{
p = bitmap_end - bytes_wide;
while (p < bitmap_end)
mask |= *p++;
if (mask)
break;
++skip;
bitmap_end -= bytes_wide;
}
height -= skip;
#ifdef DEBUG
if (skip < 2 || skip > 3)
printf("Character has %d empty rows at bottom\n", skip);
#endif
/* trim right */
skip = 0;
--width;
for (;;)
{
mask = 0;
for (p = bitmap + width / 8; p < bitmap_end; p += bytes_wide)
mask |= *p;
if (mask & (0x80 >> (width % 8)))
break;
--width;
++skip;
}
++width;
#ifdef DEBUG
if (skip < 2 || skip > 3)
printf("Character has %d empty columns at right\n", skip);
#endif
/* trim left */
skip = 0;
for (;;)
{
mask = 0;
for (p = bitmap + skip / 8; p < bitmap_end; p += bytes_wide)
mask |= *p;
if (mask & (0x80 >> (skip % 8)))
break;
++skip;
}
width -= skip;
hoff -= skip;
#ifdef DEBUG
if (skip < 2 || skip > 3)
printf("Character has %d empty columns at left\n", skip);
#endif
bitmap += skip / 8;
skip = skip % 8;
}
/*
* Pack the bitmap using the rll method. (Return false if it's better
* to just pack the bits.)
*/
static Boolean
pk_rll_cvt(void)
{
static int *counts = NULL; /* area for saving bit counts */
static int maxcounts = 0; /* size of this area */
unsigned int ncounts; /* max to allow this time */
int *nextcount; /* next count value */
int *counts_end; /* pointer to end */
byte *rowptr;
byte *p;
byte mask;
byte *rowdup; /* last row checked for dup */
byte paint_switch; /* 0 or 0xff */
int bits_left; /* bits left in row */
int cost;
int i;
/* Allocate space for bit counts. */
ncounts = (width * height + 3) / 4;
if (ncounts > maxcounts)
{
if (counts != NULL)
free(counts);
counts = (int *)mymalloc((ncounts + 2) * sizeof (int));
maxcounts = ncounts;
}
counts_end = counts + ncounts;
/* Form bit counts and collect statistics */
base = 0;
memset(deltas, 0, sizeof (deltas));
rowdup = NULL; /* last row checked for duplicates */
p = rowptr = bitmap;
mask = 0x80 >> skip;
flag = 0;
paint_switch = 0;
if (*p & mask)
{
flag = 8;
paint_switch = 0xff;
}
bits_left = width;
nextcount = counts;
while (rowptr < bitmap_end) /* loop over shift counts */
{
int shift_count = bits_left;
for (;;)
{
if (bits_left == 0)
{
if ((p = rowptr += bytes_wide) >= bitmap_end)
break;
mask = 0x80 >> skip;
bits_left = width;
shift_count += width;
}
if (((*p ^ paint_switch) & mask) != 0)
break;
--bits_left;
mask >>= 1;
if (mask == 0)
{
++p;
while (*p == paint_switch && bits_left >= 8)
{
++p;
bits_left -= 8;
}
mask = 0x80;
}
}
if (nextcount >= counts_end)
return False;
shift_count -= bits_left;
*nextcount++ = shift_count;
tallyup(shift_count);
/* check for duplicate rows */
if (rowptr != rowdup && bits_left != width)
{
byte *p1 = rowptr;
byte *q = rowptr + bytes_wide;
int repeat_count;
while (q < bitmap_end && *p1 == *q)
{
++p1;
++q;
}
repeat_count = (p1 - rowptr) / bytes_wide;
if (repeat_count > 0)
{
*nextcount++ = -repeat_count;
if (repeat_count == 1)
--base;
else
{
++base;
tallyup(repeat_count);
}
rowptr += repeat_count * bytes_wide;
}
rowdup = rowptr;
}
paint_switch = ~paint_switch;
}
#ifdef DEBUG
/*
* Dump the bitmap
*/
for (p = bitmap; p < bitmap_end; p += bytes_wide)
{
byte *p1 = p;
int j;
mask = 0x80 >> skip;
for (j = 0; j < width; ++j)
{
putchar(*p1 & mask ? '@' : '.');
if ((mask >>= 1) == 0)
{
mask = 0x80;
++p1;
}
}
putchar('\n');
}
putchar('\n');
#endif
/* Determine the best pk_dyn_f */
pk_dyn_f = 0;
cost = base += 2 * (nextcount - counts);
for (i = 1; i < 14; ++i)
{
base += deltas[i - 1];
if (base < cost)
{
pk_dyn_f = i;
cost = base;
}
}
/* last chance to bail out */
if (cost * 4 > width * height)
return False;
/* Pack the bit counts */
pk_dyn_g = 208 - 15 * pk_dyn_f;
flag |= pk_dyn_f << 4;
bitmap_end = bitmap;
*nextcount = 0;
nextcount = counts;
while (*nextcount != 0)
{
if (*nextcount > 0)
pk_put_count(*nextcount);
else
if (*nextcount == -1)
pk_put_nyb(15);
else
{
pk_put_nyb(14);
pk_put_count(-*nextcount);
}
++nextcount;
}
if (odd)
{
pk_put_nyb(0);
++cost;
}
if (cost != 2 * (bitmap_end - bitmap))
printf("Cost miscalculation: expected %d, got %ld\n",
cost, (long)(2 * (bitmap_end - bitmap)));
pk_len = bitmap_end - bitmap;
return True;
}
static void
pk_bm_cvt(void)
{
byte *rowptr;
byte *p;
int blib1; /* bits left in byte */
int bits_left; /* bits left in row */
byte *q;
int blib2;
byte nextbyte;
flag = 14 << 4;
q = bitmap;
blib2 = 8;
nextbyte = 0;
for (rowptr = bitmap; rowptr < bitmap_end; rowptr += bytes_wide)
{
p = rowptr;
blib1 = 8 - skip;
bits_left = width;
if (blib2 != 8)
{
int n;
if (blib1 < blib2)
{
nextbyte |= *p << (blib2 - blib1);
n = blib1;
}
else
{
nextbyte |= *p >> (blib1 - blib2);
n = blib2;
}
blib2 -= n;
if ((bits_left -= n) < 0)
{
blib2 -= bits_left;
continue;
}
if ((blib1 -= n) == 0)
{
blib1 = 8;
++p;
if (blib2 > 0)
{
nextbyte |= *p >> (8 - blib2);
blib1 -= blib2;
bits_left -= blib2;
if (bits_left < 0)
{
blib2 = -bits_left;
continue;
}
}
}
*q++ = nextbyte;
}
/* fill up whole (destination) bytes */
while (bits_left >= 8)
{
nextbyte = *p++ << (8 - blib1);
*q++ = nextbyte | (*p >> blib1);
bits_left -= 8;
}
/* now do the remainder */
nextbyte = *p << (8 - blib1);
if (bits_left > blib1)
nextbyte |= p[1] >> blib1;
blib2 = 8 - bits_left;
}
if (blib2 != 8)
*q++ = nextbyte;
pk_len = q - bitmap;
}
static void
putshort(short w)
{
putc(w >> 8, pk_file);
putc(w, pk_file);
}
static void
putmed(long w)
{
putc(w >> 16, pk_file);
putc(w >> 8, pk_file);
putc(w, pk_file);
}
static void
putlong(long w)
{
putc(w >> 24, pk_file);
putc(w >> 16, pk_file);
putc(w >> 8, pk_file);
putc(w, pk_file);
}
char
xgetc(FILE *f)
{
int c;
c = getc(f);
if (c == EOF)
oops("Premature end of file.");
return (byte)c;
}
/*
* Open and read the tfm file.
*/
void
TFMopen(char **filename)
{
FILE *tfm_file;
int i;
int cc;
tfm_file = search_tfm(filename);
if (tfm_file == NULL)
oops("Cannot find tfm file.");
for (i = 0; i < 12; i++)
{
int j;
j = (int)((byte)getc(tfm_file)) << 8;
tfm_lengths[i] = j | (int)((byte)xgetc(tfm_file));
}
checksum = getlong(tfm_file);
design = getlong(tfm_file);
fseek(tfm_file, 4 * (lh + 6), 0);
for (cc = bc; cc <= ec; ++cc)
{
width_index[cc] = (byte)xgetc(tfm_file);
(void)xgetc(tfm_file);
(void)xgetc(tfm_file);
(void)xgetc(tfm_file);
}
for (i = 0; i < nw; ++i)
tfm_widths[i] = getlong(tfm_file);
fclose(tfm_file);
}
/*
* Create pk file and write preamble.
*/
void
PKopen(char *filename,
char *ident,
int resolution)
{
int ppp;
int i;
dpi = resolution;
if ((pk_file = fopen(filename, "wb")) == NULL)
{
perror(filename);
exit(1);
}
putc(PK_PRE, pk_file);
putc(PK_ID, pk_file);
i = strlen(ident);
putc(i, pk_file);
fwrite(ident, 1, i, pk_file);
putlong(design);
putlong(checksum);
ppp = dpi / 72.27 * 65536.0 + 0.5;
putlong(ppp); /* hppp */
putlong(ppp); /* vppp */
}
void
PKputglyph(int cc,
int llx, int lly, int urx, int ury,
int w, int h,
byte *b)
{
float char_width;
long dm;
long tfm_wid;
bitmap = b;
width = w;
height = h;
hoff = -llx;
voff = ury - 2; /* Don't ask me why `-2' */
/* Fred */
if (width != urx - llx || height != ury - lly)
oops("Dimensions do not match: (%d - %d) (%d - %d) <=> %d %d",
llx, lly, urx, ury, width, height);
bytes_wide = (width + 7) / 8;
bm_size = bytes_wide * height;
bitmap_end = bitmap + bm_size;
trim_bitmap();
if (height == 0 || !pk_rll_cvt())
pk_bm_cvt();
if (!width_index[cc])
return;
tfm_wid = tfm_widths[width_index[cc]];
char_width = tfm_wid / 1048576.0 * design / 1048576.0 * dpi / 72.27;
dm = (long)(char_width + 0.5) - (char_width < -0.5);
if (pk_len + 8 < 4 * 256 && tfm_wid < (1<<24) &&
dm >= 0 && dm < 256 && width < 256 && height < 256 &&
hoff >= -128 && hoff < 128 && voff >= -128 && voff < 128)
{
putc(flag | ((pk_len + 8) >> 8), pk_file);
putc(pk_len + 8, pk_file);
putc(cc, pk_file);
putmed(tfm_wid);
putc(dm, pk_file);
putc(width, pk_file);
putc(height, pk_file);
putc(hoff, pk_file);
putc(voff, pk_file);
}
else if (pk_len + 13 < 3 * 65536L && tfm_wid < (1<<24) &&
dm >= 0 && dm < 65536L && width < 65536L && height < 65536L &&
hoff >= -65536L && hoff < 65536L &&
voff >= -65536L && voff < 65536L)
{
putc(flag | 4 | ((pk_len + 13) >> 16), pk_file);
putshort(pk_len + 13);
putc(cc, pk_file);
putmed(tfm_wid);
putshort(dm);
putshort(width);
putshort(height);
putshort(hoff);
putshort(voff);
}
else
{
putc(flag | 7, pk_file);
putlong(pk_len + 28);
putlong(cc);
putlong(tfm_wid);
putlong((long)(char_width * 65536.0 + 0.5) - (char_width < -0.5));
putlong(0);
putlong(width);
putlong(height);
putlong(hoff);
putlong(voff);
}
fwrite(bitmap, 1, pk_len, pk_file);
}
void
PKclose(void)
{
putc(PK_POST, pk_file);
while (ftell(pk_file) % 4 != 0)
putc(PK_NOP, pk_file);
fclose(pk_file);
}
/* end */

Some files were not shown because too many files have changed in this diff Show More