FreeType 1.31.1

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

File diff suppressed because it is too large Load Diff

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

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

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

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

View File

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

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

Binary file not shown.

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

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

View File

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

View File

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