FreeType 1.31.1
This commit is contained in:
38
contrib/ftos2/DEVELFAQ
Normal file
38
contrib/ftos2/DEVELFAQ
Normal 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
260
contrib/ftos2/FAQ
Normal 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
BIN
contrib/ftos2/ft2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
53
contrib/ftos2/ifi/32fddef.h
Normal file
53
contrib/ftos2/ifi/32fddef.h
Normal 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
|
||||
|
||||
161
contrib/ftos2/ifi/32fdstrc.h
Normal file
161
contrib/ftos2/ifi/32fdstrc.h
Normal 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
|
||||
|
||||
118
contrib/ftos2/ifi/32ifimet.h
Normal file
118
contrib/ftos2/ifi/32ifimet.h
Normal 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
|
||||
79
contrib/ftos2/ifi/32pmifi.h
Normal file
79
contrib/ftos2/ifi/32pmifi.h
Normal 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
|
||||
10
contrib/ftos2/ifi/FreeType.def
Normal file
10
contrib/ftos2/ifi/FreeType.def
Normal 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"
|
||||
35
contrib/ftos2/ifi/FreeType.icc
Normal file
35
contrib/ftos2/ifi/FreeType.icc
Normal 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
|
||||
29
contrib/ftos2/ifi/FreeType.wat
Normal file
29
contrib/ftos2/ifi/FreeType.wat
Normal 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
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
305
contrib/ftos2/ifi/ftifi.h
Normal 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
184
contrib/ftos2/ifi/ftmem.c
Normal 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);
|
||||
}
|
||||
4
contrib/ftos2/ifi/ftmem.icc
Normal file
4
contrib/ftos2/ifi/ftmem.icc
Normal 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
BIN
contrib/ftos2/ifi/ftmem.ico
Normal file
Binary file not shown.
238
contrib/ftos2/ifi/test.c
Normal file
238
contrib/ftos2/ifi/test.c
Normal 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);
|
||||
}
|
||||
6
contrib/ftos2/ifi/test.icc
Normal file
6
contrib/ftos2/ifi/test.icc
Normal 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
|
||||
4
contrib/ftos2/ifi/test.wat
Normal file
4
contrib/ftos2/ifi/test.wat
Normal 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
30
contrib/ftos2/install.cmd
Normal 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
|
||||
72
contrib/ftos2/lib/arch/os2/Makefile.icc
Normal file
72
contrib/ftos2/lib/arch/os2/Makefile.icc
Normal 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
|
||||
41
contrib/ftos2/lib/arch/os2/Makefile.wat
Normal file
41
contrib/ftos2/lib/arch/os2/Makefile.wat
Normal 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
|
||||
385
contrib/ftos2/lib/ttmemory.c
Normal file
385
contrib/ftos2/lib/ttmemory.c
Normal 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
63
contrib/ftos2/limit.cmd
Normal 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
15
contrib/ftos2/query.cmd
Normal 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
87
contrib/ftos2/readme.1st
Normal 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
113
contrib/ftos2/readme.txt
Normal 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
60
contrib/ftos2/uninst.c
Normal 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!");
|
||||
}
|
||||
34
contrib/ftos2/uninstall.cmd
Normal file
34
contrib/ftos2/uninstall.cmd
Normal 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
|
||||
Reference in New Issue
Block a user