formatting - removed trailing spaces
This commit is contained in:
parent
968f0c3749
commit
e49ab25c08
92
BUILD
92
BUILD
@ -17,19 +17,19 @@ I. QUICK COMMAND-LINE GUIDE:
|
||||
----------------------------
|
||||
|
||||
Install GNU Make, then try the following on Unix or any system with gcc:
|
||||
|
||||
|
||||
make // this will setup the build
|
||||
make // this will build the library
|
||||
|
||||
|
||||
On Win32+Visual C++:
|
||||
|
||||
|
||||
make setup visualc // setup the build for VisualC++ on Win32
|
||||
make // build the library
|
||||
|
||||
|
||||
Then, go to the "demos" directory and type
|
||||
|
||||
|
||||
make
|
||||
|
||||
|
||||
To compile the demo programs..
|
||||
|
||||
If this doesn't work, read the following..
|
||||
@ -45,58 +45,58 @@ II. COMMAND-LINE COMPILATION:
|
||||
FreeType 2 includes a powerful and flexible build system that allows you
|
||||
to easily compile it on a great variety of platforms from the command
|
||||
line. To do so, just follow these simple instructions:
|
||||
|
||||
|
||||
a/ Install GNU Make:
|
||||
|
||||
|
||||
Because GNU Make is the only Make tool supported to compile FreeType 2,
|
||||
you should install it on your machine.
|
||||
|
||||
Because the FT2 build system relies on many important features of GNU
|
||||
Make, trying to build the library with any other Make tool will *fail*.
|
||||
|
||||
|
||||
|
||||
b/ Invoke "make":
|
||||
|
||||
|
||||
Go to the root FT2 directory, then simply invoke GNU Make from the
|
||||
command line, this will launch the FreeType 2 Host Platform detection
|
||||
routines. A summary will be displayed, for example, on Win32:
|
||||
|
||||
|
||||
========================================================================
|
||||
FreeType build system -- automatic system detection
|
||||
|
||||
|
||||
The following settings are used:
|
||||
|
||||
|
||||
platform win32
|
||||
compiler gcc
|
||||
configuration directory ./config/win32
|
||||
configuration rules ./config/win32/w32-gcc.mk
|
||||
|
||||
configuration rules ./config/win32/w32-gcc.mk
|
||||
|
||||
If this does not correspond to your system or settings please remove
|
||||
the file 'config.mk' from this directory then read the INSTALL file
|
||||
for help.
|
||||
|
||||
|
||||
Otherwise, simply type 'make' again to build the library.
|
||||
=========================================================================
|
||||
|
||||
|
||||
If the detected settings correspond to your platform and compiler,
|
||||
skip to step e/. Note that if your platform is completely alien to
|
||||
the build system, the detected platform will be "ansi".
|
||||
|
||||
|
||||
|
||||
|
||||
c/ Configure the build system for a different compiler:
|
||||
|
||||
If the build system correctly detected your platform, but you want to
|
||||
use a different compiler than the one specified in the summary (for
|
||||
most platforms, gcc is the defaut compiler), simply invoke GNU Make
|
||||
like :
|
||||
|
||||
|
||||
make setup <compiler>
|
||||
|
||||
|
||||
For example:
|
||||
|
||||
|
||||
to use Visual C++ on Win32, type: "make setup visualc"
|
||||
to use LCC-Win32 on Win32, type: "make setup lcc"
|
||||
|
||||
|
||||
The <compiler> name to use is platform-dependent. The list of available
|
||||
compilers for your system is available in the file
|
||||
"config/<system>/detect.mk" (note that we hope to make the list
|
||||
@ -106,50 +106,50 @@ II. COMMAND-LINE COMPILATION:
|
||||
|
||||
|
||||
d/ Configure the build system for an unknown platform/compiler:
|
||||
|
||||
|
||||
What the auto-detection/setup phase of the build system does is simply
|
||||
copy a file to the current directory under the name "config.mk".
|
||||
|
||||
|
||||
For example, on OS/2+gcc, it would simply copy "config/os2/os2-gcc.mk"
|
||||
to "./config.mk"
|
||||
|
||||
|
||||
If for some reason your platform isn't correctly detected, simply copy
|
||||
manually the configuration sub-makefile to "./config.mk" and go to
|
||||
step e/.
|
||||
|
||||
|
||||
Note that this file is a sub-Makefile used to specify Make variables
|
||||
used to invoke the compiler and linker during the build, you can easily
|
||||
create your own version from one of the existing configuration files,
|
||||
then copy it to the current directory under the name "./config.mk".
|
||||
|
||||
|
||||
|
||||
|
||||
e/ Build the library:
|
||||
|
||||
|
||||
The auto-detection/setup phase should have copied a file in the current
|
||||
directory, called "./config.mk". This file contains definitions of various
|
||||
Make variables used to invoke the compiler and linker during the build.
|
||||
|
||||
|
||||
To launch the build, simply invoke GNU Make again: the top Makefile will
|
||||
detect the configuration file and run the build with it..
|
||||
|
||||
|
||||
|
||||
|
||||
f/ Build the demonstration programs:
|
||||
|
||||
|
||||
Once the library is compiled, go to "demos", then invoke GNU Make.
|
||||
|
||||
|
||||
Note that the demonstration programs include a tiny graphics sub-system
|
||||
that includes "drivers" to display Windows on Win32, X11 and OS/2. The
|
||||
build system should automatically detect which driver to use based on
|
||||
the current platform.
|
||||
|
||||
UNIX USERS TAKE NOTE: XXXXXX
|
||||
|
||||
|
||||
When building the demos, the build system tries to detect your X11 path
|
||||
by looking for the patterns "X11R5/bin", "X11R6/bin" or "X11/bin" in
|
||||
your current path. If no X11 path is found, the demo programs will not
|
||||
be able to display graphics and will fail. Change your current path
|
||||
if you encounter this problem.
|
||||
|
||||
|
||||
Note that the release version will use Autoconf to detect everything
|
||||
on Unix, so this will not be necessary !!
|
||||
|
||||
@ -165,7 +165,7 @@ II. DETAILED COMPILATION PROCEDURE:
|
||||
Each component must be compiled as a stand-alone object file, even when it
|
||||
is really made of several C source files. For example, the "base layer"
|
||||
component is made of the following C files:
|
||||
|
||||
|
||||
src/
|
||||
base/
|
||||
ftcalc.c - computations
|
||||
@ -174,10 +174,10 @@ II. DETAILED COMPILATION PROCEDURE:
|
||||
ftlist.c - simple list management
|
||||
ftoutln.c - simple outline processing
|
||||
ftextend.c - extensions support
|
||||
|
||||
|
||||
However, you can create a single object file by compiling the file
|
||||
"src/base/ftbase.c", whose content is:
|
||||
|
||||
|
||||
#include <ftcalc.c>
|
||||
#include <ftobjs.c>
|
||||
#include <ftstream.c>
|
||||
@ -187,7 +187,7 @@ II. DETAILED COMPILATION PROCEDURE:
|
||||
|
||||
Similarly, each component has a single "englobing" C file to compile it
|
||||
as a stand-alone object, i.e. :
|
||||
|
||||
|
||||
src/base/ftbase.c - the base layer, high-level interface
|
||||
src/sfnt/sfnt.c - the "sfnt" module
|
||||
src/psnames/psnames.c - the Postscript Names module
|
||||
@ -196,9 +196,9 @@ II. DETAILED COMPILATION PROCEDURE:
|
||||
|
||||
|
||||
To compile one component, do the following:
|
||||
|
||||
|
||||
- add the top-level "include" directory to your compilation include path
|
||||
|
||||
|
||||
- add the component's path to your compilation include path too. Being
|
||||
in the component's directory isn't enough !!
|
||||
|
||||
@ -206,18 +206,18 @@ II. DETAILED COMPILATION PROCEDURE:
|
||||
|
||||
For example, the following line can be used to compile the truetype driver
|
||||
on Unix:
|
||||
|
||||
|
||||
cd freetype2/
|
||||
cc -c -Iinclude -Isrc/truetype src/truetype/truetype.c
|
||||
|
||||
Alternatively:
|
||||
|
||||
|
||||
cd freetype2/src/truetype
|
||||
cc -c -I../../include -I. src/truetype/truetype.c
|
||||
|
||||
The complete list of files to compile for a feature-complete build of
|
||||
FreeType 2 is:
|
||||
|
||||
|
||||
src/base/ftsystem.c - system-specific memory and i/o support
|
||||
src/base/ftinit.c - initialisation layer
|
||||
src/base/ftdebug.c - debugging component (empty in release build)
|
||||
|
76
CHANGES
76
CHANGES
@ -1,4 +1,4 @@
|
||||
LATEST CHANGES -
|
||||
LATEST CHANGES -
|
||||
|
||||
- tagged "BETA-6" in the CVS tree. This one is a serious release candidate
|
||||
even though it doesn't incorporate the auto-hinter yet..
|
||||
@ -9,7 +9,7 @@ LATEST CHANGES -
|
||||
+ re-enable support for 5-gray levels anti-aliasing (suck, suck..)
|
||||
|
||||
- created new header files, and modified sources accordingly:
|
||||
|
||||
|
||||
<freetype/fttypes.h> - simple FreeType types, without the API
|
||||
<freetype/internal/ftmemory.h> - definition of memory-management macros
|
||||
|
||||
@ -26,15 +26,15 @@ LATEST CHANGES -
|
||||
| It seems the C pre-processor that comes with LCC is broken, it
|
||||
| doesn't recognize the ANSI standard directives # and ## correctly
|
||||
| when one of the argument is a macro. Also, something like:
|
||||
|
|
||||
|
|
||||
| #define F(x) print##x
|
||||
|
|
||||
|
|
||||
| F(("hello"))
|
||||
|
|
||||
|
|
||||
| will get incorrectly translated to:
|
||||
|
|
||||
|
|
||||
| print "hello")
|
||||
|
|
||||
|
|
||||
| by its pre-processor. For this reason, you simply cannot build
|
||||
| FreeType 2 in debug mode with this compiler..
|
||||
|
||||
@ -42,12 +42,12 @@ LATEST CHANGES -
|
||||
- yet another massive grunt work. I've changed the definition of the
|
||||
EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take
|
||||
an argument, which is the function's return value type.
|
||||
|
||||
|
||||
This is necessary to compile FreeType as a DLL on Windows and OS/2.
|
||||
Depending on the compiler used, a compiler-specific keyword like __export
|
||||
or __system must be placed before (VisualC++) or after (BorlandC++)
|
||||
the type..
|
||||
|
||||
|
||||
Of course, this needed a lot of changes throughout the source code
|
||||
to make it compile again... All cleaned up now, apparently..
|
||||
|
||||
@ -80,7 +80,7 @@ LATEST CHANGES -
|
||||
within it for more information.
|
||||
|
||||
- major directory hierarchy re-organisation. This was done for two things:
|
||||
|
||||
|
||||
* first, to ease the "manual" compilation of the library by requiring
|
||||
at lot less include paths :-)
|
||||
|
||||
@ -90,19 +90,19 @@ LATEST CHANGES -
|
||||
|
||||
Basically, you should now use the 'freetype/' prefix for header inclusion,
|
||||
as in:
|
||||
|
||||
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
|
||||
Some new include sub-directories are available:
|
||||
|
||||
|
||||
a. the "freetype/config" directory, contains two files used to
|
||||
configure the build of the library. Client applications should
|
||||
not need to look at these normally, but they can if they want.
|
||||
|
||||
|
||||
#include <freetype/config/ftoption.h>
|
||||
#include <freetype/config/ftconfig.h>
|
||||
|
||||
|
||||
b. the "freetype/internal" directory, contains header files that
|
||||
describes library internals. These are the header files that were
|
||||
previously found in the "src/base" and "src/shared" directories.
|
||||
@ -110,9 +110,9 @@ LATEST CHANGES -
|
||||
|
||||
As usual, the build system and the demos have been updated to reflect
|
||||
the change..
|
||||
|
||||
|
||||
Here's a layout of the new directory hierarchy:
|
||||
|
||||
|
||||
TOP
|
||||
include/
|
||||
freetype/
|
||||
@ -122,17 +122,17 @@ LATEST CHANGES -
|
||||
ftoption.h
|
||||
ftconfig.h
|
||||
ftmodule.h
|
||||
|
||||
|
||||
internal/
|
||||
ftobjs.h
|
||||
ftstream.h
|
||||
ftcalc.h
|
||||
...
|
||||
|
||||
|
||||
src/
|
||||
base/
|
||||
...
|
||||
|
||||
|
||||
sfnt/
|
||||
psnames/
|
||||
truetype/
|
||||
@ -142,7 +142,7 @@ LATEST CHANGES -
|
||||
|
||||
Compiling a module is now much easier, for example, the following should
|
||||
work when in the TOP directory on an ANSI build:
|
||||
|
||||
|
||||
gcc -c -I./include -I./src/base src/base/ftbase.c
|
||||
gcc -c -I./include -I./src/sfnt src/sfnt/sfnt.c
|
||||
etc..
|
||||
@ -178,9 +178,9 @@ OLD CHANGES - 14-apr-2000
|
||||
|
||||
- fixed a bug in the TrueType glyph loader that prevented the correct
|
||||
loading of some CJK glyphs in mingli.ttf
|
||||
|
||||
|
||||
- improved the standard Type 1 hinter in "src/type1"
|
||||
|
||||
|
||||
- fixed two bugs in the experimental Type 1 driver in "src/type1z"
|
||||
to handle the new XFree86 4.0 fonts (and a few other ones..)
|
||||
|
||||
@ -189,7 +189,7 @@ OLD CHANGES - 14-apr-2000
|
||||
in "demos/src/ftgrays.c" and should move to the library itself
|
||||
in the next beta.. NOTE: The smooth renderer doesn't compile in
|
||||
stand-alone mode anymore, but this should be fixed RSN..
|
||||
|
||||
|
||||
- introduced convenience functions to more easily deal with glyph
|
||||
images, see "include/ftglyph.h" for more details, as well as the
|
||||
new demo program named "demos/src/ftstring.c" that demonstrates
|
||||
@ -214,11 +214,11 @@ OLD CHANGES - 12-mar-2000
|
||||
- changed the layout of configuration files : now, all ANSI configuration
|
||||
files are located in "freetype2/config". System-specific over-rides
|
||||
can be placed in "freetype2/config/<system>".
|
||||
|
||||
|
||||
- moved all configuration macros to "config/ftoption.h"
|
||||
|
||||
|
||||
- improvements in the Type 1 driver with AFM support
|
||||
|
||||
|
||||
- changed the fields in the FT_Outline structure : the old "flags"
|
||||
array is re-named "tags", while all ancient flags are encoded into
|
||||
a single unsigned int named "flags".
|
||||
@ -230,10 +230,10 @@ OLD CHANGES - 12-mar-2000
|
||||
|
||||
- added a smooth anti-alias renderer to the demonstration programs
|
||||
- added Mac graphics driver (thanks Just)
|
||||
|
||||
|
||||
- FT_Open_Face changed in order to received a pointer to a FT_Open_Args
|
||||
descriptor..
|
||||
|
||||
|
||||
- various cleanups, a few more API functions implemented (see FT_Attach_File)
|
||||
|
||||
- updated some docs
|
||||
@ -314,11 +314,11 @@ OLDER CHANGES - 27-jan-2000
|
||||
|
||||
- updated the "sfnt" module interface to allow several SFNT-based
|
||||
drivers to co-exist peacefully
|
||||
|
||||
|
||||
- updated the "T1_Face" type to better separate Postscript font content
|
||||
from the rest of the FT_Face structure. Might be used later by the
|
||||
CFF/Type2 driver..
|
||||
|
||||
|
||||
- added an experimental replacement Type 1 driver featuring advanced
|
||||
(and speedy) pattern matching to retrieve the data from postscript
|
||||
fonts.
|
||||
@ -351,27 +351,27 @@ High-Level Interface :
|
||||
- resource objects have disappeared. this means that face objects can
|
||||
now be created with a single function call (see FT_New_Face and
|
||||
FT_Open_Face)
|
||||
|
||||
|
||||
- when calling either FT_New_Face & FT_Open_Face, a size object and a
|
||||
glyph slot object are automatically created for the face, and can be
|
||||
accessed through "face->glyph" and "face->size" if one really needs to.
|
||||
In most cases, there's no need to call FT_New_Size or FT_New_Glyph.
|
||||
|
||||
|
||||
- similarly, FT_Load_Glyph now only takes a "face" argument (instead of
|
||||
a glyph slot and a size). Also, it's "result" parameter is gone, as
|
||||
the glyph image type is returned in the field "face->glyph.format"
|
||||
|
||||
|
||||
- the list of available charmaps is directly accessible through
|
||||
"face->charmaps", counting "face->num_charmaps" elements. Each
|
||||
charmap has an 'encoding' field which specifies which known encoding
|
||||
it deals with. Valid values are, for example :
|
||||
|
||||
|
||||
ft_encoding_unicode (for ASCII, Latin-1 and Unicode)
|
||||
ft_encoding_apple_roman
|
||||
ft_encoding_sjis
|
||||
ft_encoding_adobe_standard
|
||||
ft_encoding_adobe_expert
|
||||
|
||||
|
||||
other values may be added in the future. Each charmap still holds its
|
||||
"platform_id" and "encoding_id" values in case the encoding is too
|
||||
exotic for the current library
|
||||
@ -510,7 +510,7 @@ Portability :
|
||||
|
||||
-----------------------------------------------------------------------------------------
|
||||
Font Drivers :
|
||||
|
||||
|
||||
|
||||
The Font Driver interface has been modified in order to support
|
||||
extensions & versioning.
|
||||
@ -561,10 +561,10 @@ Extensions support :
|
||||
driver = FT_Get_Driver( library, "truetype" );
|
||||
if (!driver) return FT_Err_Unimplemented_Feature;
|
||||
|
||||
return FT_Register_Extension( driver, &extension_class );
|
||||
return FT_Register_Extension( driver, &extension_class );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Implementing the extensions
|
||||
//
|
||||
FT_Error FT_Proceed_Extension_XXX( FT_Face face )
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/* initialisation */
|
||||
extern int grInit( void );
|
||||
|
||||
|
||||
/* finalisation */
|
||||
extern void grDone( void );
|
||||
|
||||
@ -52,13 +52,13 @@
|
||||
gr_pixel_mode_rgb32, /* 32-bits mode - 16 million colors */
|
||||
|
||||
gr_pixel_mode_max /* don't remove */
|
||||
|
||||
|
||||
} grPixelMode;
|
||||
|
||||
|
||||
/* forward declaration of the surface class */
|
||||
typedef struct grSurface_ grSurface;
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
@ -106,7 +106,7 @@
|
||||
{
|
||||
grPos x;
|
||||
grPos y;
|
||||
|
||||
|
||||
} grVector;
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@
|
||||
{
|
||||
long value;
|
||||
unsigned char chroma[4];
|
||||
|
||||
|
||||
} grColor;
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
* grNewBitmap
|
||||
*
|
||||
* <Description>
|
||||
* creates a new bitmap
|
||||
* creates a new bitmap
|
||||
*
|
||||
* <Input>
|
||||
* pixel_mode :: the target surface's pixel_mode
|
||||
@ -163,7 +163,7 @@
|
||||
* writes a given glyph bitmap to a target surface.
|
||||
*
|
||||
* <Input>
|
||||
* target :: handle to target bitmap
|
||||
* target :: handle to target bitmap
|
||||
* glyph :: handle to source glyph bitmap
|
||||
* x :: position of left-most pixel of glyph image in target surface
|
||||
* y :: position of top-most pixel of glyph image in target surface
|
||||
@ -185,7 +185,7 @@
|
||||
* This function performs clipping
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern int grBlitGlyphToBitmap( grBitmap* target,
|
||||
grBitmap* glyph,
|
||||
grPos x,
|
||||
@ -199,7 +199,7 @@
|
||||
* grFillRectangle
|
||||
*
|
||||
* <Description>
|
||||
* this function is used to fill a given rectangle on a surface
|
||||
* this function is used to fill a given rectangle on a surface
|
||||
*
|
||||
* <Input>
|
||||
* surface :: handle to target surface
|
||||
@ -210,7 +210,7 @@
|
||||
* color :: fill color
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern void grFillRectangle( grBitmap* surface,
|
||||
grPos x,
|
||||
grPos y,
|
||||
@ -240,7 +240,7 @@
|
||||
* color :: color to be used to draw the character
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
void grWriteCellChar( grBitmap* target,
|
||||
int x,
|
||||
@ -262,14 +262,14 @@
|
||||
* This function writes a string with the internal font
|
||||
*
|
||||
* <Input>
|
||||
* target :: handle to target bitmap
|
||||
* target :: handle to target bitmap
|
||||
* x :: x pixel position of string's top left corner
|
||||
* y :: y pixel position of string's top left corner
|
||||
* string :: Latin-1 text string
|
||||
* color :: color to be used to draw the character
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
void grWriteCellString( grBitmap* target,
|
||||
int x,
|
||||
@ -283,7 +283,7 @@
|
||||
* grDoneBitmap
|
||||
*
|
||||
* <Description>
|
||||
* destroys a bitmap
|
||||
* destroys a bitmap
|
||||
*
|
||||
* <Input>
|
||||
* bitmap :: handle to bitmap descriptor
|
||||
@ -336,7 +336,7 @@
|
||||
* client applications..
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
typedef struct grDeviceChain_ grDeviceChain;
|
||||
|
||||
struct grDeviceChain_
|
||||
@ -372,7 +372,7 @@
|
||||
* If no driver could be initialised, this function returns NULL.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
grDeviceChain* grInitDevices( void );
|
||||
|
||||
@ -411,12 +411,12 @@
|
||||
* 2 and 256.
|
||||
*
|
||||
* the pixel modes do not provide the number of grays in the case
|
||||
* of "gray" devices. You should try to create a surface with the
|
||||
* of "gray" devices. You should try to create a surface with the
|
||||
* maximal number (256, that is) and see the value returned in
|
||||
* the bitmap descriptor.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern void grGetDeviceModes( const char* device_name,
|
||||
int *num_modes,
|
||||
grPixelMode* *pixel_modes );
|
||||
@ -469,7 +469,7 @@
|
||||
* you can thus discard the 'bitmap' parameter after the call.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern grSurface* grNewSurface( const char* device,
|
||||
grBitmap* bitmap );
|
||||
|
||||
@ -493,7 +493,7 @@
|
||||
* height :: rectangle height in pixels
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern void grRefreshRectangle( grSurface* surface,
|
||||
grPos x,
|
||||
grPos y,
|
||||
@ -508,7 +508,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* a variation of grRefreshRectangle which repaints the whole surface
|
||||
* to the screen.
|
||||
* to the screen.
|
||||
*
|
||||
* <Input>
|
||||
* surface :: handle to target surface
|
||||
@ -542,7 +542,7 @@
|
||||
* color :: color to be used to draw the character
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
void grWriteSurfaceChar( grSurface* target,
|
||||
int x,
|
||||
@ -567,14 +567,14 @@
|
||||
* This function writes a string with the internal font
|
||||
*
|
||||
* <Input>
|
||||
* target :: handle to target bitmap
|
||||
* target :: handle to target bitmap
|
||||
* x :: x pixel position of string's top left corner
|
||||
* y :: y pixel position of string's top left corner
|
||||
* string :: Latin-1 text string
|
||||
* color :: color to be used to draw the character
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
void grWriteSurfaceString( grSurface* target,
|
||||
int x,
|
||||
@ -622,7 +622,7 @@
|
||||
* XXX : For now, only keypresses are supported.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
int grListenSurface( grSurface* surface,
|
||||
int event_mask,
|
||||
|
@ -32,7 +32,7 @@
|
||||
case gr_pixel_mode_pal4:
|
||||
width = (width + 1) & -2;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -82,7 +82,7 @@
|
||||
case gr_pixel_mode_pal4:
|
||||
target_width = (target_width + 1) & -2;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -104,7 +104,7 @@
|
||||
|
||||
blit->read_line = blit->source.pitch;
|
||||
blit->write_line = blit->target.pitch;
|
||||
|
||||
|
||||
if ( blit->read_line < 0 )
|
||||
blit->read -= (blit->source.rows-1) * blit->read_line;
|
||||
|
||||
@ -247,7 +247,7 @@
|
||||
{
|
||||
if ( mask == 0x80 )
|
||||
val = *_read++;
|
||||
|
||||
|
||||
if ( val & mask )
|
||||
*_write = (unsigned char)color.value;
|
||||
|
||||
@ -344,7 +344,7 @@
|
||||
unsigned int left_mask;
|
||||
unsigned char* read;
|
||||
unsigned char* write;
|
||||
|
||||
|
||||
read = blit->read + (blit->xread >> 3);
|
||||
write = blit->write + blit->xwrite*2;
|
||||
|
||||
@ -396,7 +396,7 @@
|
||||
unsigned int left_mask;
|
||||
unsigned char* read;
|
||||
unsigned char* write;
|
||||
|
||||
|
||||
read = blit->read + (blit->xread >> 3);
|
||||
write = blit->write + blit->xwrite*3;
|
||||
|
||||
@ -452,7 +452,7 @@
|
||||
unsigned int left_mask;
|
||||
unsigned char* read;
|
||||
unsigned char* write;
|
||||
|
||||
|
||||
read = blit->read + (blit->xread >> 3);
|
||||
write = blit->write + blit->xwrite*4;
|
||||
|
||||
@ -523,19 +523,19 @@
|
||||
{
|
||||
int count;
|
||||
const byte* table;
|
||||
|
||||
|
||||
} grSaturation;
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
const byte gr_saturation_5[8] = { 0, 1, 2, 3, 4, 4, 4, 4 };
|
||||
|
||||
|
||||
|
||||
static
|
||||
const byte gr_saturation_17[32] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
};
|
||||
|
||||
|
||||
@ -565,7 +565,7 @@
|
||||
grError = gr_err_bad_argument;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
for ( ; sat < limit; sat++ )
|
||||
{
|
||||
if ( sat->count == num_grays )
|
||||
@ -574,25 +574,25 @@
|
||||
return sat->table;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* not found, simply create a new entry if there is room */
|
||||
if (gr_num_saturations < GR_MAX_SATURATIONS)
|
||||
{
|
||||
int i;
|
||||
const byte* table;
|
||||
|
||||
|
||||
table = (const byte*)grAlloc( (3*num_grays-1)*sizeof(byte) );
|
||||
if (!table) return 0;
|
||||
|
||||
|
||||
sat->count = num_grays;
|
||||
sat->table = table;
|
||||
|
||||
|
||||
for ( i = 0; i < num_grays; i++, table++ )
|
||||
*(unsigned char*)table = (unsigned char)i;
|
||||
|
||||
*(unsigned char*)table = (unsigned char)i;
|
||||
|
||||
for ( i = 2*num_grays-1; i > 0; i--, table++ )
|
||||
*(unsigned char*)table = (unsigned char)(num_grays-1);
|
||||
|
||||
*(unsigned char*)table = (unsigned char)(num_grays-1);
|
||||
|
||||
gr_num_saturations++;
|
||||
gr_last_saturation = sat;
|
||||
return sat->table;
|
||||
@ -614,11 +614,11 @@
|
||||
int target_grays;
|
||||
int source_grays;
|
||||
const byte* table;
|
||||
|
||||
|
||||
} grConversion;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
const byte gr_gray5_to_gray17[5] = { 0, 4, 8, 12, 16 };
|
||||
|
||||
@ -654,13 +654,13 @@
|
||||
{
|
||||
grConversion* conv = gr_conversions;
|
||||
grConversion* limit = conv + gr_num_conversions;
|
||||
|
||||
|
||||
if ( target_grays < 2 || source_grays < 2 )
|
||||
{
|
||||
grError = gr_err_bad_argument;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* otherwise, scan table */
|
||||
for ( ; conv < limit; conv++ )
|
||||
{
|
||||
@ -671,7 +671,7 @@
|
||||
return conv->table;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* not found, add a new conversion to the table */
|
||||
if (gr_num_conversions < GR_MAX_CONVERSIONS)
|
||||
{
|
||||
@ -681,15 +681,15 @@
|
||||
table = (const byte*)grAlloc( source_grays*sizeof(byte) );
|
||||
if (!table)
|
||||
return 0;
|
||||
|
||||
|
||||
conv->target_grays = target_grays;
|
||||
conv->source_grays = source_grays;
|
||||
conv->table = table;
|
||||
|
||||
for ( n = 0; n < source_grays; n++ )
|
||||
((unsigned char*)table)[n] = (unsigned char)(n*(target_grays-1)) /
|
||||
((unsigned char*)table)[n] = (unsigned char)(n*(target_grays-1)) /
|
||||
(source_grays-1);
|
||||
|
||||
|
||||
gr_num_conversions++;
|
||||
gr_last_conversion = conv;
|
||||
return table;
|
||||
@ -720,7 +720,7 @@
|
||||
|
||||
max1 = (unsigned char)(blit->source.grays-1);
|
||||
max2 = (unsigned char)(blit->target.grays-1);
|
||||
|
||||
|
||||
read = (unsigned char*)blit->read + blit->xread;
|
||||
write = (unsigned char*)blit->write + blit->xwrite;
|
||||
|
||||
@ -735,7 +735,7 @@
|
||||
{
|
||||
#ifdef GR_CONFIG_GRAY_SKIP_WHITE
|
||||
unsigned char val = *_read;
|
||||
|
||||
|
||||
if (val)
|
||||
{
|
||||
if (val == max)
|
||||
@ -750,7 +750,7 @@
|
||||
_read++;
|
||||
x--;
|
||||
}
|
||||
|
||||
|
||||
read += blit->read_line;
|
||||
write += blit->write_line;
|
||||
y--;
|
||||
@ -775,7 +775,7 @@
|
||||
unsigned char max;
|
||||
|
||||
max = (unsigned char)(blit->source.grays-1);
|
||||
|
||||
|
||||
read = (unsigned char*)blit->read + blit->xread;
|
||||
write = (unsigned char*)blit->write + blit->xwrite;
|
||||
|
||||
@ -790,7 +790,7 @@
|
||||
{
|
||||
#ifdef GR_CONFIG_GRAY_SKIP_WHITE
|
||||
unsigned char val = *_read;
|
||||
|
||||
|
||||
if (val)
|
||||
{
|
||||
if (val == max)
|
||||
@ -805,7 +805,7 @@
|
||||
_read++;
|
||||
x--;
|
||||
}
|
||||
|
||||
|
||||
read += blit->read_line;
|
||||
write += blit->write_line;
|
||||
y--;
|
||||
@ -834,7 +834,7 @@
|
||||
color.chroma[0] = (pixel >> 10) & 0x1F; \
|
||||
color.chroma[1] = (pixel >> 5) & 0x1F; \
|
||||
color.chroma[2] = (pixel ) & 0x1F;
|
||||
|
||||
|
||||
|
||||
#define extract565( pixel, color ) \
|
||||
color.chroma[0] = (pixel >> 11) & 0x1F; \
|
||||
@ -846,13 +846,13 @@
|
||||
( ( (unsigned short)color.chroma[0] << 10 ) | \
|
||||
( (unsigned short)color.chroma[1] << 5 ) | \
|
||||
color.chroma[2] )
|
||||
|
||||
|
||||
|
||||
#define inject565( color ) \
|
||||
( ( (unsigned short)color.chroma[0] << 11 ) | \
|
||||
( (unsigned short)color.chroma[1] << 5 ) | \
|
||||
color.chroma[2] )
|
||||
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
@ -872,7 +872,7 @@
|
||||
|
||||
read = blit->read + blit->xread;
|
||||
write = blit->write + 2*blit->xwrite;
|
||||
|
||||
|
||||
/* convert color to R:G:B triplet */
|
||||
color2 = color.value;
|
||||
extract555( color2, color );
|
||||
@ -887,12 +887,12 @@
|
||||
while (x > 0)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
|
||||
val = *_read;
|
||||
if (val)
|
||||
{
|
||||
unsigned short* pixel = (unsigned short*)_write;
|
||||
|
||||
|
||||
if (val == max)
|
||||
{
|
||||
pixel[0] = (short)color2;
|
||||
@ -902,18 +902,18 @@
|
||||
/* compose gray value */
|
||||
unsigned short pix16 = *pixel;
|
||||
grColor pix;
|
||||
|
||||
|
||||
extract555( pix16, pix );
|
||||
|
||||
compose_pixel( pix, color, val, max );
|
||||
*pixel = inject555(pix);
|
||||
}
|
||||
}
|
||||
}
|
||||
_write += 2;
|
||||
_read ++;
|
||||
x--;
|
||||
}
|
||||
|
||||
|
||||
read += blit->read_line;
|
||||
write += blit->write_line;
|
||||
y--;
|
||||
@ -940,7 +940,7 @@
|
||||
|
||||
read = blit->read + blit->xread;
|
||||
write = blit->write + 2*blit->xwrite;
|
||||
|
||||
|
||||
color2 = color.value;
|
||||
extract565( color2, color );
|
||||
|
||||
@ -954,12 +954,12 @@
|
||||
while (x > 0)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
|
||||
val = *_read;
|
||||
if (val)
|
||||
{
|
||||
unsigned short* pixel = (unsigned short*)_write;
|
||||
|
||||
|
||||
if (val == max)
|
||||
{
|
||||
pixel[0] = (short)color2;
|
||||
@ -970,17 +970,17 @@
|
||||
unsigned short pix16 = *pixel;
|
||||
grColor pix;
|
||||
|
||||
extract565( pix16, pix );
|
||||
extract565( pix16, pix );
|
||||
|
||||
compose_pixel( pix, color, val, max );
|
||||
*pixel = inject565( pix );
|
||||
}
|
||||
}
|
||||
}
|
||||
_write +=2;
|
||||
_read ++;
|
||||
x--;
|
||||
}
|
||||
|
||||
|
||||
read += blit->read_line;
|
||||
write += blit->write_line;
|
||||
y--;
|
||||
@ -1006,7 +1006,7 @@
|
||||
|
||||
read = blit->read + blit->xread;
|
||||
write = blit->write + 3*blit->xwrite;
|
||||
|
||||
|
||||
y = blit->height;
|
||||
do
|
||||
{
|
||||
@ -1017,7 +1017,7 @@
|
||||
while (x > 0)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
|
||||
val = *_read;
|
||||
if (val)
|
||||
{
|
||||
@ -1031,23 +1031,23 @@
|
||||
{
|
||||
/* compose gray value */
|
||||
grColor pix;
|
||||
|
||||
|
||||
pix.chroma[0] = _write[0];
|
||||
pix.chroma[1] = _write[1];
|
||||
pix.chroma[2] = _write[2];
|
||||
|
||||
compose_pixel( pix, color, val, max );
|
||||
|
||||
|
||||
_write[0] = pix.chroma[0];
|
||||
_write[1] = pix.chroma[1];
|
||||
_write[2] = pix.chroma[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
_write += 3;
|
||||
_read ++;
|
||||
x--;
|
||||
}
|
||||
|
||||
|
||||
read += blit->read_line;
|
||||
write += blit->write_line;
|
||||
y--;
|
||||
@ -1073,7 +1073,7 @@
|
||||
|
||||
read = blit->read + blit->xread;
|
||||
write = blit->write + 4*blit->xwrite;
|
||||
|
||||
|
||||
y = blit->height;
|
||||
do
|
||||
{
|
||||
@ -1084,7 +1084,7 @@
|
||||
while (x > 0)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
|
||||
val = *_read;
|
||||
if (val)
|
||||
{
|
||||
@ -1099,23 +1099,23 @@
|
||||
{
|
||||
/* compose gray value */
|
||||
grColor pix;
|
||||
|
||||
|
||||
pix.chroma[0] = _write[0];
|
||||
pix.chroma[1] = _write[1];
|
||||
pix.chroma[2] = _write[2];
|
||||
|
||||
compose_pixel( pix, color, val, max );
|
||||
|
||||
|
||||
_write[0] = pix.chroma[0];
|
||||
_write[1] = pix.chroma[1];
|
||||
_write[2] = pix.chroma[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
_write += 4;
|
||||
_read ++;
|
||||
x--;
|
||||
}
|
||||
|
||||
|
||||
read += blit->read_line;
|
||||
write += blit->write_line;
|
||||
y--;
|
||||
@ -1142,7 +1142,7 @@
|
||||
* Error code. 0 means success
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
typedef void (*grColorGlyphBlitter)( grBlitter* blit,
|
||||
grColor color,
|
||||
int max_gray );
|
||||
@ -1158,9 +1158,9 @@
|
||||
blit_gray_to_565,
|
||||
blit_gray_to_24,
|
||||
blit_gray_to_32
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern int grBlitGlyphToBitmap( grBitmap* target,
|
||||
grBitmap* glyph,
|
||||
grPos x,
|
||||
@ -1169,14 +1169,14 @@
|
||||
{
|
||||
grBlitter blit;
|
||||
grPixelMode mode;
|
||||
|
||||
|
||||
/* check arguments */
|
||||
if (!target || !glyph)
|
||||
{
|
||||
grError = gr_err_bad_argument;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* set up blitter and compute clipping. Return immediately if needed */
|
||||
blit.source = *glyph;
|
||||
@ -1185,7 +1185,7 @@
|
||||
|
||||
if ( compute_clips( &blit, x, y ) )
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
/* handle monochrome bitmap blitting */
|
||||
if (glyph->mode == gr_pixel_mode_mono)
|
||||
@ -1195,11 +1195,11 @@
|
||||
grError = gr_err_bad_source_depth;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
gr_mono_blitters[mode]( &blit, color );
|
||||
goto End;
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
||||
/* handle gray bitmap composition */
|
||||
if (glyph->mode == gr_pixel_mode_gray &&
|
||||
glyph->grays > 1 )
|
||||
@ -1207,7 +1207,7 @@
|
||||
int target_grays = target->grays;
|
||||
int source_grays = glyph->grays;
|
||||
const byte* saturation;
|
||||
|
||||
|
||||
if ( mode == gr_pixel_mode_gray && target_grays > 1 )
|
||||
{
|
||||
/* rendering into a gray target - use special composition */
|
||||
@ -1235,7 +1235,7 @@
|
||||
conversion = grGetConversion( target_grays, source_grays );
|
||||
if (!conversion) return -3;
|
||||
};
|
||||
|
||||
|
||||
blit_gray_to_gray( &blit, saturation, conversion );
|
||||
}
|
||||
}
|
||||
@ -1248,18 +1248,18 @@
|
||||
grError = gr_err_bad_target_depth;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
gr_color_blitters[mode]( &blit, color, source_grays-1 );
|
||||
}
|
||||
goto End;
|
||||
goto End;
|
||||
}
|
||||
|
||||
|
||||
/* we don't support the blitting of bitmaps of the following */
|
||||
/* types : pal4, pal8, rgb555, rgb565, rgb24, rgb32 */
|
||||
/* */
|
||||
grError = gr_err_bad_source_depth;
|
||||
return -2;
|
||||
|
||||
|
||||
End:
|
||||
return 0;
|
||||
}
|
||||
|
@ -10,20 +10,20 @@
|
||||
grDevice* find_device( const char* device_name )
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
|
||||
if (device_name)
|
||||
{
|
||||
for ( index = gr_num_devices-1; index > 0; index-- )
|
||||
if ( strcmp( device_name, gr_device_chain[index].name ) == 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( index < 0 || gr_num_devices <= 0 || !gr_device_chain[index].device )
|
||||
{
|
||||
grError = gr_err_invalid_device;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return gr_device_chain[index].device;
|
||||
}
|
||||
|
||||
@ -62,18 +62,18 @@
|
||||
* 2 and 256.
|
||||
*
|
||||
* the pixel modes do not provide the number of grays in the case
|
||||
* of "gray" devices. You should try to create a surface with the
|
||||
* of "gray" devices. You should try to create a surface with the
|
||||
* maximal number (256, that is) and see the value returned in
|
||||
* the bitmap descriptor.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern void grGetDeviceModes( const char* device_name,
|
||||
int *num_modes,
|
||||
grPixelMode* *pixel_modes )
|
||||
{
|
||||
grDevice* device;
|
||||
|
||||
|
||||
*num_modes = 0;
|
||||
*pixel_modes = 0;
|
||||
|
||||
@ -132,7 +132,7 @@
|
||||
* you can thus discard the 'bitmap' parameter after the call.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern grSurface* grNewSurface( const char* device_name,
|
||||
grBitmap* bitmap )
|
||||
{
|
||||
@ -145,7 +145,7 @@
|
||||
|
||||
surface = (grSurface*)grAlloc( device->surface_objsize );
|
||||
if (!surface) return 0;
|
||||
|
||||
|
||||
if ( !device->init_surface( surface, bitmap ) )
|
||||
{
|
||||
grFree( surface );
|
||||
@ -173,7 +173,7 @@
|
||||
* height :: rectangle height in pixels
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern void grRefreshRectangle( grSurface* surface,
|
||||
grPos x,
|
||||
grPos y,
|
||||
@ -185,7 +185,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* <Function>
|
||||
@ -209,7 +209,7 @@
|
||||
* color :: color to be used to draw the character
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
void grWriteSurfaceChar( grSurface* target,
|
||||
int x,
|
||||
@ -239,14 +239,14 @@
|
||||
* This function writes a string with the internal font
|
||||
*
|
||||
* <Input>
|
||||
* target :: handle to target bitmap
|
||||
* target :: handle to target bitmap
|
||||
* x :: x pixel position of string's top left corner
|
||||
* y :: y pixel position of string's top left corner
|
||||
* string :: Latin-1 text string
|
||||
* color :: color to be used to draw the character
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
void grWriteSurfaceString( grSurface* target,
|
||||
int x,
|
||||
@ -270,7 +270,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* a variation of grRefreshRectangle which repaints the whole surface
|
||||
* to the screen.
|
||||
* to the screen.
|
||||
*
|
||||
* <Input>
|
||||
* surface :: handle to target surface
|
||||
@ -330,7 +330,7 @@
|
||||
* XXX : For now, only keypresses are supported.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
extern
|
||||
int grListenSurface( grSurface* surface,
|
||||
int event_mask,
|
||||
@ -348,12 +348,12 @@
|
||||
{
|
||||
/* first of all, call the device-specific destructor */
|
||||
surface->done(surface);
|
||||
|
||||
|
||||
/* then remove the bitmap if we're owner */
|
||||
if (surface->owner)
|
||||
grFree( surface->bitmap.buffer );
|
||||
|
||||
surface->owner = 0;
|
||||
|
||||
surface->owner = 0;
|
||||
surface->bitmap.buffer = 0;
|
||||
grFree( surface );
|
||||
}
|
||||
|
@ -108,14 +108,14 @@
|
||||
{
|
||||
int surface_objsize;
|
||||
const char* device_name; /* name of device */
|
||||
|
||||
|
||||
grDeviceInitFunc init;
|
||||
grDeviceDoneFunc done;
|
||||
|
||||
grDeviceInitSurfaceFunc init_surface;
|
||||
|
||||
int num_pixel_modes;
|
||||
grPixelMode* pixel_modes;
|
||||
grPixelMode* pixel_modes;
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,13 +19,13 @@
|
||||
#define gr_event_mouse 0x3C
|
||||
#define gr_event_key 0xC0
|
||||
|
||||
#define gr_event_type (gr_event_mouse | gr_event_key)
|
||||
#define gr_event_type (gr_event_mouse | gr_event_key)
|
||||
|
||||
|
||||
typedef enum grKey_
|
||||
{
|
||||
grKeyNone = 0,
|
||||
|
||||
|
||||
grKeyF1,
|
||||
grKeyF2,
|
||||
grKeyF3,
|
||||
@ -38,12 +38,12 @@
|
||||
grKeyF10,
|
||||
grKeyF11,
|
||||
grKeyF12,
|
||||
|
||||
|
||||
grKeyLeft,
|
||||
grKeyRight,
|
||||
grKeyUp,
|
||||
grKeyDown,
|
||||
|
||||
|
||||
grKeyIns,
|
||||
grKeyDel,
|
||||
grKeyHome,
|
||||
@ -51,7 +51,7 @@
|
||||
grKeyPageUp,
|
||||
grKeyPageDown,
|
||||
|
||||
grKeyEsc,
|
||||
grKeyEsc,
|
||||
grKeyTab,
|
||||
grKeyBackSpace,
|
||||
grKeyReturn,
|
||||
@ -59,7 +59,7 @@
|
||||
grKeyMax,
|
||||
grKeyForceShort = 0x7FFF /* this forces the grKey to be stored */
|
||||
/* on at least one short ! */
|
||||
|
||||
|
||||
} grKey;
|
||||
|
||||
#define grKEY(c) ((grKey)(c))
|
||||
@ -102,7 +102,7 @@
|
||||
#define grKeyAt grKEY('@')
|
||||
#define grKeyUnder grKEY('_')
|
||||
|
||||
|
||||
|
||||
typedef struct grEvent_
|
||||
{
|
||||
int type;
|
||||
|
@ -283,12 +283,12 @@
|
||||
{
|
||||
if (charcode < 0 || charcode > 255)
|
||||
return;
|
||||
|
||||
|
||||
gr_charcell.buffer = (char*)font_8x8 + 8*charcode;
|
||||
grBlitGlyphToBitmap( target, &gr_charcell, x, y, color );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void grWriteCellString( grBitmap* target,
|
||||
int x,
|
||||
int y,
|
||||
@ -302,7 +302,7 @@
|
||||
x += 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int gr_cursor_x = 0;
|
||||
static int gr_cursor_y = 0;
|
||||
static grBitmap* gr_text_bitmap = 0;
|
||||
@ -313,19 +313,19 @@
|
||||
{
|
||||
gr_text_bitmap = bitmap;
|
||||
}
|
||||
|
||||
|
||||
extern void grSetMargin( int right, int top )
|
||||
{
|
||||
gr_margin_top = top << 3;
|
||||
gr_margin_right = right << 3;
|
||||
}
|
||||
|
||||
|
||||
extern void grGotoxy ( int x, int y )
|
||||
{
|
||||
gr_cursor_x = x;
|
||||
gr_cursor_y = y;
|
||||
}
|
||||
|
||||
|
||||
extern void grWrite ( const char* string )
|
||||
{
|
||||
if (string)
|
||||
@ -338,11 +338,11 @@
|
||||
gr_margin_top + (gr_cursor_y << 3),
|
||||
string,
|
||||
color );
|
||||
|
||||
|
||||
gr_cursor_x += strlen(string);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void grLn()
|
||||
{
|
||||
gr_cursor_y ++;
|
||||
@ -355,4 +355,4 @@
|
||||
grLn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -11,6 +11,6 @@
|
||||
|
||||
extern void grWrite ( const char* string );
|
||||
extern void grWriteln( const char* string );
|
||||
extern void grLn();
|
||||
extern void grLn();
|
||||
|
||||
#endif /* GRFONT_H */
|
||||
|
@ -62,7 +62,7 @@
|
||||
device = chain->device;
|
||||
if ( device->init() == 0 &&
|
||||
gr_num_devices < GR_MAX_DEVICES )
|
||||
|
||||
|
||||
{
|
||||
/* successful device initialisation - add it to our chain */
|
||||
cur->next = 0;
|
||||
|
@ -25,16 +25,16 @@
|
||||
char* grAlloc( long size )
|
||||
{
|
||||
char* p;
|
||||
|
||||
|
||||
p = (char*)malloc(size);
|
||||
if (!p && size > 0)
|
||||
{
|
||||
grError = gr_err_memory;
|
||||
grError = gr_err_memory;
|
||||
}
|
||||
|
||||
|
||||
if (p)
|
||||
memset( p, 0, size );
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
char* grRealloc( const char* block, long size )
|
||||
{
|
||||
char* p;
|
||||
|
||||
|
||||
p = realloc( (char*)block, size );
|
||||
if (!p && size > 0)
|
||||
{
|
||||
@ -97,7 +97,7 @@
|
||||
if ( pixel_mode <= gr_pixel_mode_none ||
|
||||
pixel_mode >= gr_pixel_mode_max )
|
||||
goto Fail;
|
||||
|
||||
|
||||
if ( pixel_mode != gr_pixel_mode_gray ||
|
||||
( num_grays >= 2 && num_grays < 256 ) )
|
||||
return 0;
|
||||
@ -114,7 +114,7 @@
|
||||
* grNewBitmap
|
||||
*
|
||||
* <Description>
|
||||
* creates a new bitmap
|
||||
* creates a new bitmap
|
||||
*
|
||||
* <Input>
|
||||
* pixel_mode :: the target surface's pixel_mode
|
||||
@ -160,28 +160,28 @@
|
||||
{
|
||||
case gr_pixel_mode_mono : pitch = (width+7) >> 3; break;
|
||||
case gr_pixel_mode_pal4 : pitch = (width+3) >> 2; break;
|
||||
|
||||
|
||||
case gr_pixel_mode_pal8 :
|
||||
case gr_pixel_mode_gray : pitch = width; break;
|
||||
|
||||
|
||||
case gr_pixel_mode_rgb555:
|
||||
case gr_pixel_mode_rgb565: pitch = width*2; break;
|
||||
|
||||
|
||||
case gr_pixel_mode_rgb24 : pitch = width*3; break;
|
||||
|
||||
|
||||
case gr_pixel_mode_rgb32 : pitch = width*4; break;
|
||||
|
||||
|
||||
default:
|
||||
grError = gr_err_bad_target_depth;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bit->pitch = pitch;
|
||||
bit->buffer = grAlloc( (long)bit->pitch * bit->rows );
|
||||
if (!bit->buffer) goto Fail;
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
Fail:
|
||||
return grError;
|
||||
}
|
||||
@ -192,7 +192,7 @@
|
||||
* grDoneBitmap
|
||||
*
|
||||
* <Description>
|
||||
* destroys a bitmap
|
||||
* destroys a bitmap
|
||||
*
|
||||
* <Input>
|
||||
* bitmap :: handle to bitmap descriptor
|
||||
|
@ -23,7 +23,7 @@
|
||||
{
|
||||
grColor foreground;
|
||||
grColor background;
|
||||
|
||||
|
||||
int num_levels;
|
||||
int max_levels;
|
||||
grColor* levels;
|
||||
@ -97,13 +97,13 @@
|
||||
int y,
|
||||
int width,
|
||||
int height );
|
||||
|
||||
|
||||
typedef void (*grDoneSurfaceFunc)( grSurface* surface );
|
||||
|
||||
typedef int (*grListenEventFunc)( grSurface* surface,
|
||||
int event_mode,
|
||||
grEvent *event );
|
||||
|
||||
|
||||
|
||||
|
||||
struct grSurface_
|
||||
@ -112,7 +112,7 @@
|
||||
grBitmap bitmap;
|
||||
grBool refresh;
|
||||
grBool owner;
|
||||
|
||||
|
||||
const byte* saturation; /* used for gray surfaces only */
|
||||
grBlitterFunc blit_mono; /* 0 by default, set by grBlit.. */
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
********************************************************************/
|
||||
|
||||
extern char* grAlloc( long size );
|
||||
|
||||
|
||||
|
||||
/********************************************************************
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct grDimension_
|
||||
{
|
||||
int x;
|
||||
|
@ -298,7 +298,7 @@ grSurface* init_surface( grSurface* surface,
|
||||
case gr_pixel_mode_gray:
|
||||
thePixMap.cmpSize = 8;
|
||||
thePixMap.pixelSize = 8;
|
||||
thePixMap.pmTable = GetCTable(256); /* color palette matching FT's idea
|
||||
thePixMap.pmTable = GetCTable(256); /* color palette matching FT's idea
|
||||
of grayscale. See ftview.rsrc */
|
||||
break;
|
||||
|
||||
|
@ -35,9 +35,9 @@
|
||||
{
|
||||
ULONG os2key;
|
||||
grKey grkey;
|
||||
|
||||
|
||||
} Translator;
|
||||
|
||||
|
||||
|
||||
static
|
||||
Translator key_translators[] =
|
||||
@ -296,7 +296,7 @@
|
||||
WinUpdateWindow( surface->frame_window );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void set_title( grPMSurface* surface,
|
||||
const char* title )
|
||||
@ -319,7 +319,7 @@
|
||||
|
||||
|
||||
|
||||
static
|
||||
static
|
||||
void listen_event( grPMSurface* surface,
|
||||
int event_mask,
|
||||
grEvent* grevent )
|
||||
@ -517,7 +517,7 @@
|
||||
the_surface = surface;
|
||||
|
||||
LOG(( "Os2PM: RunPMWindow( %08lx )\n", (long)surface ));
|
||||
|
||||
|
||||
/* create an anchor to allow this thread to use PM */
|
||||
surface->anchor = WinInitialize(0);
|
||||
if (!surface->anchor)
|
||||
@ -546,8 +546,8 @@
|
||||
}
|
||||
|
||||
/* create the PM window */
|
||||
class_flags = FCF_TITLEBAR | FCF_MINBUTTON | FCF_DLGBORDER |
|
||||
FCF_TASKLIST | FCF_SYSMENU;
|
||||
class_flags = FCF_TITLEBAR | FCF_MINBUTTON | FCF_DLGBORDER |
|
||||
FCF_TASKLIST | FCF_SYSMENU;
|
||||
|
||||
LOG(( "Os2PM: RunPMWindow: Creating window\n" ));
|
||||
surface->frame_window = WinCreateStdWindow(
|
||||
@ -669,7 +669,7 @@
|
||||
case WM_MINMAXFRAME:
|
||||
/* to update minimized if changed */
|
||||
swp = *((PSWP) parm1);
|
||||
if ( swp.fl & SWP_MINIMIZE )
|
||||
if ( swp.fl & SWP_MINIMIZE )
|
||||
minimized = TRUE;
|
||||
if ( swp.fl & SWP_RESTORE )
|
||||
minimized = FALSE;
|
||||
@ -677,11 +677,11 @@
|
||||
break;
|
||||
|
||||
case WM_ERASEBACKGROUND:
|
||||
case WM_PAINT:
|
||||
case WM_PAINT:
|
||||
/* copy the memory image of the screen out to the real screen */
|
||||
DosRequestMutexSem( surface->image_lock, SEM_INDEFINITE_WAIT );
|
||||
WinBeginPaint( handle, screen_ps, NULL );
|
||||
|
||||
|
||||
/* main image and magnified picture */
|
||||
GpiBitBlt( screen_ps,
|
||||
surface->image_ps,
|
||||
@ -690,7 +690,7 @@
|
||||
ROP_SRCCOPY, BBO_AND );
|
||||
|
||||
WinEndPaint( screen_ps );
|
||||
DosReleaseMutexSem( surface->image_lock );
|
||||
DosReleaseMutexSem( surface->image_lock );
|
||||
break;
|
||||
|
||||
case WM_HELP: /* this really is a F1 Keypress !! */
|
||||
@ -740,15 +740,15 @@
|
||||
{
|
||||
sizeof( grPMSurface ),
|
||||
"os2pm",
|
||||
|
||||
|
||||
init_device,
|
||||
done_device,
|
||||
|
||||
|
||||
(grDeviceInitSurfaceFunc) init_surface,
|
||||
|
||||
|
||||
0,
|
||||
0
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -64,9 +64,9 @@
|
||||
{
|
||||
ULONG winkey;
|
||||
grKey grkey;
|
||||
|
||||
|
||||
} Translator;
|
||||
|
||||
|
||||
static
|
||||
Translator key_translators[] =
|
||||
{
|
||||
@ -105,7 +105,7 @@
|
||||
/* This is a minimalist driver, it is only able to display */
|
||||
/* a _single_ window. Moreover, only monochrome and gray */
|
||||
/* bitmaps are supported.. */
|
||||
|
||||
|
||||
/* handle of the window. */
|
||||
static HWND hwndGraphic;
|
||||
|
||||
@ -170,7 +170,7 @@ void done_surface( grSurface* surface )
|
||||
|
||||
row_bytes = surface->bitmap.pitch;
|
||||
if (row_bytes < 0) row_bytes = -row_bytes;
|
||||
|
||||
|
||||
if ( row_bytes*8 != pbmi->bmiHeader.biWidth * pbmi->bmiHeader.biBitCount )
|
||||
pbmi->bmiHeader.biWidth = row_bytes * 8 / pbmi->bmiHeader.biBitCount;
|
||||
|
||||
@ -181,7 +181,7 @@ void done_surface( grSurface* surface )
|
||||
surface->bitmap.buffer,
|
||||
pbmi,
|
||||
DIB_RGB_COLORS );
|
||||
|
||||
|
||||
ReleaseDC ( hwndGraphic, hDC );
|
||||
|
||||
ShowWindow( hwndGraphic, SW_SHOW );
|
||||
@ -193,7 +193,7 @@ void done_surface( grSurface* surface )
|
||||
void set_title( grSurface* surface, const char* title )
|
||||
{
|
||||
(void)surface;
|
||||
|
||||
|
||||
/* the title will be set on the next listen_event, just */
|
||||
/* record it there.. */
|
||||
the_title = title;
|
||||
@ -206,17 +206,17 @@ void done_surface( grSurface* surface )
|
||||
grEvent* grevent )
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
|
||||
(void)surface;
|
||||
(void)event_mask;
|
||||
|
||||
|
||||
if ( hwndGraphic && !title_set )
|
||||
{
|
||||
SetWindowText( hwndGraphic, the_title );
|
||||
title_set = 1;
|
||||
}
|
||||
|
||||
eventToProcess = 0;
|
||||
eventToProcess = 0;
|
||||
while (GetMessage( &msg, 0, 0, 0 ))
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
@ -224,7 +224,7 @@ void done_surface( grSurface* surface )
|
||||
if (eventToProcess)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*grevent = ourevent;
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ grSurface* init_surface( grSurface* surface,
|
||||
{
|
||||
static RGBQUAD black = { 0, 0, 0, 0 };
|
||||
static RGBQUAD white = { 0xFF, 0xFF, 0xFF, 0 };
|
||||
|
||||
|
||||
if( ! RegisterTheClass() ) return 0; /* if already running, fails. */
|
||||
|
||||
/* find some memory for the bitmap header */
|
||||
@ -298,7 +298,7 @@ grSurface* init_surface( grSurface* surface,
|
||||
int count = bitmap->grays;
|
||||
int x;
|
||||
RGBQUAD* color = pbmi->bmiColors;
|
||||
|
||||
|
||||
for ( x = 0; x < count; x++, color++ )
|
||||
{
|
||||
color->rgbRed =
|
||||
@ -324,7 +324,7 @@ grSurface* init_surface( grSurface* surface,
|
||||
free ( pbmi );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
surface->done = (grDoneSurfaceFunc) done_surface;
|
||||
surface->refresh_rect = (grRefreshRectFunc) refresh_rectangle;
|
||||
surface->set_title = (grSetTitleFunc) set_title;
|
||||
@ -452,7 +452,7 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
|
||||
return DefWindowProc( handle, mess, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
|
||||
case WM_KEYDOWN:
|
||||
switch ( wParam )
|
||||
{
|
||||
@ -476,7 +476,7 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
|
||||
goto Do_Key_Event;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* the key isn't found, default processing */
|
||||
/* return DefWindowProc( handle, mess, wParam, lParam ); */
|
||||
return DefWindowProc( handle, mess, wParam, lParam );
|
||||
@ -485,7 +485,7 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
|
||||
case WM_CHAR:
|
||||
{
|
||||
ourevent.key = wParam;
|
||||
|
||||
|
||||
Do_Key_Event:
|
||||
ourevent.type = gr_event_key;
|
||||
eventToProcess = 1;
|
||||
@ -511,12 +511,12 @@ LRESULT CALLBACK Message_Process( HWND handle, UINT mess,
|
||||
{
|
||||
sizeof( grSurface ),
|
||||
"win32",
|
||||
|
||||
|
||||
init_device,
|
||||
done_device,
|
||||
|
||||
|
||||
(grDeviceInitSurfaceFunc) init_surface,
|
||||
|
||||
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
@ -24,9 +24,9 @@
|
||||
{
|
||||
KeySym xkey;
|
||||
grKey grkey;
|
||||
|
||||
|
||||
} Translator;
|
||||
|
||||
|
||||
static
|
||||
Translator key_translators[] =
|
||||
{
|
||||
@ -59,9 +59,9 @@
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
|
||||
#define grAlloc malloc
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
typedef XPixmapFormatValues XDepth;
|
||||
|
||||
static int num_pixel_modes = 0;
|
||||
static grPixelMode pixel_modes[ MAX_PIXEL_MODES ];
|
||||
static grPixelMode pixel_modes[ MAX_PIXEL_MODES ];
|
||||
static XDepth pixel_depth[ MAX_PIXEL_MODES ];
|
||||
|
||||
typedef struct grXSurface_
|
||||
@ -90,9 +90,9 @@
|
||||
int depth;
|
||||
XDepth* xdepth;
|
||||
Bool gray;
|
||||
|
||||
|
||||
GC gc;
|
||||
|
||||
|
||||
XColor color[256]; /* gray levels palette for 8-bit modes */
|
||||
XImage* ximage;
|
||||
|
||||
@ -100,10 +100,10 @@
|
||||
int win_org_y;
|
||||
int win_width;
|
||||
int win_height;
|
||||
|
||||
|
||||
int image_width;
|
||||
int image_height;
|
||||
|
||||
|
||||
} grXSurface;
|
||||
|
||||
|
||||
@ -133,10 +133,10 @@
|
||||
{
|
||||
if ( num_pixel_modes >= MAX_PIXEL_MODES )
|
||||
Panic( "X11.Too many pixel modes\n" );
|
||||
|
||||
|
||||
pixel_modes[ num_pixel_modes ] = pixel_mode;
|
||||
pixel_depth[ num_pixel_modes ] = *depth;
|
||||
|
||||
|
||||
num_pixel_modes++;
|
||||
}
|
||||
|
||||
@ -146,21 +146,21 @@
|
||||
int init_device( void )
|
||||
{
|
||||
XDepth dummy;
|
||||
|
||||
|
||||
XrmInitialize();
|
||||
|
||||
|
||||
display = XOpenDisplay( displayname );
|
||||
if (!display)
|
||||
{
|
||||
return -1;
|
||||
/* Panic( "Gr:error: cannot open X11 display\n" ); */
|
||||
}
|
||||
|
||||
|
||||
idle = XCreateFontCursor( display, XC_left_ptr );
|
||||
busy = XCreateFontCursor( display, XC_watch );
|
||||
|
||||
|
||||
num_pixel_modes = 0;
|
||||
|
||||
|
||||
/* always enable the 8-bit gray levels pixel mode */
|
||||
/* even if its display is emulated through a constrained palette */
|
||||
/* or another color mode */
|
||||
@ -177,45 +177,45 @@
|
||||
|
||||
formats = XListPixmapFormats( display, &count );
|
||||
format = formats;
|
||||
|
||||
|
||||
#ifdef TEST
|
||||
printf( "available pixmap formats\n" );
|
||||
printf( "depth pixbits scanpad\n" );
|
||||
#endif
|
||||
|
||||
|
||||
while ( count-- > 0 )
|
||||
{
|
||||
#ifdef TEST
|
||||
#ifdef TEST
|
||||
printf( " %3d %3d %3d\n",
|
||||
format->depth,
|
||||
format->bits_per_pixel,
|
||||
format->scanline_pad );
|
||||
#endif
|
||||
|
||||
|
||||
if ( format->depth == 1 )
|
||||
/* usually, this should be the first format */
|
||||
add_pixel_mode( gr_pixel_mode_mono, format );
|
||||
|
||||
|
||||
else if ( format->depth == 8 )
|
||||
add_pixel_mode( gr_pixel_mode_pal8, format );
|
||||
|
||||
/* note, the 32-bit modes return a depth of 24, and 32 bits per pixel */
|
||||
/* note, the 32-bit modes return a depth of 24, and 32 bits per pixel */
|
||||
else if ( format->depth == 24 )
|
||||
{
|
||||
#ifdef TEST
|
||||
#ifdef TEST
|
||||
{
|
||||
int count2;
|
||||
XVisualInfo* visuals;
|
||||
XVisualInfo* visual;
|
||||
const char* string = "unknown";
|
||||
|
||||
|
||||
template.depth = format->depth;
|
||||
visuals = XGetVisualInfo( display,
|
||||
VisualDepthMask,
|
||||
&template,
|
||||
&count2 );
|
||||
visual = visuals;
|
||||
|
||||
|
||||
switch (visual->class)
|
||||
{
|
||||
case TrueColor: string = "TrueColor"; break;
|
||||
@ -234,15 +234,15 @@
|
||||
visual->bits_per_rgb,
|
||||
string );
|
||||
visual++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ( format->bits_per_pixel == 24 )
|
||||
add_pixel_mode( gr_pixel_mode_rgb24, format );
|
||||
|
||||
|
||||
else if ( format->bits_per_pixel == 32 )
|
||||
add_pixel_mode( gr_pixel_mode_rgb32, format );
|
||||
}
|
||||
|
||||
|
||||
else if ( format->depth == 16 )
|
||||
{
|
||||
int count2;
|
||||
@ -255,12 +255,12 @@
|
||||
&template,
|
||||
&count2 );
|
||||
visual = visuals;
|
||||
|
||||
|
||||
while ( count2-- > 0 )
|
||||
{
|
||||
#ifdef TEST
|
||||
#ifdef TEST
|
||||
const char* string = "unknown";
|
||||
|
||||
|
||||
switch (visual->class)
|
||||
{
|
||||
case TrueColor: string = "TrueColor"; break;
|
||||
@ -278,34 +278,34 @@
|
||||
visual->colormap_size,
|
||||
visual->bits_per_rgb,
|
||||
string );
|
||||
|
||||
|
||||
#endif
|
||||
if ( visual->red_mask == 0xf800 &&
|
||||
visual->green_mask == 0x07e0 &&
|
||||
visual->blue_mask == 0x001f )
|
||||
add_pixel_mode( gr_pixel_mode_rgb565, format );
|
||||
|
||||
|
||||
else if ( visual->red_mask == 0x7c00 &&
|
||||
visual->green_mask == 0x03e0 &&
|
||||
visual->blue_mask == 0x001f )
|
||||
add_pixel_mode( gr_pixel_mode_rgb555, format );
|
||||
|
||||
/* other 16-bit modes are ignored */
|
||||
|
||||
/* other 16-bit modes are ignored */
|
||||
visual++;
|
||||
}
|
||||
|
||||
|
||||
XFree( visuals );
|
||||
}
|
||||
|
||||
|
||||
format++;
|
||||
}
|
||||
|
||||
|
||||
XFree( formats );
|
||||
}
|
||||
|
||||
|
||||
gr_x11_device.num_pixel_modes = num_pixel_modes;
|
||||
gr_x11_device.pixel_modes = pixel_modes;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -327,13 +327,13 @@
|
||||
byte* write = (byte*)target->buffer + y*target->pitch + x;
|
||||
byte* read = (byte*)source->buffer + y*source->pitch + x;
|
||||
XColor* palette = surface->color;
|
||||
|
||||
|
||||
while (h > 0)
|
||||
{
|
||||
byte* _write = write;
|
||||
byte* _read = read;
|
||||
byte* limit = _write + w;
|
||||
|
||||
|
||||
for ( ; _write < limit; _write++, _read++ )
|
||||
*_write = (byte) palette[ *_read ].pixel;
|
||||
|
||||
@ -356,13 +356,13 @@
|
||||
byte* write = (byte*)target->buffer + y*target->pitch + 2*x;
|
||||
byte* read = (byte*)source->buffer + y*source->pitch + x;
|
||||
XColor* palette = surface->color;
|
||||
|
||||
|
||||
while (h > 0)
|
||||
{
|
||||
byte* _write = write;
|
||||
byte* _read = read;
|
||||
byte* limit = _write + 2*w;
|
||||
|
||||
|
||||
for ( ; _write < limit; _write += 2, _read++ )
|
||||
*(short*)_write = (short)palette[ *_read ].pixel;
|
||||
|
||||
@ -384,17 +384,17 @@
|
||||
grBitmap* source = &surface->root.bitmap;
|
||||
byte* write = (byte*)target->buffer + y*target->pitch + 3*x;
|
||||
byte* read = (byte*)source->buffer + y*source->pitch + x;
|
||||
|
||||
|
||||
while (h > 0)
|
||||
{
|
||||
byte* _write = write;
|
||||
byte* _read = read;
|
||||
byte* limit = _write + 3*w;
|
||||
|
||||
|
||||
for ( ; _write < limit; _write += 3, _read++ )
|
||||
{
|
||||
XColor* color = surface->color + *_read;
|
||||
|
||||
|
||||
_write[0] = color->red;
|
||||
_write[1] = color->green;
|
||||
_write[2] = color->blue;
|
||||
@ -418,13 +418,13 @@
|
||||
grBitmap* source = &surface->root.bitmap;
|
||||
byte* write = (byte*)target->buffer + y*target->pitch + 4*x;
|
||||
byte* read = (byte*)source->buffer + y*source->pitch + x;
|
||||
|
||||
|
||||
while (h > 0)
|
||||
{
|
||||
byte* _write = write;
|
||||
byte* _read = read;
|
||||
byte* limit = _write + 4*w;
|
||||
|
||||
|
||||
for ( ; _write < limit; _write += 4, _read++ )
|
||||
{
|
||||
byte color = *_read;
|
||||
@ -447,28 +447,28 @@
|
||||
int h )
|
||||
{
|
||||
int z;
|
||||
|
||||
|
||||
/* first of all, clip to the surface's area */
|
||||
if ( x >= surface->image.width ||
|
||||
x+w <= 0 ||
|
||||
y >= surface->image.rows ||
|
||||
y+h <= 0 )
|
||||
return;
|
||||
|
||||
|
||||
if ( x < 0 )
|
||||
{
|
||||
w += x;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
|
||||
z = (x + w) - surface->image.width;
|
||||
if (z > 0)
|
||||
w -= z;
|
||||
|
||||
|
||||
z = (y + h) - surface->image.rows;
|
||||
if (z > 0)
|
||||
h -= z;
|
||||
|
||||
|
||||
/* convert the rectangle to the target depth for gray surfaces */
|
||||
if (surface->gray)
|
||||
{
|
||||
@ -480,7 +480,7 @@
|
||||
case 32: convert_gray_to_32 ( surface, x, y, w, h ); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
@ -492,7 +492,7 @@
|
||||
{
|
||||
if (surface->gray)
|
||||
convert_rectangle( surface, x, y, w, h );
|
||||
|
||||
|
||||
XPutImage( display,
|
||||
surface->win,
|
||||
surface->gc,
|
||||
@ -500,7 +500,7 @@
|
||||
x, y, x, y, w, h );
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
void set_title( grXSurface* surface,
|
||||
const char* title )
|
||||
@ -535,7 +535,7 @@
|
||||
|
||||
|
||||
|
||||
static
|
||||
static
|
||||
void listen_event( grXSurface* surface,
|
||||
int event_mask,
|
||||
grEvent* grevent )
|
||||
@ -565,7 +565,7 @@
|
||||
|
||||
switch ( x_event.type )
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyPress:
|
||||
key_number = XLookupString( &x_event.xkey,
|
||||
key_buffer,
|
||||
sizeof ( key_buffer ),
|
||||
@ -579,7 +579,7 @@
|
||||
/* this may be a special key like F1, F2, etc.. */
|
||||
grkey = KeySymTogrKey(key);
|
||||
if (grkey != grKeyNone)
|
||||
goto Set_Key;
|
||||
goto Set_Key;
|
||||
}
|
||||
else
|
||||
bool_exit = 1;
|
||||
@ -588,7 +588,7 @@
|
||||
case MappingNotify:
|
||||
XRefreshKeyboardMapping( &x_event.xmapping );
|
||||
break;
|
||||
|
||||
|
||||
case Expose:
|
||||
refresh_rectangle( surface,
|
||||
x_event.xexpose.x,
|
||||
@ -608,7 +608,7 @@
|
||||
/* If this wasn't part of the simple translated keys, simply get the charcode */
|
||||
/* from the character buffer */
|
||||
grkey = grKEY(key_buffer[key_cursor++]);
|
||||
|
||||
|
||||
Set_Key:
|
||||
grevent->type = gr_key_down;
|
||||
grevent->key = grkey;
|
||||
@ -625,12 +625,12 @@
|
||||
char grays;
|
||||
XDepth* format;
|
||||
int image_depth;
|
||||
|
||||
|
||||
screen = DefaultScreen( display );
|
||||
|
||||
|
||||
surface->colormap = DefaultColormap( display, screen );
|
||||
surface->depth = DefaultDepth( display, screen );
|
||||
surface->visual = DefaultVisual( display, screen );
|
||||
surface->visual = DefaultVisual( display, screen );
|
||||
|
||||
image = &surface->image;
|
||||
|
||||
@ -644,7 +644,7 @@
|
||||
bitmap->grays >= 2 );
|
||||
|
||||
surface->gray = grays;
|
||||
|
||||
|
||||
/* copy dimensions */
|
||||
image->width = bitmap->width;
|
||||
image->rows = bitmap->rows;
|
||||
@ -656,7 +656,7 @@
|
||||
/* find the supported format corresponding to the request */
|
||||
format = 0;
|
||||
|
||||
if (grays)
|
||||
if (grays)
|
||||
{
|
||||
/* choose the default depth in case of grays rendering */
|
||||
int i;
|
||||
@ -672,7 +672,7 @@
|
||||
{
|
||||
/* otherwise, select the format depending on the pixel mode */
|
||||
int i;
|
||||
|
||||
|
||||
format = 0;
|
||||
for ( i = 0; i < num_pixel_modes; i++ )
|
||||
if ( pixel_modes[i] == bitmap->mode )
|
||||
@ -682,7 +682,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!format)
|
||||
{
|
||||
grError = gr_err_bad_argument;
|
||||
@ -695,17 +695,17 @@
|
||||
if ( format->depth == 24 &&
|
||||
format->bits_per_pixel == 32 )
|
||||
image_depth = 32;
|
||||
|
||||
|
||||
/* allocate surface image */
|
||||
{
|
||||
int bits, over;
|
||||
|
||||
bits = image->width * format->bits_per_pixel;
|
||||
over = bits % format->scanline_pad;
|
||||
|
||||
|
||||
if (over)
|
||||
bits += format->scanline_pad - over;
|
||||
|
||||
|
||||
if (!grays)
|
||||
{
|
||||
image->width = bits;
|
||||
@ -733,9 +733,9 @@
|
||||
}
|
||||
|
||||
surface->root.bitmap = *bitmap;
|
||||
|
||||
|
||||
/* Now create the surface X11 image */
|
||||
surface->ximage = XCreateImage( display,
|
||||
surface->ximage = XCreateImage( display,
|
||||
surface->visual,
|
||||
format->depth,
|
||||
format->depth == 1 ? XYBitmap : ZPixmap,
|
||||
@ -747,20 +747,20 @@
|
||||
0 );
|
||||
if ( !surface->ximage )
|
||||
Panic( "grX11: cannot create surface X11 image\n" );
|
||||
|
||||
|
||||
|
||||
/* allocate gray levels in the case of gray surface */
|
||||
if ( grays )
|
||||
{
|
||||
XColor* color = surface->color;
|
||||
int i;
|
||||
|
||||
|
||||
for ( i = 0; i < bitmap->grays; i++, color++ )
|
||||
{
|
||||
color->red =
|
||||
color->green =
|
||||
color->blue = 65535 - ( i * 65535 ) / bitmap->grays;
|
||||
|
||||
|
||||
if ( !XAllocColor( display, surface->colormap, color ) )
|
||||
Panic( "ERROR: cannot allocate Color\n" );
|
||||
}
|
||||
@ -775,13 +775,13 @@
|
||||
XTextProperty xtp;
|
||||
XSizeHints xsh;
|
||||
XSetWindowAttributes xswa;
|
||||
|
||||
|
||||
xswa.border_pixel = BlackPixel( display, screen );
|
||||
xswa.background_pixel = WhitePixel( display, screen );
|
||||
xswa.cursor = busy;
|
||||
|
||||
|
||||
xswa.event_mask = KeyPressMask | ExposureMask;
|
||||
|
||||
|
||||
surface->win = XCreateWindow( display,
|
||||
RootWindow( display, screen ),
|
||||
0,
|
||||
@ -790,45 +790,45 @@
|
||||
image->rows,
|
||||
10,
|
||||
surface->depth,
|
||||
InputOutput,
|
||||
InputOutput,
|
||||
surface->visual,
|
||||
CWBackPixel | CWBorderPixel |
|
||||
CWEventMask | CWCursor,
|
||||
&xswa );
|
||||
|
||||
|
||||
XMapWindow( display, surface->win );
|
||||
|
||||
|
||||
surface->gc = XCreateGC( display, RootWindow( display, screen ), 0L, NULL );
|
||||
XSetForeground( display, surface->gc, xswa.border_pixel );
|
||||
XSetBackground( display, surface->gc, xswa.background_pixel );
|
||||
|
||||
|
||||
|
||||
|
||||
/* make window manager happy :-) */
|
||||
xtp.value = (unsigned char*)"FreeType";
|
||||
xtp.encoding = 31;
|
||||
xtp.format = 8;
|
||||
xtp.nitems = strlen( (char*)xtp.value );
|
||||
|
||||
|
||||
xsh.x = 0;
|
||||
xsh.y = 0;
|
||||
|
||||
|
||||
xsh.width = image->width;
|
||||
xsh.height = image->rows;
|
||||
xsh.flags = (PPosition | PSize);
|
||||
xsh.flags = 0;
|
||||
|
||||
|
||||
XSetWMProperties( display, surface->win, &xtp, &xtp, NULL, 0, &xsh, NULL, NULL );
|
||||
}
|
||||
|
||||
|
||||
surface->root.done = (grDoneSurfaceFunc) done_surface;
|
||||
surface->root.refresh_rect = (grRefreshRectFunc) refresh_rectangle;
|
||||
surface->root.set_title = (grSetTitleFunc) set_title;
|
||||
surface->root.listen_event = (grListenEventFunc) listen_event;
|
||||
|
||||
|
||||
convert_rectangle( surface, 0, 0, bitmap->width, bitmap->rows );
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -836,15 +836,15 @@
|
||||
{
|
||||
sizeof( grXSurface ),
|
||||
"x11",
|
||||
|
||||
|
||||
init_device,
|
||||
done_device,
|
||||
|
||||
|
||||
(grDeviceInitSurfaceFunc) init_surface,
|
||||
|
||||
|
||||
0,
|
||||
0
|
||||
|
||||
|
||||
};
|
||||
|
||||
#ifdef TEST
|
||||
@ -875,7 +875,7 @@ const grKeyName key_names[] =
|
||||
{ grKeyEsc, "Esc" },
|
||||
{ grKeyHome, "Home" },
|
||||
{ grKeyEnd, "End" },
|
||||
|
||||
|
||||
{ grKeyPageUp, "Page_Up" },
|
||||
{ grKeyPageDown, "Page_Down" },
|
||||
{ grKeyLeft, "Left" },
|
||||
@ -891,7 +891,7 @@ int main( void )
|
||||
{
|
||||
grSurface* surface;
|
||||
int n;
|
||||
|
||||
|
||||
grInit();
|
||||
surface = grNewScreenSurface( 0, gr_pixel_mode_gray, 320, 400, 128 );
|
||||
if (!surface)
|
||||
@ -902,10 +902,10 @@ int main( void )
|
||||
grEvent event;
|
||||
const char* string;
|
||||
int x;
|
||||
|
||||
|
||||
grSetSurfaceRefresh( surface, 1 );
|
||||
grSetTitle(surface,"X11 driver demonstration" );
|
||||
|
||||
|
||||
for ( x = -10; x < 10; x++ )
|
||||
{
|
||||
for ( n = 0; n < 128; n++ )
|
||||
@ -919,15 +919,15 @@ int main( void )
|
||||
}
|
||||
color.value = 64;
|
||||
grWriteCellString( surface, 0, 0, "just an example", color );
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
listen_event((grXSurface*)surface, 0, &event);
|
||||
|
||||
|
||||
/* return if ESC was pressed */
|
||||
if ( event.key == grKeyEsc )
|
||||
return 0;
|
||||
|
||||
|
||||
/* otherwise, display key string */
|
||||
color.value = (color.value + 8) & 127;
|
||||
{
|
||||
@ -936,7 +936,7 @@ int main( void )
|
||||
grKeyName* limit = name + count;
|
||||
const char* kname = 0;
|
||||
char kname_temp[16];
|
||||
|
||||
|
||||
while (name < limit)
|
||||
{
|
||||
if ( name->key == event.key )
|
||||
@ -946,23 +946,23 @@ int main( void )
|
||||
}
|
||||
name++;
|
||||
}
|
||||
|
||||
|
||||
if (!kname)
|
||||
{
|
||||
sprintf( kname_temp, "char '%c'", (char)event.key );
|
||||
kname = kname_temp;
|
||||
}
|
||||
|
||||
|
||||
grWriteCellString( surface, 30, 30, kname, color );
|
||||
grRefreshSurface(surface);
|
||||
paint_rectangle( surface, 0, 0, surface->bitmap.width, surface->bitmap.rows );
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endif /* O */
|
||||
#endif /* TEST */
|
||||
|
@ -37,7 +37,7 @@ const grKeyName key_names[] =
|
||||
{ grKeyEsc, "Esc" },
|
||||
{ grKeyHome, "Home" },
|
||||
{ grKeyEnd, "End" },
|
||||
|
||||
|
||||
{ grKeyPageUp, "Page_Up" },
|
||||
{ grKeyPageDown, "Page_Down" },
|
||||
{ grKeyLeft, "Left" },
|
||||
@ -52,7 +52,7 @@ int main( void )
|
||||
{
|
||||
grSurface* surface;
|
||||
int n;
|
||||
|
||||
|
||||
grInit();
|
||||
surface = grNewScreenSurface( 0, gr_pixel_mode_gray, 320, 400, 128 );
|
||||
if (!surface)
|
||||
@ -63,10 +63,10 @@ int main( void )
|
||||
grEvent event;
|
||||
const char* string;
|
||||
int x;
|
||||
|
||||
|
||||
grSetSurfaceRefresh( surface, 1 );
|
||||
grSetTitle(surface,"X11 driver demonstration" );
|
||||
|
||||
|
||||
for ( x = -10; x < 10; x++ )
|
||||
{
|
||||
for ( n = 0; n < 128; n++ )
|
||||
@ -80,15 +80,15 @@ int main( void )
|
||||
}
|
||||
color.value = 64;
|
||||
grWriteCellString( surface, 0, 0, "just an example", color );
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
grListenSurface( surface, 0, &event);
|
||||
|
||||
|
||||
/* return if ESC was pressed */
|
||||
if ( event.key == grKeyEsc )
|
||||
return 0;
|
||||
|
||||
|
||||
/* otherwise, display key string */
|
||||
color.value = (color.value + 8) & 127;
|
||||
{
|
||||
@ -97,7 +97,7 @@ int main( void )
|
||||
grKeyName* limit = name + count;
|
||||
const char* kname = 0;
|
||||
char kname_temp[16];
|
||||
|
||||
|
||||
while (name < limit)
|
||||
{
|
||||
if ( name->key == event.key )
|
||||
@ -107,13 +107,13 @@ int main( void )
|
||||
}
|
||||
name++;
|
||||
}
|
||||
|
||||
|
||||
if (!kname)
|
||||
{
|
||||
sprintf( kname_temp, "char '%c'", (char)event.key );
|
||||
kname = kname_temp;
|
||||
}
|
||||
|
||||
|
||||
grWriteCellString( surface, 30, 30, kname, color );
|
||||
grRefreshSurface(surface);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@
|
||||
current = name;
|
||||
|
||||
c = *current;
|
||||
|
||||
|
||||
while ( c )
|
||||
{
|
||||
#ifndef macintosh
|
||||
|
@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
int i, file_index;
|
||||
unsigned int id;
|
||||
@ -112,7 +112,7 @@
|
||||
fname = filename + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
else
|
||||
i--;
|
||||
|
||||
printf( "%s:\n", fname );
|
||||
@ -136,7 +136,7 @@
|
||||
for ( id = 0; id < num_glyphs; id++ )
|
||||
{
|
||||
int has_scale;
|
||||
|
||||
|
||||
error = FT_Load_Glyph( face, id, FT_LOAD_NO_RECURSE );
|
||||
if (!error && slot->format == ft_glyph_format_composite)
|
||||
{
|
||||
@ -150,19 +150,19 @@
|
||||
FT_SUBGLYPH_FLAG_SCALE |
|
||||
FT_SUBGLYPH_FLAG_XY_SCALE |
|
||||
FT_SUBGLYPH_FLAG_2X2 );
|
||||
|
||||
|
||||
printf( " [%d%c",
|
||||
subg->index,
|
||||
subg->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ? '*' : ' ' );
|
||||
|
||||
|
||||
if ( subg->arg1|subg->arg2 )
|
||||
{
|
||||
if ( subg->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES )
|
||||
if ( subg->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES )
|
||||
printf( "(%d,%d)", subg->arg1, subg->arg2 );
|
||||
else
|
||||
printf( "<%d,%d>", subg->arg1, subg->arg2 );
|
||||
}
|
||||
|
||||
|
||||
if (has_scale)
|
||||
printf( "-{%0.3f %0.3f %0.3f %0.3f}",
|
||||
subg->transform.xx/65536.0,
|
||||
|
@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
int i, file_index;
|
||||
unsigned int id;
|
||||
@ -115,7 +115,7 @@
|
||||
fname = filename + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
else
|
||||
i--;
|
||||
|
||||
printf( "%s: ", fname );
|
||||
|
@ -115,14 +115,14 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static
|
||||
void dump_range( FT_GlyphSlot glyph,
|
||||
int first_glyph,
|
||||
int last_glyph )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for ( i = first_glyph; i <= last_glyph; i++ )
|
||||
{
|
||||
error = FT_Load_Glyph( glyph,
|
||||
@ -137,7 +137,7 @@
|
||||
TT_ErrToString18( error ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
dump_bitmap(glyph,i);
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,7 @@
|
||||
char* base = argv[i];
|
||||
char* cur = base;
|
||||
int first, last;
|
||||
|
||||
|
||||
while (*cur)
|
||||
{
|
||||
if (*cur == '-')
|
||||
@ -285,14 +285,14 @@
|
||||
{
|
||||
if ( sscanf( argv[i], "%d-%d", &first, &last ) != 2 )
|
||||
Usage( execname );
|
||||
|
||||
|
||||
dump_range( glyph, first, last );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( sscanf( argv[i], "%d", &first ) != 1 )
|
||||
Usage( execname );
|
||||
|
||||
|
||||
dump_range( glyph, first, first );
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
static char* new_header = 0;
|
||||
|
||||
static char* Text = "The quick brown fox jumps over the lazy dog";
|
||||
|
||||
|
||||
static FT_Library library; /* the FreeType library */
|
||||
static FT_Face face; /* the font face */
|
||||
static FT_Error error; /* error returned by FreeType ? */
|
||||
@ -49,7 +49,7 @@
|
||||
static int Num;
|
||||
static int Rotation = 0;
|
||||
static int Fail;
|
||||
|
||||
|
||||
static int hinted = 1; /* is glyph hinting active ? */
|
||||
static int antialias = 1; /* is anti-aliasing active ? */
|
||||
static int use_sbits = 1; /* do we use embedded bitmaps ? */
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
static FT_Matrix trans_matrix;
|
||||
static int transform = 0;
|
||||
|
||||
|
||||
static FT_Vector string_center;
|
||||
|
||||
typedef struct TGlyph_
|
||||
@ -76,7 +76,7 @@
|
||||
FT_UInt glyph_index; /* glyph index in face */
|
||||
FT_Vector pos; /* position of glyph origin */
|
||||
FT_Glyph image; /* glyph image */
|
||||
|
||||
|
||||
} TGlyph, *PGlyph;
|
||||
|
||||
#define FLOOR(x) ((x) & -64)
|
||||
@ -176,7 +176,7 @@
|
||||
static void clear_display( void )
|
||||
{
|
||||
long size = (long)bit.pitch * bit.rows;
|
||||
|
||||
|
||||
if (size < 0) size = -size;
|
||||
memset( bit.buffer, 0, size );
|
||||
}
|
||||
@ -192,7 +192,7 @@
|
||||
res );
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
@ -204,17 +204,17 @@
|
||||
PGlyph glyph = glyphs;
|
||||
FT_BBox bbox;
|
||||
int n;
|
||||
|
||||
|
||||
bbox.xMin = 32000; bbox.xMax = -32000;
|
||||
bbox.yMin = 32000; bbox.yMax = -32000;
|
||||
|
||||
|
||||
for ( n = 0; n < num_glyphs; n++, glyph++ )
|
||||
{
|
||||
FT_BBox cbox;
|
||||
FT_Pos x, y;
|
||||
|
||||
|
||||
if (!glyph->image) continue;
|
||||
|
||||
|
||||
x = glyph->pos.x >> 6;
|
||||
y = glyph->pos.y >> 6;
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
cbox.yMin += y;
|
||||
cbox.xMax += x;
|
||||
cbox.yMax += y;
|
||||
|
||||
|
||||
if (cbox.xMin < bbox.xMin) bbox.xMin = cbox.xMin;
|
||||
if (cbox.xMax > bbox.xMax) bbox.xMax = cbox.xMax;
|
||||
if (cbox.yMin < bbox.yMin) bbox.yMin = cbox.yMin;
|
||||
@ -253,11 +253,11 @@
|
||||
load_flags = FT_LOAD_DEFAULT;
|
||||
if( !hinted )
|
||||
load_flags |= FT_LOAD_NO_HINTING;
|
||||
|
||||
|
||||
num_grays = 128;
|
||||
if (!antialias)
|
||||
num_grays = 0;
|
||||
|
||||
|
||||
for ( n = 0; n < num_glyphs; n++, glyph++ )
|
||||
{
|
||||
/* compute glyph origin */
|
||||
@ -266,11 +266,11 @@
|
||||
if (prev_index)
|
||||
{
|
||||
FT_Vector kern;
|
||||
|
||||
|
||||
FT_Get_Kerning( face, prev_index, glyph->glyph_index, &kern );
|
||||
kern.x = FT_MulFix( kern.x, face->size->metrics.x_scale );
|
||||
if (hinted) kern.x = (kern.x+32) & -64;
|
||||
|
||||
|
||||
origin_x += kern.x;
|
||||
}
|
||||
prev_index = glyph->glyph_index;
|
||||
@ -285,7 +285,7 @@
|
||||
/* clear existing image if there is one */
|
||||
if (glyph->image)
|
||||
FT_Done_Glyph(glyph->image);
|
||||
|
||||
|
||||
/* load the glyph image */
|
||||
/* for now, we take a monochrome glyph bitmap */
|
||||
error = FT_Get_Glyph_Bitmap( face, glyph->glyph_index,
|
||||
@ -294,9 +294,9 @@
|
||||
&origin,
|
||||
(FT_BitmapGlyph*)&glyph->image );
|
||||
if (error) continue;
|
||||
|
||||
|
||||
glyph->pos = origin;
|
||||
|
||||
|
||||
origin_x += glyph->image->advance;
|
||||
}
|
||||
string_center.x = origin_x / 2;
|
||||
@ -315,12 +315,12 @@
|
||||
PGlyph glyph = glyphs;
|
||||
grBitmap bit3;
|
||||
int n;
|
||||
|
||||
|
||||
for ( n = 0; n < num_glyphs; n++, glyph++ )
|
||||
{
|
||||
if (!glyph->image)
|
||||
continue;
|
||||
|
||||
|
||||
switch (glyph->image->glyph_type)
|
||||
{
|
||||
case ft_glyph_type_bitmap:
|
||||
@ -329,42 +329,42 @@
|
||||
FT_BitmapGlyph bitm = (FT_BitmapGlyph)glyph->image;
|
||||
FT_Bitmap* source = &bitm->bitmap;
|
||||
FT_Pos x_top, y_top;
|
||||
|
||||
|
||||
bit3.rows = source->rows;
|
||||
bit3.width = source->width;
|
||||
bit3.pitch = source->pitch;
|
||||
bit3.buffer = source->buffer;
|
||||
|
||||
|
||||
switch (source->pixel_mode)
|
||||
{
|
||||
case ft_pixel_mode_mono:
|
||||
bit3.mode = gr_pixel_mode_mono;
|
||||
break;
|
||||
|
||||
|
||||
case ft_pixel_mode_grays:
|
||||
bit3.mode = gr_pixel_mode_gray;
|
||||
bit3.grays = source->num_grays;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* now render the bitmap into the display surface */
|
||||
x_top = x + (glyph->pos.x >> 6) + bitm->left;
|
||||
y_top = y - (glyph->pos.y >> 6) - bitm->top;
|
||||
grBlitGlyphToBitmap( &bit, &bit3, x_top, y_top, fore_color );
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
#if 0
|
||||
case ft_glyph_type_outline:
|
||||
{
|
||||
/* in the case of outlines, we directly render it into the */
|
||||
/* target surface with the smooth renderer.. */
|
||||
FT_OutlineGlyph out = (FT_OutlineGlyph)glyph->image;
|
||||
|
||||
|
||||
FT_Outline_Translate( (x+pen_pos[n]) << 6, (y+
|
||||
error = FT_Outline_Render(
|
||||
error = FT_Outline_Render(
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -387,7 +387,7 @@
|
||||
const unsigned char* p = (const unsigned char*)string;
|
||||
PGlyph glyph = glyphs;
|
||||
FT_UInt glyph_index;
|
||||
|
||||
|
||||
num_glyphs = 0;
|
||||
while (*p)
|
||||
{
|
||||
@ -399,7 +399,7 @@
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void reset_transform( void )
|
||||
@ -407,13 +407,13 @@
|
||||
double angle = Rotation*3.14159/64.0;
|
||||
FT_Fixed cosinus = (FT_Fixed)(cos(angle)*65536.0);
|
||||
FT_Fixed sinus = (FT_Fixed)(sin(angle)*65536.0);
|
||||
|
||||
|
||||
transform = (angle != 0);
|
||||
trans_matrix.xx = cosinus;
|
||||
trans_matrix.xy = -sinus;
|
||||
trans_matrix.yx = sinus;
|
||||
trans_matrix.yy = cosinus;
|
||||
|
||||
|
||||
FT_Set_Transform(face,&trans_matrix, 0);
|
||||
}
|
||||
|
||||
@ -437,7 +437,7 @@
|
||||
grGotoxy( 0, 0 );
|
||||
grSetMargin( 2, 1 );
|
||||
grGotobitmap( &bit );
|
||||
|
||||
|
||||
grWriteln("FreeType String Viewer - part of the FreeType test suite" );
|
||||
grLn();
|
||||
grWriteln("This program is used to display a string of text using" );
|
||||
@ -462,7 +462,7 @@
|
||||
grWriteln(" F8 : big rotate clockwise");
|
||||
grLn();
|
||||
grWriteln("press any key to exit this help screen");
|
||||
|
||||
|
||||
grRefreshSurface( surface );
|
||||
grListenSurface( surface, gr_event_key, &dummy_event );
|
||||
}
|
||||
@ -471,11 +471,11 @@
|
||||
static void reset_raster( void )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = 1;
|
||||
if ( use_grays && antialias )
|
||||
error = FT_Set_Raster( library, &ft_grays_raster );
|
||||
|
||||
|
||||
if (error)
|
||||
(void)FT_Set_Raster( library, &std_raster );
|
||||
}
|
||||
@ -484,7 +484,7 @@
|
||||
static int Process_Event( grEvent* event )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
switch ( event->key )
|
||||
{
|
||||
case grKeyEsc: /* ESC or q */
|
||||
@ -497,7 +497,7 @@
|
||||
? "kerning is now active"
|
||||
: "kerning is now ignored" );
|
||||
return 1;
|
||||
|
||||
|
||||
case grKEY('a'):
|
||||
antialias = !antialias;
|
||||
new_header = ( antialias
|
||||
@ -512,7 +512,7 @@
|
||||
? "embedded bitmaps are now used when available"
|
||||
: "embedded bitmaps are now ignored" );
|
||||
return 1;
|
||||
|
||||
|
||||
case grKEY('n'):
|
||||
case grKEY('p'):
|
||||
return (int)event->key;
|
||||
@ -524,7 +524,7 @@
|
||||
: "now using the standard anti-aliaser" );
|
||||
reset_raster();
|
||||
break;
|
||||
|
||||
|
||||
case grKEY('h'):
|
||||
hinted = !hinted;
|
||||
new_header = ( hinted
|
||||
@ -575,13 +575,13 @@
|
||||
if (ptsize > MAXPTSIZE) ptsize = MAXPTSIZE;
|
||||
return 1;
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
Do_Glyph:
|
||||
Num += i;
|
||||
if (Num < 0) Num = 0;
|
||||
if (Num >= num_glyphs) Num = num_glyphs-1;
|
||||
return 1;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -614,7 +614,7 @@
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
int i, old_ptsize, orig_ptsize, file;
|
||||
int first_glyph = 0;
|
||||
@ -627,7 +627,7 @@
|
||||
|
||||
FT_Error error;
|
||||
grEvent event;
|
||||
|
||||
|
||||
execname = ft_basename( argv[0] );
|
||||
|
||||
while ( 1 )
|
||||
@ -650,7 +650,7 @@
|
||||
usage( execname );
|
||||
Text = optarg;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
usage( execname );
|
||||
break;
|
||||
@ -686,7 +686,7 @@
|
||||
{
|
||||
if ( argv[file][i] == '.' )
|
||||
i = 0;
|
||||
i--;
|
||||
i--;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -713,10 +713,10 @@
|
||||
prepare_text( (unsigned char*)Text );
|
||||
|
||||
file_loaded++;
|
||||
|
||||
|
||||
error = reset_scale( ptsize );
|
||||
if (error) goto Display_Font;
|
||||
|
||||
|
||||
Display_Font:
|
||||
/* initialise graphics if needed */
|
||||
if ( !XisSetup )
|
||||
@ -724,7 +724,7 @@
|
||||
XisSetup = 1;
|
||||
init_display();
|
||||
}
|
||||
|
||||
|
||||
grSetTitle( surface, "FreeType String Viewer - press F1 for help" );
|
||||
old_ptsize = ptsize;
|
||||
|
||||
@ -732,10 +732,10 @@
|
||||
{
|
||||
Fail = 0;
|
||||
Num = first_glyph;
|
||||
|
||||
|
||||
if ( Num >= num_glyphs )
|
||||
Num = num_glyphs-1;
|
||||
|
||||
|
||||
if ( Num < 0 )
|
||||
Num = 0;
|
||||
}
|
||||
@ -751,7 +751,7 @@
|
||||
/* layout & render string */
|
||||
{
|
||||
FT_BBox bbox;
|
||||
|
||||
|
||||
reset_transform();
|
||||
layout_glyphs();
|
||||
compute_bbox( &bbox );
|
||||
@ -766,7 +766,7 @@
|
||||
|
||||
if (!new_header)
|
||||
new_header = Header;
|
||||
|
||||
|
||||
grWriteCellString( &bit, 0, 0, new_header, fore_color );
|
||||
new_header = 0;
|
||||
|
||||
@ -782,7 +782,7 @@
|
||||
|
||||
grWriteCellString( &bit, 0, 8, Header, fore_color );
|
||||
grRefreshSurface( surface );
|
||||
|
||||
|
||||
grListenSurface( surface, 0, &event );
|
||||
if ( !( key = Process_Event( &event ) ) )
|
||||
goto Fin;
|
||||
@ -791,7 +791,7 @@
|
||||
{
|
||||
if (file_loaded >= 1)
|
||||
FT_Done_Face( face );
|
||||
|
||||
|
||||
if ( file < argc - 1 )
|
||||
file++;
|
||||
|
||||
@ -802,7 +802,7 @@
|
||||
{
|
||||
if (file_loaded >= 1)
|
||||
FT_Done_Face( face );
|
||||
|
||||
|
||||
if ( file > 1 )
|
||||
file--;
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
int cur_glyph;
|
||||
int cur_point;
|
||||
unsigned short cur_contour;
|
||||
|
||||
|
||||
int pixel_size = CHARSIZE;
|
||||
int repeat_count = 1;
|
||||
int use_grays = 0;
|
||||
@ -80,7 +80,7 @@
|
||||
short antialias; /* smooth fonts with gray levels */
|
||||
short force_low;
|
||||
|
||||
|
||||
|
||||
#define RASTER_BUFF_SIZE 128000
|
||||
char raster_buff[ RASTER_BUFF_SIZE ];
|
||||
|
||||
@ -176,8 +176,8 @@
|
||||
|
||||
/* create a new outline */
|
||||
FT_Outline_New( library,
|
||||
glyph->outline.n_points,
|
||||
glyph->outline.n_contours,
|
||||
glyph->outline.n_points,
|
||||
glyph->outline.n_contours,
|
||||
&outlines[cur_glyph] );
|
||||
|
||||
/* copy the glyph outline into it */
|
||||
@ -190,7 +190,7 @@
|
||||
/* center outline around 0 */
|
||||
{
|
||||
FT_BBox bbox;
|
||||
|
||||
|
||||
FT_Outline_Get_CBox( &glyph->outline, &bbox );
|
||||
FT_Outline_Translate( &outlines[cur_glyph],
|
||||
- ( bbox.xMax - bbox.xMin )/2,
|
||||
@ -265,7 +265,7 @@
|
||||
case 'a':
|
||||
use_grays = 1;
|
||||
break;
|
||||
|
||||
|
||||
case 'l':
|
||||
force_low = 1;
|
||||
break;
|
||||
@ -334,7 +334,7 @@
|
||||
error = FT_Set_Raster( library, &ft_grays_raster );
|
||||
if (error) Panic( "Could not initialize smooth anti-aliasing renderer" );
|
||||
}
|
||||
|
||||
|
||||
/* Load face */
|
||||
|
||||
error = FT_New_Face( library, filename, 0, &face );
|
||||
@ -347,7 +347,7 @@
|
||||
|
||||
num_glyphs = face->num_glyphs;
|
||||
glyph = face->glyph;
|
||||
|
||||
|
||||
tab_glyphs = MAX_GLYPHS;
|
||||
if ( tab_glyphs > num_glyphs )
|
||||
tab_glyphs = num_glyphs;
|
||||
@ -361,12 +361,12 @@
|
||||
bit.width = 640;
|
||||
bit.rows = 480;
|
||||
bit.grays = 128;
|
||||
|
||||
|
||||
if ( visual )
|
||||
{
|
||||
if ( !grInitDevices() )
|
||||
Panic( "Could not initialize graphics.\n" );
|
||||
|
||||
|
||||
surface = grNewSurface( 0, &bit );
|
||||
if (!surface)
|
||||
Panic( "Could not open graphics window/screen.\n" );
|
||||
@ -398,12 +398,12 @@
|
||||
while ( total > 0 )
|
||||
{
|
||||
int repeat;
|
||||
|
||||
|
||||
/* First, preload 'tab_glyphs' in memory */
|
||||
cur_glyph = 0;
|
||||
cur_point = 0;
|
||||
cur_contour = 0;
|
||||
|
||||
|
||||
printf( "loading %d glyphs", tab_glyphs );
|
||||
|
||||
for ( Num = 0; Num < tab_glyphs; Num++ )
|
||||
@ -417,7 +417,7 @@
|
||||
|
||||
base += tab_glyphs;
|
||||
|
||||
if ( tab_glyphs > total )
|
||||
if ( tab_glyphs > total )
|
||||
tab_glyphs = total;
|
||||
|
||||
printf( ", rendering... " );
|
||||
@ -432,7 +432,7 @@
|
||||
{
|
||||
if ( (error = ConvertRaster( Num )) )
|
||||
Fail++;
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
rendered_glyphs ++;
|
||||
@ -468,7 +468,7 @@
|
||||
printf( "rendered glyphs = %d\n", rendered_glyphs );
|
||||
printf( "render time = %f s\n", (double)t0 / 10000 );
|
||||
printf( "fails = %d\n", Fail );
|
||||
printf( "average glyphs/s = %f\n",
|
||||
printf( "average glyphs/s = %f\n",
|
||||
(double)rendered_glyphs / t0 * 10000 );
|
||||
|
||||
printf( "total timing = %f s\n", (double)tz0 / 10000 );
|
||||
|
@ -53,7 +53,7 @@
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main( int argc, char** argv )
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
int i, file_index, glyph_index;
|
||||
char filename[128 + 4];
|
||||
@ -119,7 +119,7 @@
|
||||
fname = filename + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
else
|
||||
i--;
|
||||
|
||||
printf( "%s: ", fname );
|
||||
@ -132,7 +132,7 @@
|
||||
|
||||
error = FT_Set_Char_Size( face, ptsize << 6, 0, 0, 0 );
|
||||
if (error) Panic( "Could not set character size" );
|
||||
|
||||
|
||||
error = FT_Load_Glyph( face,
|
||||
glyph_index,
|
||||
load_unscaled ? FT_LOAD_NO_SCALE
|
||||
|
@ -49,7 +49,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
FT_Face face; /* the font face */
|
||||
FT_Size size; /* the font size */
|
||||
FT_GlyphSlot glyph; /* the glyph slot */
|
||||
|
||||
|
||||
FT_Error error; /* error returned by FreeType ? */
|
||||
|
||||
grSurface* surface; /* current display surface */
|
||||
@ -57,7 +57,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
|
||||
int num_glyphs; /* number of glyphs */
|
||||
int ptsize; /* current point size */
|
||||
|
||||
|
||||
int hinted = 1; /* is glyph hinting active ? */
|
||||
int antialias = 0; /* is anti-aliasing active ? */
|
||||
int use_sbits = 1; /* do we use embedded bitmaps ? */
|
||||
@ -146,7 +146,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
|
||||
static
|
||||
char bit_buffer[ MAX_BUFFER ];
|
||||
|
||||
|
||||
/* Render a single glyph with the "grays" component */
|
||||
static FT_Error Render_Glyph( int x_offset,
|
||||
int y_offset )
|
||||
@ -161,19 +161,19 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
left = FLOOR( glyph->metrics.horiBearingX );
|
||||
right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
|
||||
width = TRUNC(right - left);
|
||||
|
||||
|
||||
top = CEIL( glyph->metrics.horiBearingY );
|
||||
bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height );
|
||||
height = TRUNC( top - bottom );
|
||||
|
||||
if ( glyph->format == ft_glyph_format_outline )
|
||||
{
|
||||
{
|
||||
pitch = ( antialias ? (width+3) & -4 : (width+7) >> 3 );
|
||||
size = pitch*height;
|
||||
size = pitch*height;
|
||||
|
||||
if (size > MAX_BUFFER)
|
||||
return FT_Err_Out_Of_Memory;
|
||||
|
||||
|
||||
bit2.width = width;
|
||||
bit2.rows = height;
|
||||
bit2.pitch = pitch;
|
||||
@ -192,7 +192,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
|
||||
if (low_prec)
|
||||
glyph->outline.flags &= ~ft_outline_high_precision;
|
||||
|
||||
|
||||
error = FT_Outline_Get_Bitmap( library, &glyph->outline, &bit2 );
|
||||
}
|
||||
else
|
||||
@ -230,14 +230,14 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
}
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FT_Error LoadChar( int idx, int hint )
|
||||
{
|
||||
int flags;
|
||||
|
||||
flags = FT_LOAD_DEFAULT;
|
||||
|
||||
|
||||
if ( !hint )
|
||||
flags |= FT_LOAD_NO_HINTING;
|
||||
|
||||
@ -287,7 +287,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
LOG(( "-------------------------\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Render_Glyph( x, y );
|
||||
|
||||
x += ( glyph->metrics.horiAdvance >> 6 ) + 1;
|
||||
@ -348,7 +348,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
LOG(( "-------------------------\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Render_Glyph( x, y );
|
||||
|
||||
x += ( glyph->metrics.horiAdvance >> 6 ) + 1;
|
||||
@ -381,7 +381,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
grGotoxy( 0, 0 );
|
||||
grSetMargin( 2, 1 );
|
||||
grGotobitmap( &bit );
|
||||
|
||||
|
||||
grWriteln("FreeType Glyph Viewer - part of the FreeType test suite" );
|
||||
grLn();
|
||||
grWriteln("This program is used to display all glyphs from one or" );
|
||||
@ -413,7 +413,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
grWriteln(" F10 : increment first glyph index by 1000");
|
||||
grLn();
|
||||
grWriteln("press any key to exit this help screen");
|
||||
|
||||
|
||||
grRefreshSurface( surface );
|
||||
grListenSurface( surface, gr_event_key, &dummy_event );
|
||||
}
|
||||
@ -430,7 +430,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
static int Process_Event( grEvent* event )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
switch ( event->key )
|
||||
{
|
||||
case grKeyEsc: /* ESC or q */
|
||||
@ -451,7 +451,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
? "embedded bitmaps are now used when available"
|
||||
: "embedded bitmaps are now ignored" );
|
||||
return 1;
|
||||
|
||||
|
||||
case grKEY('n'):
|
||||
case grKEY('p'):
|
||||
return (int)event->key;
|
||||
@ -463,14 +463,14 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
: "now using the standard anti-aliaser" );
|
||||
reset_raster();
|
||||
break;
|
||||
|
||||
|
||||
case grKEY('l'):
|
||||
low_prec = !low_prec;
|
||||
new_header = ( low_prec
|
||||
? "rendering precision is now forced to low"
|
||||
: "rendering precision is now normal" );
|
||||
break;
|
||||
|
||||
|
||||
case grKEY('h'):
|
||||
hinted = !hinted;
|
||||
new_header = ( hinted
|
||||
@ -515,7 +515,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
}
|
||||
return 1;
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
Do_Rotate:
|
||||
Rotation = (Rotation + i) & 1023;
|
||||
return 1;
|
||||
@ -526,7 +526,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
if (ptsize < 1) ptsize = 1;
|
||||
if (ptsize > MAXPTSIZE) ptsize = MAXPTSIZE;
|
||||
return 1;
|
||||
|
||||
|
||||
Do_Glyph:
|
||||
Num += i;
|
||||
if (Num < 0) Num = 0;
|
||||
@ -553,7 +553,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char** argv )
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
int i, old_ptsize, orig_ptsize, file;
|
||||
int first_glyph = 0;
|
||||
@ -566,7 +566,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
|
||||
FT_Error error;
|
||||
grEvent event;
|
||||
|
||||
|
||||
execname = ft_basename( argv[0] );
|
||||
|
||||
while ( 1 )
|
||||
@ -581,7 +581,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
case 'f':
|
||||
first_glyph = atoi( optarg );
|
||||
break;
|
||||
|
||||
|
||||
case 'r':
|
||||
res = atoi( optarg );
|
||||
if ( res < 1 )
|
||||
@ -624,7 +624,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
{
|
||||
if ( argv[file][i] == '.' )
|
||||
i = 0;
|
||||
i--;
|
||||
i--;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -648,10 +648,10 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
if (error) goto Display_Font;
|
||||
|
||||
file_loaded++;
|
||||
|
||||
|
||||
error = Reset_Scale( ptsize );
|
||||
if (error) goto Display_Font;
|
||||
|
||||
|
||||
num_glyphs = face->num_glyphs;
|
||||
glyph = face->glyph;
|
||||
size = face->size;
|
||||
@ -663,7 +663,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
XisSetup = 1;
|
||||
Init_Display();
|
||||
}
|
||||
|
||||
|
||||
grSetTitle( surface, "FreeType Glyph Viewer - press F1 for help" );
|
||||
old_ptsize = ptsize;
|
||||
|
||||
@ -671,10 +671,10 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
{
|
||||
Fail = 0;
|
||||
Num = first_glyph;
|
||||
|
||||
|
||||
if ( Num >= num_glyphs )
|
||||
Num = num_glyphs-1;
|
||||
|
||||
|
||||
if ( Num < 0 )
|
||||
Num = 0;
|
||||
}
|
||||
@ -692,7 +692,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
case 0:
|
||||
Render_Text( Num, ptsize );
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Render_All( Num, ptsize );
|
||||
}
|
||||
@ -704,7 +704,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
|
||||
if (!new_header)
|
||||
new_header = Header;
|
||||
|
||||
|
||||
grWriteCellString( &bit, 0, 0, new_header, fore_color );
|
||||
new_header = 0;
|
||||
|
||||
@ -720,7 +720,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
|
||||
grWriteCellString( &bit, 0, 8, Header, fore_color );
|
||||
grRefreshSurface( surface );
|
||||
|
||||
|
||||
grListenSurface( surface, 0, &event );
|
||||
if ( !( key = Process_Event( &event ) ) )
|
||||
goto Fin;
|
||||
@ -729,7 +729,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
{
|
||||
if (file_loaded >= 1)
|
||||
FT_Done_Face( face );
|
||||
|
||||
|
||||
if ( file < argc - 1 )
|
||||
file++;
|
||||
|
||||
@ -740,7 +740,7 @@ $\243^\250*\265\371%!\247:/;.,?<>";
|
||||
{
|
||||
if (file_loaded >= 1)
|
||||
FT_Done_Face( face );
|
||||
|
||||
|
||||
if ( file > 1 )
|
||||
file--;
|
||||
|
||||
|
@ -51,11 +51,11 @@ void record_my_block( void* base, long size )
|
||||
fprintf( stderr, "adding a block with non-positive length - should not happen \n" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if ( num_my_blocks < MAX_RECORDED_BLOCKS )
|
||||
{
|
||||
MyBlock* block;
|
||||
|
||||
|
||||
#ifdef CHECK_DUPLICATES
|
||||
MyBlock* limit;
|
||||
block = my_blocks;
|
||||
@ -86,7 +86,7 @@ static
|
||||
void forget_my_block( void* base )
|
||||
{
|
||||
MyBlock* block = my_blocks + num_my_blocks-1;
|
||||
|
||||
|
||||
/* we scan in reverse, because transient blocks are always located */
|
||||
/* at the end of the table.. (it supposedly faster then..) */
|
||||
for ( ; block >= my_blocks; block-- )
|
||||
@ -118,7 +118,7 @@ void* my_alloc( FT_Memory memory,
|
||||
void* p = malloc(size);
|
||||
if (p)
|
||||
record_my_block(p,size);
|
||||
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ static void dump_mem( void )
|
||||
int bad = 0;
|
||||
|
||||
printf( "total allocated blocks = %d\n", num_my_blocks );
|
||||
|
||||
|
||||
/* we scan in reverse, because transient blocks are always located */
|
||||
/* at the end of the table.. (it supposedly faster then..) */
|
||||
for ( ; block >= my_blocks; block-- )
|
||||
@ -221,7 +221,7 @@ int main( int argc, char** argv )
|
||||
/* Create a new library with our own memory manager */
|
||||
error = FT_New_Library( &my_memory, &library );
|
||||
if (error) Panic( "Could not create library object" );
|
||||
|
||||
|
||||
/* the new library has no drivers in it, add the default ones */
|
||||
/* (implemented in ftinit.c).. */
|
||||
FT_Default_Drivers(library);
|
||||
@ -265,7 +265,7 @@ int main( int argc, char** argv )
|
||||
fname = filename + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
else
|
||||
else
|
||||
i--;
|
||||
|
||||
printf( "%s: ", fname );
|
||||
|
@ -617,20 +617,20 @@ TT_CodeRange_Tag debug_coderange = tt_coderange_glyph;
|
||||
#ifdef UNIX
|
||||
|
||||
struct termios old_termio;
|
||||
|
||||
|
||||
static
|
||||
void Init_Keyboard( void )
|
||||
{
|
||||
struct termios termio;
|
||||
|
||||
#ifndef HAVE_TCGETATTR
|
||||
ioctl( 0, TCGETS, &old_termio );
|
||||
ioctl( 0, TCGETS, &old_termio );
|
||||
#else
|
||||
tcgetattr( 0, &old_termio );
|
||||
#endif
|
||||
|
||||
termio = old_termio;
|
||||
|
||||
|
||||
/* termio.c_lflag &= ~(ICANON+ECHO+ECHOE+ECHOK+ECHONL+ECHOKE); */
|
||||
termio.c_lflag &= ~(ICANON+ECHO+ECHOE+ECHOK+ECHONL);
|
||||
|
||||
@ -838,7 +838,7 @@ TT_CodeRange_Tag debug_coderange = tt_coderange_glyph;
|
||||
exc->pts.n_contours = exc->zp0.n_contours;
|
||||
|
||||
pts = exc->pts;
|
||||
|
||||
|
||||
|
||||
save.n_points = pts.n_points;
|
||||
save.n_contours = pts.n_contours;
|
||||
@ -1205,7 +1205,7 @@ int glyph_size;
|
||||
memory = library->memory;
|
||||
driver = FT_Get_Driver( library, "truetype" );
|
||||
if (!driver) Panic( "could not find the TrueType driver in FreeType 2\n" );
|
||||
|
||||
|
||||
FT_Set_Debug_Hook( library,
|
||||
FT_DEBUG_HOOK_TRUETYPE,
|
||||
(FT_DebugHook_Func)RunIns );
|
||||
@ -1219,7 +1219,7 @@ int glyph_size;
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
Panic( "This is not a TrueType font" );
|
||||
}
|
||||
|
||||
|
||||
size = (TT_Size)face->root.size;
|
||||
|
||||
if (glyph_index < 0)
|
||||
|
@ -56,7 +56,7 @@
|
||||
<li><a href="#overview-1-b">b. Selecting another build configuration</a>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
<li><a href="#overview-2">2. Library compilation</a>
|
||||
</ul>
|
||||
<p><font size="+1"><a href="#setup">III. Build setup details</a></font></p>
|
||||
@ -274,17 +274,17 @@
|
||||
<font color="purple">C:\FreeType> make</font>
|
||||
|
||||
FreeType build system -- automatic system detection
|
||||
|
||||
|
||||
The following settings are used:
|
||||
|
||||
|
||||
platform win32
|
||||
compiler gcc
|
||||
configuration directory ./config/win32
|
||||
configuration rules ./config/win32/w32-gcc.mk
|
||||
|
||||
configuration rules ./config/win32/w32-gcc.mk
|
||||
|
||||
If this does not correspond to your system or settings please remove the file
|
||||
'config.mk' from this directory then read the INSTALL file for help.
|
||||
|
||||
|
||||
Otherwise, simply type 'make' again to build the library.
|
||||
|
||||
<font color="purple">C:\FreeType></font>
|
||||
@ -353,20 +353,20 @@
|
||||
|
||||
<ul>
|
||||
<li><p><b>Compiling the <tt>ftsystem</tt> component</b><br><ul>
|
||||
It encapsulates all low-level operations (memory management +
|
||||
It encapsulates all low-level operations (memory management +
|
||||
i/o access) for the library. Its default version, located in
|
||||
<tt>./src/base/ftsystem.c</tt> uses the ANSI C library but
|
||||
system-specific implementations are also available to
|
||||
improve performance (e.g. memory-mapped files on Unix).
|
||||
</ul></p>
|
||||
|
||||
|
||||
<li><p><b>Compiling the <em>base layer</em> and optional components</b><br><ul>
|
||||
They provide the library's high-level API as well as various useful
|
||||
routines for client applications. Many features of the base layer can
|
||||
be activated or not depending on a configuration file named
|
||||
<tt>ftoption.h</tt>
|
||||
</ul></p>
|
||||
|
||||
|
||||
<li><p><b>Compiling the <em>modules</em></b><br><ul>
|
||||
Each module is used to support a specific font format (it is then
|
||||
called a <em>font driver</em>), or to provide helper services to
|
||||
@ -374,7 +374,7 @@
|
||||
sub-directories of <tt>./src</tt>, like <tt>./src/truetype</tt>,
|
||||
<tt>./src/type1</tt>.
|
||||
</ul></p>
|
||||
|
||||
|
||||
<li><p><b>Compiling the <tt>ftinit</tt> component</b><br><ul>
|
||||
This one is in charge of implementing <tt>FT_Init_FreeType</tt>,
|
||||
the library initialisation routine. It also selects what modules
|
||||
@ -414,16 +414,16 @@
|
||||
<p><center>
|
||||
<img src="platform-detection.png" border=0>
|
||||
</center></p>
|
||||
|
||||
|
||||
<p>Each system-specific <b><tt>detect.mk</tt></b> works as follows:</p>
|
||||
<ul>
|
||||
<li><p>It checks that the value of <tt>PLATFORM</tt> is currently set
|
||||
to <b>ansi</b>, which indicates that no platform was detected
|
||||
for now. If this isn't true, it doesn't do anything</p>
|
||||
|
||||
|
||||
<li><p>Otherwise, it runs a series of test to see wether it is on a
|
||||
system it knows about. Here are a few examples of tests:</p>
|
||||
|
||||
|
||||
<p><center><table width="80%" cellpadding=5><tr valign=top><td>
|
||||
<em><b>Unix</b></em>
|
||||
</td><td>
|
||||
@ -446,10 +446,10 @@
|
||||
we're on a Win32 system.</p>
|
||||
</td></tr></table></center>
|
||||
</p>
|
||||
|
||||
|
||||
<li><p>It sets the value of <tt>PLATFORM</tt> to a new value corresponding
|
||||
to its platform.</p>
|
||||
|
||||
|
||||
<li><p>It then tries to select a configuration
|
||||
sub-makefile, depending on the current platform and any optional
|
||||
make target (like "visualc" or "devel", etc..). Note that it can
|
||||
@ -465,17 +465,17 @@
|
||||
<ul>
|
||||
<li>A new subdirectory, in <tt>./config</tt>, with a file named
|
||||
<tt>detect.mk</tt> in it, containing relevant checks for the system.
|
||||
|
||||
|
||||
<li>One or more configuration sub-makefiles that will get copied to
|
||||
<tt>config.mk</tt> at build setup time. You can use the one in
|
||||
<tt>./config/ansi/config.mk</tt> as a template.
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<p>Similary, supporting a new compiler on an existing system simply means:</p>
|
||||
<ul>
|
||||
<li>Writing a new config sub-makefile that contains definitions used to
|
||||
specify the compiler and flags for the build.
|
||||
|
||||
|
||||
<li>Change your <tt>./config/<em>system</em>/detect.mk</tt> to recognize
|
||||
a new optional build target that will copy your new config sub-makefile
|
||||
instead of the default one.
|
||||
@ -496,14 +496,14 @@
|
||||
the host environment, like the compiler, compilation flags,
|
||||
object file suffix, the directory where all object files are
|
||||
placed, etc..</p>
|
||||
|
||||
|
||||
<li><p>If <tt>BUILD_FREETYPE</tt> is defined, it includes the file
|
||||
<tt><b>./config/freetype.mk</b></tt>, which is in charge of
|
||||
defining all the rules used to build the library object files.
|
||||
(The test is useful to use the <tt>config.mk</tt> file to
|
||||
compile other projects that rely on FreeType 2, like its
|
||||
demonstration programs).</p>
|
||||
|
||||
|
||||
<li><p>Finally, it defines the rule(s) used to link FreeType 2 object files
|
||||
into a library file (e.g. <tt>libfreetype.a</tt>, <tt>freetype.lib</tt>,
|
||||
<tt>freetype.dll</tt>, ...). Unfortunately, the command line interface of link tools is
|
||||
@ -525,7 +525,7 @@
|
||||
<pre><font color="blue">
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftglyph.h>
|
||||
</font></pre>
|
||||
</font></pre>
|
||||
|
||||
<p>to include one the FreeType 2 public header files. <tt>freetype.mk</tt>
|
||||
uses a variable named <tt><b>INCLUDES</b></tt> to hold the inclusion
|
||||
@ -535,17 +535,17 @@
|
||||
<p><tt>freetype.mk</tt> uses a variable named <tt><b>INCLUDES</b></tt>
|
||||
to hold directory inclusion-path to be used when compiling the library.
|
||||
It always add <tt>./include</tt> to this variable, which means
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
<h4>b. Configuration header files:</h4>
|
||||
<ul>
|
||||
<ul>
|
||||
<p>Three header files used to configure the compilation of the
|
||||
FreeType 2 library. Their default versions are all located in the
|
||||
directory <tt><b>./include/freetype/config/</b></tt>, even though
|
||||
project specific versions can be provided on a given build, as
|
||||
described later:</p>
|
||||
|
||||
|
||||
<ul>
|
||||
<p><b><tt>#include <freetype/config/ftoption.h></tt></b><br><ul>
|
||||
This file contains a set of configuration macro definitions that
|
||||
@ -557,7 +557,7 @@
|
||||
You might need to provide an alternative version of <tt>ftoption.h</tt>
|
||||
for one of your own projects.
|
||||
</ul></p>
|
||||
|
||||
|
||||
<p><b><tt>#include <freetype/config/ftconfig.h></tt></b><br><ul>
|
||||
This file includes <tt>ftoption.h</tt> but also contains some automatic
|
||||
macro definitions used to indicate some important system-specific
|
||||
@ -566,7 +566,7 @@
|
||||
You shouldn't normally need to change or provide an alternative
|
||||
version of this file.
|
||||
</ul></p>
|
||||
|
||||
|
||||
|
||||
<p><b><tt>#include <freetype/config/ftmodule.h></tt></b><br><ul>
|
||||
This file is very special, as it is normally machine-generated, and
|
||||
@ -583,13 +583,13 @@
|
||||
<tt>./src</tt>.
|
||||
</ul></p>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Note that we strongly advise you to avoid modifying the config files
|
||||
within the FreeType 2 source directory hierarchy. Rather, it's possible
|
||||
to specify alternative versions through the help of a build-specific
|
||||
include path that is include before <tt>./include</tt> in the inclusion
|
||||
path.</p>
|
||||
|
||||
|
||||
<p>For example, imagine that your platform, named <em>foo</em>, needs a
|
||||
specific version of <tt>ftoption.h</tt>
|
||||
</ul>
|
||||
@ -600,14 +600,14 @@
|
||||
and i/o access) within a single component called <tt><b>ftsystem</b></tt>.
|
||||
Its default implementation uses the <em>ANSI C Library</em> and is located
|
||||
in <tt>./src/base/ftsystem.c</tt>.</p>
|
||||
|
||||
|
||||
<p>However, some alternate, system-specific, implementations of
|
||||
<tt>ftsystem</tt> are provided with the library in order to support more
|
||||
efficient and advanced features. As an example, the file
|
||||
<tt>./config/unix/ftsystem.c</tt> is an implementation that
|
||||
uses memory-mapped files rather than the slow ANSI <tt>fopen</tt>,
|
||||
<tt>fread</tt> and <tt>fseek</tt>, boosting performance significantly.</p>
|
||||
|
||||
|
||||
<p>The build system is thus capable of managing alternate implementations
|
||||
of <tt>ftsystem</tt></p>
|
||||
</ul>
|
||||
@ -638,7 +638,7 @@
|
||||
code located in a sub-directory of <tt>./src</tt> that contains a file
|
||||
named <tt><b>rules.</b></tt>, for example:
|
||||
<tt>src/sfnt</tt>, <tt>src/truetype</tt>, <tt>src/type1</tt>, ...</p>
|
||||
|
||||
|
||||
<p>The <tt><b>rules.</b></tt> file simply contains directives used by the
|
||||
build system to compile the corresponding module into a single object
|
||||
file.</p>
|
||||
|
@ -51,10 +51,10 @@ FreeType 2.0 I/O Frames</h1></center>
|
||||
<font color="blue"><pre>
|
||||
error = read_short(stream, &str.value1);
|
||||
if (error) goto ...
|
||||
|
||||
|
||||
error = read_ulong(stream, &str.value2);
|
||||
if (error) goto ...
|
||||
|
||||
|
||||
error = read_ulong(stream, &str.value3);
|
||||
if (error) goto ...
|
||||
</pre></font>
|
||||
@ -63,11 +63,11 @@ FreeType 2.0 I/O Frames</h1></center>
|
||||
<font color="blue"><pre>
|
||||
error = FT_Access_Frame(stream, 2+4+4);
|
||||
if (error) goto ...
|
||||
|
||||
|
||||
str.value1 = FT_Get_Short(stream);
|
||||
str.value2 = FT_Get_ULong(stream);
|
||||
str.value3 = FT_Get_ULong(stream);
|
||||
|
||||
|
||||
FT_Forget_Frame(stream);
|
||||
</pre></font>
|
||||
<p>
|
||||
@ -126,63 +126,63 @@ FreeType 2.0 I/O Frames</h1></center>
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>Macro name</b> <td>Translation <td>Description
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_Byte()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
(FT_Get_Byte(stream))
|
||||
</tt></font><td>
|
||||
reads an 8-bit unsigned byte
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_Char()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
((FT_Char)FT_Get_Byte(stream))
|
||||
</tt></font><td>
|
||||
reads an 8-bit <em>signed</em> byte
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_Short()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
(FT_Get_Short(stream))
|
||||
</tt></font><td>
|
||||
reads a 16-bit signed big-endian integer
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_UShort()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
((FT_UShort)FT_Get_Short(stream))
|
||||
</tt></font><td>
|
||||
reads a 16-bit unsigned big-endian integer
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_Offset()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
(FT_Get_Offset(stream))
|
||||
</tt></font><td>
|
||||
reads a 24-bit signed big-endian integer
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_UOffset()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
((FT_UOffset)FT_Get_Offset(stream))
|
||||
</tt></font><td>
|
||||
reads a 24-bit unsigned big-endian integer
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_Long()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
(FT_Get_Long(stream))
|
||||
</tt></font><td>
|
||||
reads a 32-bit signed big-endian integer
|
||||
|
||||
|
||||
<tr><td><font color="purple"><tt><b>
|
||||
GET_ULong()
|
||||
</b></tt></font><td><font color="blue"><tt>
|
||||
((FT_ULong)FT_Get_Long(stream))
|
||||
</tt></font><td>
|
||||
reads a 32-bit unsigned big-endian integer
|
||||
|
||||
|
||||
</table>
|
||||
</ul>
|
||||
<p>
|
||||
@ -192,22 +192,22 @@ FreeType 2.0 I/O Frames</h1></center>
|
||||
<font color="blue"><pre>
|
||||
error = FT_Access_Frame(stream, 2+4+4);
|
||||
if (error) goto ...
|
||||
|
||||
|
||||
str.value1 = FT_Get_Short(stream);
|
||||
str.value2 = FT_Get_ULong(stream);
|
||||
str.value3 = FT_Get_ULong(stream);
|
||||
|
||||
|
||||
FT_Forget_Frame(stream);<br>
|
||||
</pre></font>
|
||||
<p>
|
||||
Can be replaced with macros by:<p>
|
||||
<font color="blue"><pre>
|
||||
if ( ACCESS_Frame( 2+4+4 ) ) goto ...
|
||||
|
||||
|
||||
str.value1 = GET_Short();
|
||||
str.value2 = GET_ULong();
|
||||
str.value3 = GET_ULong();
|
||||
|
||||
|
||||
FORGET_Frame();
|
||||
</pre></font>
|
||||
<p>
|
||||
|
@ -56,14 +56,14 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<ul>
|
||||
Simply create a variable of type <tt>FT_Library</tt> named, for example,
|
||||
<tt>library</tt>, and call the function <tt>FT_Init_FreeType</tt> as in:
|
||||
|
||||
|
||||
<font color="blue"><pre>
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
|
||||
FT_Library library;
|
||||
|
||||
|
||||
....
|
||||
|
||||
|
||||
{
|
||||
..
|
||||
error = FT_Init_FreeType( &library );
|
||||
@ -76,7 +76,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<li>Creating a new instance of the FreeType 2 library, and set
|
||||
the handle <tt>library</tt> to it.
|
||||
<p>
|
||||
|
||||
|
||||
<li>Load each font driver that FreeType knows about in the library.
|
||||
This means that by default, your new <tt>library</tt> object is
|
||||
able to handle TrueType and Type 1 fonts gracefully.
|
||||
@ -101,13 +101,13 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
two different faces.
|
||||
<p>
|
||||
<font color="blue"><pre>
|
||||
|
||||
|
||||
FT_Library library; /* handle to library */
|
||||
FT_Face face; /* handle to face object */
|
||||
|
||||
error = FT_Init_FreeType( &library );
|
||||
if (error) { ..... }
|
||||
|
||||
|
||||
error = FT_New_Face( library,
|
||||
"/usr/share/fonts/truetype/arial.ttf",
|
||||
0,
|
||||
@ -131,17 +131,17 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<tr valign="top"><td><tt><b>library</b></tt>
|
||||
<td>handle to the FreeType library instance where the face object is
|
||||
created
|
||||
|
||||
|
||||
<tr valign="top"><td><tt><b>filepathname</b></tt>
|
||||
<td>the font file pathname (standard C string).
|
||||
|
||||
|
||||
<tr valign="top"><td><tt><b>face_index</b></tt>
|
||||
<td>Certain font formats allow several font faces to be embedded in
|
||||
a single file.<br>
|
||||
This index tells which face you want to load. An
|
||||
error will be returned if its value is too large.<br>
|
||||
Index 0 always work though.
|
||||
|
||||
|
||||
<tr><td><tt><b>face</b></tt>
|
||||
<td>A <em>pointer</em> to the handle that will be set to
|
||||
describe the new face object.<br>
|
||||
@ -155,7 +155,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
the font file.
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
|
||||
<h4>b. From memory:</h4>
|
||||
<ul>
|
||||
In the case where you have already loaded the font file in memory, you
|
||||
@ -163,13 +163,13 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<tt>FT_New_Memory_Face</tt> as in:
|
||||
<p>
|
||||
<font color="blue"><pre>
|
||||
|
||||
|
||||
FT_Library library; /* handle to library */
|
||||
FT_Face face; /* handle to face object */
|
||||
|
||||
error = FT_Init_FreeType( &library );
|
||||
if (error) { ..... }
|
||||
|
||||
|
||||
error = FT_New_Memory_Face( library,
|
||||
buffer, /* first byte in memory */
|
||||
size, /* size in bytes */
|
||||
@ -184,7 +184,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<tt>FT_New_Face</tt>.
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
|
||||
<h4>c. From other sources: (compressed files, network, etc..)</h4>
|
||||
<ul>
|
||||
There are cases where using a filepathname or preloading the file in
|
||||
@ -215,7 +215,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<td>gives the number of <em>glyphs</em> available in the font face. A glyph
|
||||
is simply a character image. It doesn't necessarily correspond to
|
||||
a <em>character code</em> though.
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td><tt><b>face−>flags</b></tt>
|
||||
<td>a 32-bit integer containing bit flags used to describe some face
|
||||
@ -224,13 +224,13 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
glyph images can be rendered for all character pixel sizes. For more
|
||||
information on face flags, please read the <a href="#">FreeType API
|
||||
Reference</a>
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td><tt><b>face−>units_per_EM</b></tt>
|
||||
<td>This field is only valid for scalable formats (it is set to 0
|
||||
otherwise). It indicates the number of font units covered by the
|
||||
EM.
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td><tt><b>face−>num_fixed_sizes</b></tt>
|
||||
<td>this field gives the number of embedded bitmap <em>strikes</em> in
|
||||
@ -280,16 +280,16 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
You'll notice that:<p>
|
||||
<ul>
|
||||
<li>The character width and heights are specified in 1/64th of points.<p>
|
||||
|
||||
|
||||
<li>The horizontal and vertical device resolutions are expressed in
|
||||
<em>dots-per-inch</em>, or <em>dpi</em>. You can use 72 or 96 dpi
|
||||
for display devices like the screen.<p>
|
||||
|
||||
|
||||
<li>A value of 0 for the character width means "<em>same as character
|
||||
height</em>", a value of 0 for the character height means
|
||||
"<em>same as character width</em>". Otherwise, it is possible to
|
||||
specify different char width and height.<p>
|
||||
|
||||
|
||||
<li>Using a value of 0 for the horizontal or vertical resolution means
|
||||
72 dpi, which is the default.
|
||||
<p>
|
||||
@ -362,7 +362,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<p>
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
|
||||
<h4>b. Loading a glyph from the face:</h4>
|
||||
<ul>
|
||||
Once you have a glyph index, you can load the corresponding glyph image.
|
||||
@ -397,13 +397,13 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
bitmaps are favored over outlines as they usually correspond to
|
||||
higher-quality images of the same glyph).
|
||||
<p>
|
||||
|
||||
|
||||
<li>if there is an outline for the corresponding glyph, load it
|
||||
unless <tt>FT_LOAD_NO_OUTLINE</tt> is set. Otherwise, scale it
|
||||
to the current size, unless the <tt>FT_LOAD_NO_SCALE</tt> flag
|
||||
is set.
|
||||
<p>
|
||||
|
||||
|
||||
<li>if the outline was loaded and scaled, try to grid-fit it (which
|
||||
dramatically improves its quality) unless the flag
|
||||
<tt>FT_LOAD_NO_HINTING</tt> is set.
|
||||
@ -413,7 +413,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
details see the <a href="#">FreeType 2 API Reference</a>.
|
||||
</ul>
|
||||
<p>
|
||||
|
||||
|
||||
<h4>c. Using other charmaps:</h4>
|
||||
<ul>
|
||||
As said before, when a new face object is created, it will look for
|
||||
@ -445,7 +445,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
FT_CharMap found = 0;
|
||||
FT_CharMap charmap;
|
||||
int n;
|
||||
|
||||
|
||||
for ( n = 0; n < face->num_charmaps; n++ )
|
||||
{
|
||||
charmap = face>charmaps[n];
|
||||
@ -457,7 +457,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
}
|
||||
|
||||
if (!found) { ... }
|
||||
|
||||
|
||||
/* now, select the charmap for the face object */
|
||||
error = FT_Set_CharMap( face, found );
|
||||
if (error) { .... }
|
||||
@ -465,7 +465,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<p>
|
||||
One might now call <tt>FT_Get_Char_Index</tt> with Big5 character codes
|
||||
to retrieve glyph indices.
|
||||
<p>
|
||||
<p>
|
||||
</ul>
|
||||
<p>
|
||||
</ul>
|
||||
@ -506,7 +506,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<td>Indicates the type of the loaded glyph image. Can be either
|
||||
<tt>ft_glyph_format_bitmap</tt>, <tt>ft_glyph_format_outline</tt>
|
||||
or other values.
|
||||
|
||||
|
||||
<tr valign="top">
|
||||
<td><tt><b>glyph−>metrics</b></tt>
|
||||
<td>A simple structure used to hold the glyph image's metrics. Note
|
||||
@ -526,7 +526,7 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
describes it. See the definition of the <tt>FT_Outline</tt>
|
||||
structure.
|
||||
</table>
|
||||
<p>
|
||||
<p>
|
||||
</ul>
|
||||
|
||||
<h3>8. Rendering glyph outlines into bitmaps:</h3>
|
||||
@ -542,9 +542,9 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
or something else, the library provides a means to convert such glyph
|
||||
images to bitmaps through what are called <b>rasters</b>.
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
On the other hand, when the image is a scalable outline, or something else,
|
||||
FreeType provides a function to convert the glyph image into a
|
||||
pre-existing bitmap that you'll handle to it, named
|
||||
@ -556,26 +556,26 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
FT_GlyphSlot glyph;
|
||||
|
||||
.... load glyph ...
|
||||
|
||||
|
||||
glyph = face->glyph; /* shortcut to glyph data */
|
||||
if (glyph->format == ft_glyph_format_outline )
|
||||
{
|
||||
FT_Bitmap bit;
|
||||
|
||||
|
||||
/* set-up a bitmap descriptor for our target bitmap */
|
||||
bit.rows = bitmap_height;
|
||||
bit.width = bitmap_width;
|
||||
bit.pitch = bitmap_row_bytes;
|
||||
bit.pixel_mode = ft_pixel_mode_mono; /* render into a mono bitmap */
|
||||
bit.buffer = bitmap_buffer;
|
||||
|
||||
|
||||
/* render the outline directly into the bitmap */
|
||||
error = FT_Get_Glyph_Bitmap( face, &bit );
|
||||
if (error) { ... }
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre></font>
|
||||
<p>
|
||||
<p>
|
||||
You should note that <b><em><tt>FT_Get_Glyph_Bitmap</tt> doesn't create the
|
||||
bitmap.</em></b> It only needs a descriptor, of type <tt>FT_Bitmap</tt>,
|
||||
and writes directly into it.
|
||||
@ -590,12 +590,12 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
FT_GlyphSlot glyph;
|
||||
|
||||
.... load glyph ...
|
||||
|
||||
|
||||
glyph = face->glyph; /* shortcut to glyph data */
|
||||
if (glyph->format == ft_glyph_format_outline )
|
||||
{
|
||||
FT_Bitmap bit;
|
||||
|
||||
|
||||
/* set-up a bitmap descriptor for our target bitmap */
|
||||
bit.rows = bitmap_height;
|
||||
bit.width = bitmap_width;
|
||||
@ -606,11 +606,11 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
|
||||
/* clean the bitmap - IMPORTANT */
|
||||
memset( bit.buffer, 0, bit.rows*bit.pitch );
|
||||
|
||||
|
||||
/* render the outline directly into the bitmap */
|
||||
error = FT_Get_Glyph_Bitmap( face, &bit );
|
||||
if (error) { ... }
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre></font>
|
||||
<p>
|
||||
@ -618,17 +618,17 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
<ul>
|
||||
<li>As previously, <tt>FT_Get_Glyph_Bitmap</tt> doesn't generate the
|
||||
bitmap, it simply renders to it.<p>
|
||||
|
||||
|
||||
<li>The target bitmap must be cleaned before calling the function. This
|
||||
is a limitation of our current anti-aliasing algorithm and is
|
||||
EXTREMELY important.<p>
|
||||
|
||||
|
||||
<li>The anti-aliaser uses 128 levels of grays exclusively for now (this
|
||||
will probably change in a near future). This means that you <b>must</b>
|
||||
set <tt>bit.grays</tt> to 128. The generated image uses values from
|
||||
0 (back color) to 127 (foreground color).
|
||||
<p>
|
||||
|
||||
<p>
|
||||
|
||||
<li>It is <b>not</b> possible to render directly an anti-aliased outline into
|
||||
a pre-existing gray-level bitmap, or even any colored-format one
|
||||
(like RGB16 or paletted 8-bits). We will not discuss this issue in
|
||||
@ -640,6 +640,6 @@ FreeType 2.0 Tutorial</h1></center>
|
||||
</ul>
|
||||
|
||||
</td></tr></table>
|
||||
</center>
|
||||
</center>
|
||||
<p><hr>
|
||||
|
||||
|
@ -943,12 +943,12 @@
|
||||
/* returned by FT_Load_Glyph(). */
|
||||
/* */
|
||||
/* */
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
ft_glyph_own_bitmap = 1
|
||||
};
|
||||
|
||||
|
||||
typedef struct FT_GlyphSlotRec_
|
||||
{
|
||||
FT_Face face;
|
||||
|
@ -47,15 +47,15 @@ FT_ERROR_START_LIST
|
||||
FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, "can't open stream" )
|
||||
FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, "unknown file format" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, "broken file" )
|
||||
|
||||
|
||||
FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0010, "invalid argument" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0011, "invalid object handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0012, "invalid glyph index" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0013, "invalid character code" )
|
||||
|
||||
|
||||
FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0020, "unimplemented feature" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0021, "invalid glyph image format" )
|
||||
|
||||
|
||||
FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0030, "invalid library handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0031, "invalid module handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0032, "invalid face handle" )
|
||||
@ -64,7 +64,7 @@ FT_ERROR_START_LIST
|
||||
FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0035, "invalid charmap handle" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0036, "invalid outline" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Dimensions, 0x0037, "invalid dimensions" )
|
||||
|
||||
|
||||
FT_ERRORDEF( FT_Err_Unavailable_Outline, 0x0040, "unavailable outline" )
|
||||
FT_ERRORDEF( FT_Err_Unavailable_Bitmap, 0x0041, "unavailable bitmap" )
|
||||
FT_ERRORDEF( FT_Err_File_Is_Not_Collection, 0x0042, "file is not a font collection" )
|
||||
@ -84,7 +84,7 @@ FT_ERROR_START_LIST
|
||||
FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0066, "invalid frame operation" )
|
||||
FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0067, "nested frame access" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0068, "invalid frame read" )
|
||||
|
||||
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Points, 0x0070, "too many points in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Too_Many_Contours, 0x0071, "too many contours in glyph" )
|
||||
FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0072, "invalid composite glyph" )
|
||||
@ -97,7 +97,7 @@ FT_ERROR_START_LIST
|
||||
/* range 0x500 - 0x5FF is reserved for TrueDoc specific stuff */
|
||||
|
||||
/* range 0x600 - 0x6FF is reserved for Type1 specific stuff */
|
||||
|
||||
|
||||
FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0080, "raster uninitialized" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0081, "raster corrupted !!" )
|
||||
FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0082, "raster overflow !!" )
|
||||
|
@ -29,11 +29,11 @@
|
||||
#include <freetype/freetype.h>
|
||||
|
||||
typedef enum {
|
||||
|
||||
|
||||
ft_glyph_type_none = 0,
|
||||
ft_glyph_type_bitmap = 1,
|
||||
ft_glyph_type_outline = 2
|
||||
|
||||
|
||||
} FT_GlyphType;
|
||||
|
||||
/***********************************************************************
|
||||
@ -68,7 +68,7 @@
|
||||
* float sub-pixels (i.e. 1/64th of pixels).
|
||||
*
|
||||
* the vertical bearing has a positive value when the glyph top is
|
||||
* above the baseline, and negative when it is under..
|
||||
* above the baseline, and negative when it is under..
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
FT_Int bearingX;
|
||||
FT_Int bearingY;
|
||||
FT_Int advance;
|
||||
|
||||
|
||||
} FT_GlyphRec, *FT_Glyph;
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
* FT_BitmapGlyphRec
|
||||
*
|
||||
* <Description>
|
||||
* A structure used to describe a bitmap glyph image..
|
||||
* A structure used to describe a bitmap glyph image..
|
||||
* Note that the FT_BitmapGlyph type is a pointer to FT_BitmapGlyphRec
|
||||
*
|
||||
* <Field>
|
||||
@ -111,14 +111,14 @@
|
||||
* and is thus creatde and destroyed with it..
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
typedef struct FT_BitmapGlyphRec_
|
||||
{
|
||||
FT_GlyphRec metrics;
|
||||
FT_Int left;
|
||||
FT_Int top;
|
||||
FT_Bitmap bitmap;
|
||||
|
||||
|
||||
} FT_BitmapGlyphRec_, *FT_BitmapGlyph;
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@
|
||||
* FT_OutlineGlyphRec
|
||||
*
|
||||
* <Description>
|
||||
* A structure used to describe a vectorial outline glyph image..
|
||||
* A structure used to describe a vectorial outline glyph image..
|
||||
* Note that the FT_OutlineGlyph type is a pointer to FT_OutlineGlyphRec
|
||||
*
|
||||
* <Field>
|
||||
@ -147,12 +147,12 @@
|
||||
* function FT_OutlineGlyph_Render()
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
typedef struct FT_OutlineGlyphRec_
|
||||
{
|
||||
FT_GlyphRec metrics;
|
||||
FT_Outline outline;
|
||||
|
||||
|
||||
} FT_OutlineGlyphRec_, *FT_OutlineGlyph;
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@
|
||||
* face :: handle to source face object
|
||||
* glyph_index :: glyph index in face
|
||||
* load_flags :: load flags, see FT_LOAD_FLAG_XXXX constants..
|
||||
*
|
||||
*
|
||||
* <Output>
|
||||
* vecglyph :: pointer to the new outline glyph
|
||||
*
|
||||
@ -236,7 +236,7 @@
|
||||
* FT_LOAD_NO_RECURSE are set..
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_DEF(FT_Error) FT_Get_Glyph_Outline( FT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt load_flags,
|
||||
@ -250,7 +250,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* A function used to set the transform that is applied to glyph images
|
||||
* just after they're loaded in the face's glyph slot, and before they're
|
||||
* just after they're loaded in the face's glyph slot, and before they're
|
||||
* returned by either FT_Get_Glyph_Bitmap or FT_Get_Glyph_Outline
|
||||
*
|
||||
* <Input>
|
||||
@ -263,7 +263,7 @@
|
||||
* in a font face. It is unable to transform embedded glyph bitmaps
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_DEF(void) FT_Set_Transform( FT_Face face,
|
||||
FT_Matrix* matrix,
|
||||
FT_Vector* delta );
|
||||
@ -278,10 +278,10 @@
|
||||
* Destroys a given glyph..
|
||||
*
|
||||
* <Input>
|
||||
* glyph :: handle to target glyph object
|
||||
* glyph :: handle to target glyph object
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_DEF(void) FT_Done_Glyph( FT_Glyph glyph );
|
||||
|
||||
|
||||
@ -294,7 +294,7 @@
|
||||
* Returns the glyph image's bounding box in pixels.
|
||||
*
|
||||
* <Input>
|
||||
* glyph :: handle to target glyph object
|
||||
* glyph :: handle to target glyph object
|
||||
*
|
||||
* <Output>
|
||||
* box :: the glyph bounding box. Coordinates are expressed in
|
||||
@ -308,7 +308,7 @@
|
||||
* The height is box.yMax - box.yMin
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_DEF(void) FT_Glyph_Get_Box( FT_Glyph glyph,
|
||||
FT_BBox *box );
|
||||
|
||||
|
@ -857,7 +857,7 @@
|
||||
*
|
||||
* <Input>
|
||||
* raster :: handle to new raster object
|
||||
* mode :: a 4-byte tag used to name the mode or property
|
||||
* mode :: a 4-byte tag used to name the mode or property
|
||||
* args :: a pointer to the new mode/property to use
|
||||
*
|
||||
**************************************************************************/
|
||||
|
@ -190,11 +190,11 @@
|
||||
FT_AutoHinter_Init_Func init_autohinter;
|
||||
FT_AutoHinter_Done_Func done_autohinter;
|
||||
FT_AutoHinter_Load_Func load_glyph;
|
||||
|
||||
|
||||
FT_AutoHinter_Get_Global_Func get_global_hints;
|
||||
FT_AutoHinter_Done_Global_Func done_global_hints;
|
||||
|
||||
} FT_AutoHinter_Interface;
|
||||
} FT_AutoHinter_Interface;
|
||||
|
||||
#endif /* AUTOHINT_H */
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#define SQRT_64( z ) FT_Sqrt64( z )
|
||||
|
||||
EXPORT_DEF(FT_Int32) FT_Sqrt64( FT_Int64 x );
|
||||
|
||||
|
||||
#endif /* OLD_CALCS */
|
||||
|
||||
#else /* LONG64 */
|
||||
@ -61,7 +61,7 @@
|
||||
EXPORT_DEF(void) FT_Add64 ( FT_Int64* x, FT_Int64* y, FT_Int64* z );
|
||||
|
||||
EXPORT_DEF(void) FT_MulTo64 ( FT_Int32 x, FT_Int32 y, FT_Int64* z );
|
||||
|
||||
|
||||
EXPORT_DEF(FT_Int32) FT_Div64by32( FT_Int64* x, FT_Int32 y );
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_OLD_CALCS
|
||||
@ -69,7 +69,7 @@
|
||||
#define SQRT_64( z ) FT_Sqrt64( &z )
|
||||
|
||||
EXPORT_DEF(FT_Int32) FT_Sqrt64( FT_Int64* x );
|
||||
|
||||
|
||||
#endif /* OLD_CALC */
|
||||
|
||||
#endif /* LONG64 */
|
||||
|
@ -72,7 +72,7 @@
|
||||
/* */
|
||||
typedef FT_Error (*FTDriver_doneDriver)( FT_Driver driver );
|
||||
|
||||
|
||||
|
||||
typedef void (*FTDriver_Interface)( void );
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -55,7 +55,7 @@
|
||||
/* data, as the finalizer will get called later by the function's */
|
||||
/* caller. */
|
||||
/* */
|
||||
typedef FT_Error (*FT_Extension_Initializer)( void* ext,
|
||||
typedef FT_Error (*FT_Extension_Initializer)( void* ext,
|
||||
FT_Face face );
|
||||
|
||||
|
||||
@ -114,11 +114,11 @@
|
||||
FT_Extension_Initializer init;
|
||||
FT_Extension_Finalizer finalize;
|
||||
void* interface;
|
||||
|
||||
|
||||
FT_ULong offset;
|
||||
|
||||
|
||||
} FT_Extension_Class;
|
||||
|
||||
|
||||
|
||||
EXPORT_DEF(FT_Error) FT_Register_Extension( FT_Driver driver,
|
||||
FT_Extension_Class* clazz );
|
||||
|
@ -181,11 +181,11 @@
|
||||
* n_contours :: current number of contours in zone
|
||||
* org :: original glyph coordinates (font units/scaled)
|
||||
* cur :: current glyph coordinates (scaled/hinted)
|
||||
* tags :: point control tags
|
||||
* tags :: point control tags
|
||||
* contours :: contour end points
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
typedef struct FT_GlyphZone_
|
||||
{
|
||||
FT_Memory memory;
|
||||
@ -209,7 +209,7 @@
|
||||
FT_GlyphZone* zone );
|
||||
|
||||
BASE_DEF(void) FT_Done_GlyphZone( FT_GlyphZone* zone );
|
||||
|
||||
|
||||
BASE_DEF(FT_Error) FT_Update_GlyphZone( FT_GlyphZone* zone,
|
||||
FT_UShort num_points,
|
||||
FT_Short num_contours );
|
||||
@ -260,7 +260,7 @@
|
||||
/* ideally be changed dynamically at run-time. */
|
||||
/* */
|
||||
typedef void (*FT_DebugHook_Func)( void* arg );
|
||||
|
||||
|
||||
typedef struct FT_LibraryRec_
|
||||
{
|
||||
FT_Memory memory; /* library's memory object */
|
||||
|
@ -27,15 +27,15 @@ typedef enum FT_Frame_Op_
|
||||
{
|
||||
ft_frame_end = 0,
|
||||
ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),
|
||||
|
||||
|
||||
ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ),
|
||||
ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ),
|
||||
|
||||
|
||||
ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),
|
||||
ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),
|
||||
ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),
|
||||
ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),
|
||||
|
||||
|
||||
ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),
|
||||
ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),
|
||||
ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),
|
||||
@ -54,7 +54,7 @@ typedef struct FT_Frame_Field_
|
||||
FT_Frame_Op value;
|
||||
char size;
|
||||
FT_UShort offset;
|
||||
|
||||
|
||||
} FT_Frame_Field;
|
||||
|
||||
/* make-up a FT_Frame_Field out of a structure type and a field name */
|
||||
@ -171,53 +171,53 @@ typedef struct FT_Frame_Field_
|
||||
void* base,
|
||||
unsigned long size,
|
||||
FT_Stream stream );
|
||||
|
||||
|
||||
BASE_DEF(FT_Error) FT_Seek_Stream( FT_Stream stream,
|
||||
FT_ULong pos );
|
||||
|
||||
BASE_DEF(FT_Error) FT_Skip_Stream( FT_Stream stream,
|
||||
FT_Long distance );
|
||||
|
||||
|
||||
BASE_DEF(FT_Long) FT_Stream_Pos( FT_Stream stream );
|
||||
|
||||
|
||||
BASE_DEF(FT_Error) FT_Read_Stream( FT_Stream stream,
|
||||
void* buffer,
|
||||
FT_ULong count );
|
||||
|
||||
|
||||
BASE_DEF(FT_Error) FT_Read_Stream_At( FT_Stream stream,
|
||||
FT_ULong pos,
|
||||
void* buffer,
|
||||
FT_ULong count );
|
||||
|
||||
|
||||
BASE_DEF(FT_Error) FT_Access_Frame( FT_Stream stream,
|
||||
FT_ULong count );
|
||||
|
||||
|
||||
BASE_DEF(void) FT_Forget_Frame( FT_Stream stream );
|
||||
|
||||
|
||||
|
||||
BASE_DEF(FT_Char) FT_Get_Char( FT_Stream stream );
|
||||
|
||||
|
||||
BASE_DEF(FT_Short) FT_Get_Short( FT_Stream stream );
|
||||
|
||||
|
||||
BASE_DEF(FT_Long) FT_Get_Offset( FT_Stream stream );
|
||||
|
||||
|
||||
BASE_DEF(FT_Long) FT_Get_Long( FT_Stream stream );
|
||||
|
||||
|
||||
|
||||
BASE_DEF(FT_Char) FT_Read_Char( FT_Stream stream,
|
||||
FT_Error* error );
|
||||
FT_Error* error );
|
||||
|
||||
BASE_DEF(FT_Short) FT_Read_Short( FT_Stream stream,
|
||||
FT_Error* error );
|
||||
FT_Error* error );
|
||||
|
||||
BASE_DEF(FT_Long) FT_Read_Offset( FT_Stream stream,
|
||||
FT_Error* error );
|
||||
FT_Error* error );
|
||||
|
||||
BASE_DEF(FT_Long) FT_Read_Long( FT_Stream stream,
|
||||
FT_Error* error );
|
||||
FT_Error* error );
|
||||
|
||||
BASE_DEF(FT_Error) FT_Read_Fields( FT_Stream stream,
|
||||
const FT_Frame_Field* fields,
|
||||
|
@ -65,8 +65,8 @@
|
||||
* uncode :: unicode value.
|
||||
*
|
||||
* <Return>
|
||||
* The glyph index. 0xFFFF is no glyph correspond to this Unicode
|
||||
* value..
|
||||
* The glyph index. 0xFFFF is no glyph correspond to this Unicode
|
||||
* value..
|
||||
*
|
||||
* <Note>
|
||||
* This function is able to recognize several glyph names per
|
||||
@ -87,14 +87,14 @@
|
||||
* PS_Macintosh_Name_Func
|
||||
*
|
||||
* <Description>
|
||||
* A function used to return the glyph name corresponding to one
|
||||
* A function used to return the glyph name corresponding to one
|
||||
* Apple glyph name index.
|
||||
*
|
||||
* <Input>
|
||||
* name_index :: index of the Mac name
|
||||
*
|
||||
* <Return>
|
||||
* The glyph name, or 0 if the index is incorrect.
|
||||
* The glyph name, or 0 if the index is incorrect.
|
||||
*
|
||||
* <Note>
|
||||
* This function will not be compiled if the configuration macro
|
||||
@ -104,8 +104,8 @@
|
||||
|
||||
typedef const char* (*PS_Macintosh_Name_Func)( FT_UInt name_index );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef const char* (*PS_Adobe_Std_Strings_Func)( FT_UInt string_index );
|
||||
|
||||
/***************************************************************************
|
||||
@ -130,19 +130,19 @@
|
||||
* corresponding to a given Unicode character code.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
typedef struct PS_UniMap_
|
||||
{
|
||||
FT_UInt unicode;
|
||||
FT_UInt glyph_index;
|
||||
|
||||
|
||||
} PS_UniMap;
|
||||
|
||||
|
||||
typedef struct PS_Unicodes_
|
||||
{
|
||||
FT_UInt num_maps;
|
||||
PS_UniMap* maps;
|
||||
|
||||
|
||||
} PS_Unicodes;
|
||||
|
||||
|
||||
@ -155,14 +155,14 @@
|
||||
FT_UInt unicode );
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* <Struct>
|
||||
* PSNames_Interface
|
||||
*
|
||||
* <Description>
|
||||
* this structure holds pointers to the functions used to load and
|
||||
* free the basic tables that are required in a `sfnt' font file.
|
||||
*
|
||||
*
|
||||
* <Struct>
|
||||
* PSNames_Interface
|
||||
*
|
||||
* <Description>
|
||||
* this structure holds pointers to the functions used to load and
|
||||
* free the basic tables that are required in a `sfnt' font file.
|
||||
*
|
||||
* <Field>
|
||||
* unicode_value :: a function used to convert a glyph name into
|
||||
* a Unicode character code
|
||||
@ -200,11 +200,11 @@
|
||||
PS_Build_Unicodes_Func build_unicodes;
|
||||
PS_Lookup_Unicode_Func lookup_unicode;
|
||||
PS_Macintosh_Name_Func macintosh_name;
|
||||
|
||||
|
||||
PS_Adobe_Std_Strings_Func adobe_std_strings;
|
||||
const unsigned short* adobe_std_encoding;
|
||||
const unsigned short* adobe_expert_encoding;
|
||||
|
||||
|
||||
} PSNames_Interface;
|
||||
|
||||
#endif /* PSNAMES_H */
|
||||
|
@ -161,7 +161,7 @@
|
||||
/* <Note> */
|
||||
/* The `map.buffer' field is always freed before the glyph is loaded. */
|
||||
/* */
|
||||
typedef
|
||||
typedef
|
||||
TT_Error (*TT_Load_SBit_Image_Func)( TT_Face face,
|
||||
TT_Int x_ppem,
|
||||
TT_Int y_ppem,
|
||||
@ -336,7 +336,7 @@
|
||||
typedef struct SFNT_Interface_
|
||||
{
|
||||
TT_Goto_Table_Func goto_table;
|
||||
|
||||
|
||||
TT_Load_Any_Func load_any;
|
||||
TT_Load_Format_Tag_Func load_format_tag;
|
||||
TT_Load_Directory_Func load_directory;
|
||||
@ -363,7 +363,7 @@
|
||||
TT_Load_Table_Func load_sbits;
|
||||
TT_Load_SBit_Image_Func load_sbit_image;
|
||||
TT_Free_Table_Func free_sbits;
|
||||
|
||||
|
||||
/* see `ttpost.h' */
|
||||
TT_Get_PS_Name_Func get_psname;
|
||||
TT_Free_Table_Func free_psnames;
|
||||
@ -371,7 +371,7 @@
|
||||
/* see `ttcmap.h' */
|
||||
TT_CharMap_Load_Func load_charmap;
|
||||
TT_CharMap_Free_Func free_charmap;
|
||||
|
||||
|
||||
} SFNT_Interface;
|
||||
|
||||
#endif /* SFNT_H */
|
||||
|
@ -311,7 +311,7 @@
|
||||
|
||||
/* font info dictionary */
|
||||
T1_FontInfo font_info;
|
||||
|
||||
|
||||
/* private dictionary */
|
||||
T1_Private private_dict;
|
||||
|
||||
@ -341,9 +341,9 @@
|
||||
T1_Long font_id;
|
||||
|
||||
T1_Int stroke_width;
|
||||
|
||||
|
||||
} T1_Font;
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -1574,7 +1574,7 @@
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* loaded :: A flag to indicate whether the PS names are loaded. */
|
||||
/* */
|
||||
/* */
|
||||
/* format_20 :: The sub-table used for format 2.0. */
|
||||
/* */
|
||||
/* format_25 :: The sub-table used for format 2.5. */
|
||||
@ -1717,7 +1717,7 @@
|
||||
{
|
||||
FT_CharMapRec root;
|
||||
TT_CMapTable cmap;
|
||||
|
||||
|
||||
} TT_CharMapRec;
|
||||
|
||||
|
||||
@ -1997,7 +1997,7 @@
|
||||
/* TT_Goto_Table defined in `ttload.h', but some font drivers */
|
||||
/* might need something different, e.g. Type 42 fonts */
|
||||
TT_Goto_Table_Func goto_table;
|
||||
|
||||
|
||||
/* a typeless pointer to the SFNT_Interface table used to load */
|
||||
/* the basic TrueType tables in the face object */
|
||||
void* sfnt;
|
||||
|
@ -35,7 +35,7 @@
|
||||
* FontInfo.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
typedef struct T1_FontInfo
|
||||
{
|
||||
FT_String* version;
|
||||
@ -47,7 +47,7 @@
|
||||
FT_Bool is_fixed_pitch;
|
||||
FT_Short underline_position;
|
||||
FT_UShort underline_thickness;
|
||||
|
||||
|
||||
} T1_FontInfo;
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
* Private dict.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
typedef struct T1_Private
|
||||
{
|
||||
|
||||
@ -99,18 +99,18 @@
|
||||
FT_Long password;
|
||||
|
||||
FT_Short min_feature[2];
|
||||
|
||||
|
||||
} T1_Private;
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* <Enum>
|
||||
* <Enum>
|
||||
* T1_Blend_Flags
|
||||
*
|
||||
* <Description>
|
||||
* A set of flags used to indicate which fields are present in a
|
||||
* given blen dictionary (font info or private). Used to support
|
||||
* given blen dictionary (font info or private). Used to support
|
||||
* multiple masters..
|
||||
*
|
||||
*/
|
||||
@ -122,8 +122,8 @@
|
||||
t1_blend_underline_position,
|
||||
t1_blend_underline_thickness,
|
||||
t1_blend_italic_angle,
|
||||
|
||||
/* required fields in a Private blend dictionary */
|
||||
|
||||
/* required fields in a Private blend dictionary */
|
||||
t1_blend_blue_values,
|
||||
t1_blend_other_blues,
|
||||
t1_blend_standard_width,
|
||||
@ -138,7 +138,7 @@
|
||||
|
||||
/* never remove */
|
||||
t1_blend_max
|
||||
|
||||
|
||||
} T1_Flags;
|
||||
|
||||
|
||||
@ -146,7 +146,7 @@
|
||||
{
|
||||
FT_Fixed min;
|
||||
FT_Fixed max;
|
||||
|
||||
|
||||
} T1_Blend_Pos;
|
||||
|
||||
/*************************************************************************
|
||||
@ -163,14 +163,14 @@
|
||||
{
|
||||
FT_Int num_axis;
|
||||
FT_String* axis_types[4];
|
||||
|
||||
/* XXXX : add /BlendDesignMap entries */
|
||||
|
||||
|
||||
/* XXXX : add /BlendDesignMap entries */
|
||||
|
||||
FT_Int num_blends;
|
||||
T1_Flags* flags [17];
|
||||
T1_Private* privates [17];
|
||||
T1_FontInfo* fontinfos[17];
|
||||
|
||||
|
||||
} T1_Blend;
|
||||
|
||||
|
||||
@ -183,16 +183,16 @@
|
||||
FT_UInt num_subrs;
|
||||
FT_ULong subrmap_offset;
|
||||
FT_Int sd_bytes;
|
||||
|
||||
|
||||
} CID_FontDict;
|
||||
|
||||
|
||||
|
||||
typedef struct CID_Info_
|
||||
{
|
||||
FT_String* cid_font_name;
|
||||
FT_Fixed cid_version;
|
||||
FT_Int cid_font_type;
|
||||
|
||||
|
||||
FT_String* registry;
|
||||
FT_String* ordering;
|
||||
FT_Int supplement;
|
||||
@ -201,16 +201,16 @@
|
||||
|
||||
FT_Int num_xuid;
|
||||
FT_ULong xuid[16];
|
||||
|
||||
|
||||
|
||||
|
||||
FT_ULong cidmap_offset;
|
||||
FT_Int fd_bytes;
|
||||
FT_Int gd_bytes;
|
||||
FT_ULong cid_count;
|
||||
|
||||
|
||||
FT_Int num_font_dicts;
|
||||
CID_FontDict* font_dicts;
|
||||
|
||||
|
||||
} CID_Info;
|
||||
|
||||
|
||||
|
@ -360,7 +360,7 @@
|
||||
FT_UShort usDefaultChar;
|
||||
FT_UShort usBreakChar;
|
||||
FT_UShort usMaxContext;
|
||||
|
||||
|
||||
} TT_OS2;
|
||||
|
||||
|
||||
@ -493,7 +493,7 @@
|
||||
ft_sfnt_post = 5,
|
||||
|
||||
sfnt_max /* don't remove */
|
||||
|
||||
|
||||
} FT_Sfnt_Tag;
|
||||
|
||||
/* internal use only */
|
||||
@ -524,7 +524,7 @@
|
||||
* You can load any table with a different function.. XXX
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
EXPORT_DEF(void*) FT_Get_Sfnt_Table( FT_Face face,
|
||||
FT_Sfnt_Tag tag );
|
||||
|
||||
|
@ -117,7 +117,7 @@ Legal Terms
|
||||
Neither the FreeType authors and contributors nor you shall use
|
||||
the name of the other for commercial, advertising, or promotional
|
||||
purposes without specific prior written permission.
|
||||
|
||||
|
||||
We suggest, but do not require, that you use one or more of the
|
||||
following phrases to refer to this software in your documentation
|
||||
or advertising materials: `FreeType Project', `FreeType Engine',
|
||||
|
@ -53,7 +53,7 @@
|
||||
536870912, 759250125, 1073741824, 1518500250,
|
||||
2147483647
|
||||
};
|
||||
#else
|
||||
#else
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -243,12 +243,12 @@
|
||||
/* <Return> */
|
||||
/* The 32-bit square-root. */
|
||||
/* */
|
||||
|
||||
|
||||
static
|
||||
int ft_order64( FT_Int64 z )
|
||||
{
|
||||
int j = 0;
|
||||
|
||||
|
||||
while ( z )
|
||||
{
|
||||
z = (unsigned INT64)z >> 1;
|
||||
@ -678,13 +678,13 @@
|
||||
/* <Return> */
|
||||
/* The 32-bit square-root. */
|
||||
/* */
|
||||
|
||||
|
||||
static
|
||||
int ft_order64( FT_Int64* z )
|
||||
{
|
||||
FT_Word32 i;
|
||||
int j;
|
||||
|
||||
|
||||
i = z->lo;
|
||||
j = 0;
|
||||
if ( z->hi )
|
||||
@ -692,7 +692,7 @@
|
||||
i = z->hi;
|
||||
j = 32;
|
||||
}
|
||||
|
||||
|
||||
while ( i > 0 )
|
||||
{
|
||||
i >>= 1;
|
||||
|
@ -32,11 +32,11 @@
|
||||
FT_Bool vertical )
|
||||
{
|
||||
FT_Glyph_Metrics* metrics = &face->glyph->metrics;
|
||||
|
||||
|
||||
glyph->memory = face->memory;
|
||||
glyph->width = metrics->width;
|
||||
glyph->height = metrics->height;
|
||||
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
glyph->bearingX = metrics->vertBearingX;
|
||||
@ -110,13 +110,13 @@
|
||||
FT_Pos origin_y = 0;
|
||||
|
||||
*abitglyph = 0;
|
||||
|
||||
|
||||
if (origin)
|
||||
{
|
||||
origin_x = origin->x & 63;
|
||||
origin_y = origin->y & 63;
|
||||
}
|
||||
|
||||
|
||||
/* check arguments if the face's format is not scalable */
|
||||
if ( !(face->face_flags & FT_FACE_FLAG_SCALABLE) && face->transform_flags )
|
||||
{
|
||||
@ -135,10 +135,10 @@
|
||||
/* disable embedded bitmaps for transformed images */
|
||||
if ( face->face_flags & FT_FACE_FLAG_SCALABLE && face->transform_flags )
|
||||
load_flags |= FT_LOAD_NO_BITMAP;
|
||||
|
||||
|
||||
error = FT_Load_Glyph( face, glyph_index, load_flags );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
/* now, handle bitmap and outline glyph images */
|
||||
memory = face->memory;
|
||||
switch ( face->glyph->format )
|
||||
@ -147,22 +147,22 @@
|
||||
{
|
||||
FT_Long size;
|
||||
FT_Bitmap* source;
|
||||
|
||||
|
||||
if ( ALLOC( bitglyph, sizeof(*bitglyph) ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
glyph = (FT_Glyph)bitglyph;
|
||||
glyph->glyph_type = ft_glyph_type_bitmap;
|
||||
ft_prepare_glyph( glyph, face, 0 );
|
||||
|
||||
|
||||
source = &face->glyph->bitmap;
|
||||
size = source->rows * source->pitch;
|
||||
if (size < 0) size = -size;
|
||||
|
||||
|
||||
bitglyph->bitmap = *source;
|
||||
if ( ALLOC( bitglyph->bitmap.buffer, size ) )
|
||||
goto Fail;
|
||||
|
||||
|
||||
/* copy the content of the source glyph */
|
||||
MEM_Copy( bitglyph->bitmap.buffer, source->buffer, size );
|
||||
}
|
||||
@ -173,49 +173,49 @@
|
||||
FT_BBox cbox;
|
||||
FT_Int width, height, pitch;
|
||||
FT_Long size;
|
||||
|
||||
|
||||
/* transform the outline - note that the original metrics are NOT */
|
||||
/* transformed by this.. only the outline points themselves.. */
|
||||
FT_Outline_Transform( &face->glyph->outline, &face->transform_matrix );
|
||||
FT_Outline_Translate( &face->glyph->outline,
|
||||
face->transform_delta.x + origin_x,
|
||||
face->transform_delta.y + origin_y );
|
||||
|
||||
|
||||
/* compute the size in pixels of the outline */
|
||||
FT_Outline_Get_CBox( &face->glyph->outline, &cbox );
|
||||
cbox.xMin &= -64;
|
||||
cbox.yMin &= -64;
|
||||
cbox.xMax = (cbox.xMax+63) & -64;
|
||||
cbox.yMax = (cbox.yMax+63) & -64;
|
||||
|
||||
|
||||
width = (cbox.xMax - cbox.xMin) >> 6;
|
||||
height = (cbox.yMax - cbox.yMin) >> 6;
|
||||
|
||||
/* allocate the pixel buffer for the glyph bitmap */
|
||||
if (grays) pitch = (width+3) & -4; /* some raster implementation need this */
|
||||
else pitch = (width+7) >> 3;
|
||||
|
||||
|
||||
size = pitch * height;
|
||||
if ( ALLOC( bitglyph, sizeof(*bitglyph) ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
glyph = (FT_Glyph)bitglyph;
|
||||
glyph->glyph_type = ft_glyph_type_bitmap;
|
||||
ft_prepare_glyph( glyph, face, 0 );
|
||||
|
||||
|
||||
if ( ALLOC( bitglyph->bitmap.buffer, size ) )
|
||||
goto Fail;
|
||||
|
||||
|
||||
bitglyph->bitmap.width = width;
|
||||
bitglyph->bitmap.rows = height;
|
||||
bitglyph->bitmap.pitch = pitch;
|
||||
bitglyph->bitmap.pixel_mode = grays ? ft_pixel_mode_grays
|
||||
: ft_pixel_mode_mono;
|
||||
bitglyph->bitmap.num_grays = (short)grays;
|
||||
|
||||
|
||||
bitglyph->left = (cbox.xMin >> 6);
|
||||
bitglyph->top = (cbox.yMax >> 6);
|
||||
|
||||
|
||||
/* render the monochrome outline into the target buffer */
|
||||
FT_Outline_Translate( &face->glyph->outline, -cbox.xMin, -cbox.yMin );
|
||||
error = FT_Outline_Get_Bitmap( face->driver->library,
|
||||
@ -228,22 +228,22 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
error = FT_Err_Invalid_Glyph_Index;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
*abitglyph = bitglyph;
|
||||
Exit:
|
||||
return error;
|
||||
|
||||
|
||||
Fail:
|
||||
FREE( glyph );
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* <Function>
|
||||
@ -257,7 +257,7 @@
|
||||
* face :: handle to source face object
|
||||
* glyph_index :: glyph index in face
|
||||
* load_flags :: load flags, see FT_LOAD_FLAG_XXXX constants..
|
||||
*
|
||||
*
|
||||
* <Output>
|
||||
* vecglyph :: pointer to the new outline glyph
|
||||
*
|
||||
@ -269,7 +269,7 @@
|
||||
* FT_LOAD_NO_RECURSE are set..
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_FUNC(FT_Error) FT_Get_Glyph_Outline( FT_Face face,
|
||||
FT_UInt glyph_index,
|
||||
FT_UInt load_flags,
|
||||
@ -280,27 +280,27 @@
|
||||
FT_OutlineGlyph glyph;
|
||||
|
||||
*vecglyph = 0;
|
||||
|
||||
|
||||
/* check that NO_OUTLINE and NO_RECURSE are not set */
|
||||
if (load_flags & (FT_LOAD_NO_OUTLINE|FT_LOAD_NO_RECURSE))
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* disable the loading of embedded bitmaps */
|
||||
load_flags |= FT_LOAD_NO_BITMAP;
|
||||
|
||||
|
||||
error = FT_Load_Glyph( face, glyph_index, load_flags );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
/* check that we really loaded an outline */
|
||||
if ( face->glyph->format != ft_glyph_format_outline )
|
||||
{
|
||||
error = FT_Err_Invalid_Glyph_Index;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* transform the outline - note that the original metrics are NOT */
|
||||
/* transformed by this.. only the outline points themselves.. */
|
||||
if ( face->transform_flags )
|
||||
@ -310,7 +310,7 @@
|
||||
face->transform_delta.x,
|
||||
face->transform_delta.y );
|
||||
}
|
||||
|
||||
|
||||
/* now, create a new outline glyph and copy everything there */
|
||||
memory = face->memory;
|
||||
if ( ALLOC( glyph, sizeof(*glyph) ) )
|
||||
@ -318,20 +318,20 @@
|
||||
|
||||
ft_prepare_glyph( (FT_Glyph)glyph, face, 0 );
|
||||
glyph->metrics.glyph_type = ft_glyph_type_outline;
|
||||
|
||||
|
||||
error = FT_Outline_New( face->driver->library,
|
||||
face->glyph->outline.n_points,
|
||||
face->glyph->outline.n_contours,
|
||||
&glyph->outline );
|
||||
if (!error)
|
||||
error = FT_Outline_Copy( &face->glyph->outline, &glyph->outline );
|
||||
|
||||
|
||||
if (error) goto Fail;
|
||||
|
||||
|
||||
*vecglyph = glyph;
|
||||
Exit:
|
||||
return error;
|
||||
|
||||
|
||||
Fail:
|
||||
FREE( glyph );
|
||||
goto Exit;
|
||||
@ -344,7 +344,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* A function used to set the transform that is applied to glyph images
|
||||
* just after they're loaded in the face's glyph slot, and before they're
|
||||
* just after they're loaded in the face's glyph slot, and before they're
|
||||
* returned by either FT_Get_Glyph_Bitmap or FT_Get_Glyph_Outline
|
||||
*
|
||||
* <Input>
|
||||
@ -357,13 +357,13 @@
|
||||
* in a font face. It is unable to transform embedded glyph bitmaps
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_FUNC(void) FT_Set_Transform( FT_Face face,
|
||||
FT_Matrix* matrix,
|
||||
FT_Vector* delta )
|
||||
{
|
||||
face->transform_flags = 0;
|
||||
|
||||
|
||||
if (!matrix)
|
||||
{
|
||||
face->transform_matrix.xx = 0x10000L;
|
||||
@ -374,7 +374,7 @@
|
||||
}
|
||||
else
|
||||
face->transform_matrix = *matrix;
|
||||
|
||||
|
||||
/* set transform_flags bit flag 0 if delta isn't the null vector */
|
||||
if ( (matrix->xy | matrix->yx) ||
|
||||
matrix->xx != 0x10000L ||
|
||||
@ -389,7 +389,7 @@
|
||||
}
|
||||
else
|
||||
face->transform_delta = *delta;
|
||||
|
||||
|
||||
/* set transform_flags bit flag 1 if delta isn't the null vector */
|
||||
if ( delta->x | delta->y )
|
||||
face->transform_flags |= 2;
|
||||
@ -404,16 +404,16 @@
|
||||
* Destroys a given glyph..
|
||||
*
|
||||
* <Input>
|
||||
* glyph :: handle to target glyph object
|
||||
* glyph :: handle to target glyph object
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_FUNC(void) FT_Done_Glyph( FT_Glyph glyph )
|
||||
{
|
||||
if (glyph)
|
||||
{
|
||||
FT_Memory memory = glyph->memory;
|
||||
|
||||
|
||||
if ( glyph->glyph_type == ft_glyph_type_bitmap )
|
||||
{
|
||||
FT_BitmapGlyph bit = (FT_BitmapGlyph)glyph;
|
||||
@ -429,7 +429,7 @@
|
||||
FREE( out->outline.tags );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FREE( glyph );
|
||||
}
|
||||
}
|
||||
@ -444,7 +444,7 @@
|
||||
* Returns the glyph image's bounding box in pixels.
|
||||
*
|
||||
* <Input>
|
||||
* glyph :: handle to target glyph object
|
||||
* glyph :: handle to target glyph object
|
||||
*
|
||||
* <Output>
|
||||
* box :: the glyph bounding box. Coordinates are expressed in
|
||||
@ -458,13 +458,13 @@
|
||||
* The height is box.yMax - box.yMin
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
EXPORT_FUNC(void) FT_Glyph_Get_Box( FT_Glyph glyph,
|
||||
FT_BBox *box )
|
||||
{
|
||||
box->xMin = box->xMax = 0;
|
||||
box->yMin = box->yMax = 0;
|
||||
|
||||
|
||||
if (glyph) switch (glyph->glyph_type)
|
||||
{
|
||||
case ft_glyph_type_bitmap:
|
||||
@ -476,11 +476,11 @@
|
||||
box->yMin = box->yMax - bit->bitmap.rows;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ft_glyph_type_outline:
|
||||
{
|
||||
FT_OutlineGlyph out = (FT_OutlineGlyph)glyph;
|
||||
|
||||
|
||||
FT_Outline_Get_CBox( &out->outline, box );
|
||||
box->xMin >>= 6;
|
||||
box->yMin >>= 6;
|
||||
@ -488,7 +488,7 @@
|
||||
box->yMax = (box->yMax+63) >> 6;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
@ -502,7 +502,7 @@
|
||||
/**** ****/
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
/* Compute the norm of a vector */
|
||||
@ -542,21 +542,21 @@
|
||||
hi = (FT_ULong)u >> 16;
|
||||
lo = (FT_ULong)u & 0xFFFF;
|
||||
med = hi*lo;
|
||||
|
||||
|
||||
H = hi*hi + (med >> 15);
|
||||
med <<= 17;
|
||||
L = lo*lo + med;
|
||||
if (L < med) H++;
|
||||
|
||||
|
||||
hi = (FT_ULong)v >> 16;
|
||||
lo = (FT_ULong)v & 0xFFFF;
|
||||
med = hi*lo;
|
||||
|
||||
|
||||
H += hi*hi + (med >> 15);
|
||||
med <<= 17;
|
||||
L2 = lo*lo + med;
|
||||
if (L2 < med) H++;
|
||||
|
||||
|
||||
L += L2;
|
||||
if (L < L2) H++;
|
||||
|
||||
@ -598,17 +598,17 @@
|
||||
prev = cur - 1;
|
||||
next = cur + 1;
|
||||
|
||||
first = 0;
|
||||
first = 0;
|
||||
for ( c = 0; c < outline->n_contours; c++ )
|
||||
{
|
||||
last = outline->contours[c];
|
||||
|
||||
if ( n == first )
|
||||
prev = outline->points + last;
|
||||
|
||||
|
||||
if ( n == last )
|
||||
next = outline->points + first;
|
||||
|
||||
|
||||
first = last + 1;
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@
|
||||
for ( c = 0; c < outline->n_contours; c++ )
|
||||
{
|
||||
int last = outline->contours[c];
|
||||
|
||||
|
||||
prev = points[last];
|
||||
|
||||
for ( n = first; n <= last; n++ )
|
||||
@ -777,7 +777,7 @@
|
||||
|
||||
x = distance + cur.x + FT_MulFix( d, u.x + v.x )/2;
|
||||
y = distance + cur.y + FT_MulFix( d, u.y + v.y )/2;
|
||||
|
||||
|
||||
outline->points[n].x = x;
|
||||
outline->points[n].y = y;
|
||||
}
|
||||
@ -794,4 +794,4 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* 0 - EXPERIMENTAL STUFF !! */
|
||||
#endif /* 0 - EXPERIMENTAL STUFF !! */
|
||||
|
@ -120,7 +120,7 @@ typedef long TPos; /* sub-pixel coordinate */
|
||||
#define FT_MAX_GRAY_SPANS 32
|
||||
|
||||
|
||||
#ifdef GRAYS_COMPACT
|
||||
#ifdef GRAYS_COMPACT
|
||||
typedef struct TCell_
|
||||
{
|
||||
short x : 14;
|
||||
@ -599,12 +599,12 @@ int render_conic( RAS_ARG_ FT_Vector* control, FT_Vector* to )
|
||||
/* we compute the mid-point directly in order to avoid */
|
||||
/* calling split_conic().. */
|
||||
TPos to_x, to_y, mid_x, mid_y;
|
||||
|
||||
|
||||
to_x = UPSCALE(to->x);
|
||||
to_y = UPSCALE(to->y);
|
||||
mid_x = (ras.x + to_x + 2*UPSCALE(control->x))/4;
|
||||
mid_y = (ras.y + to_y + 2*UPSCALE(control->y))/4;
|
||||
|
||||
|
||||
return render_line( RAS_VAR_ mid_x, mid_y ) ||
|
||||
render_line( RAS_VAR_ to_x, to_y );
|
||||
}
|
||||
@ -613,7 +613,7 @@ int render_conic( RAS_ARG_ FT_Vector* control, FT_Vector* to )
|
||||
levels = ras.lev_stack;
|
||||
top = 0;
|
||||
levels[0] = level;
|
||||
|
||||
|
||||
arc[0].x = UPSCALE(to->x);
|
||||
arc[0].y = UPSCALE(to->y);
|
||||
arc[1].x = UPSCALE(control->x);
|
||||
@ -647,12 +647,12 @@ int render_conic( RAS_ARG_ FT_Vector* control, FT_Vector* to )
|
||||
Draw:
|
||||
{
|
||||
TPos to_x, to_y, mid_x, mid_y;
|
||||
|
||||
|
||||
to_x = arc[0].x;
|
||||
to_y = arc[0].y;
|
||||
mid_x = (ras.x + to_x + 2*arc[1].x)/4;
|
||||
mid_y = (ras.y + to_y + 2*arc[1].y)/4;
|
||||
|
||||
|
||||
if ( render_line( RAS_VAR_ mid_x, mid_y ) ||
|
||||
render_line( RAS_VAR_ to_x, to_y ) ) return 1;
|
||||
top--;
|
||||
@ -723,12 +723,12 @@ int render_cubic( RAS_ARG_ FT_Vector* control1,
|
||||
if (level <= 1)
|
||||
{
|
||||
TPos to_x, to_y, mid_x, mid_y;
|
||||
|
||||
|
||||
to_x = UPSCALE(to->x);
|
||||
to_y = UPSCALE(to->y);
|
||||
mid_x = (ras.x + to_x + 3*UPSCALE(control1->x+control2->x))/8;
|
||||
mid_y = (ras.y + to_y + 3*UPSCALE(control1->y+control2->y))/8;
|
||||
|
||||
|
||||
return render_line( RAS_VAR_ mid_x, mid_y ) ||
|
||||
render_line( RAS_VAR_ to_x, to_y );
|
||||
}
|
||||
@ -775,12 +775,12 @@ int render_cubic( RAS_ARG_ FT_Vector* control1,
|
||||
Draw:
|
||||
{
|
||||
TPos to_x, to_y, mid_x, mid_y;
|
||||
|
||||
|
||||
to_x = arc[0].x;
|
||||
to_y = arc[0].y;
|
||||
mid_x = (ras.x + to_x + 3*(arc[1].x+arc[2].x))/8;
|
||||
mid_y = (ras.y + to_y + 3*(arc[1].y+arc[2].y))/8;
|
||||
|
||||
|
||||
if ( render_line( RAS_VAR_ mid_x, mid_y ) ||
|
||||
render_line( RAS_VAR_ to_x, to_y ) ) return 1;
|
||||
top --;
|
||||
@ -1015,9 +1015,9 @@ int check_sort( PCell cells, int count )
|
||||
for ( ; count > 0; count--, spans++ )
|
||||
{
|
||||
if (spans->coverage)
|
||||
#if 1
|
||||
#if 1
|
||||
memset( p + spans->x, (spans->coverage+1) >> 1, spans->len );
|
||||
#else
|
||||
#else
|
||||
{
|
||||
q = p + spans->x;
|
||||
limit = q + spans->len;
|
||||
@ -1172,7 +1172,7 @@ int check_sort( PCell cells, int count )
|
||||
++cur;
|
||||
if (cur >= limit || cur->y != start->y || cur->x != start->x)
|
||||
break;
|
||||
|
||||
|
||||
area += cur->area;
|
||||
cover += cur->cover;
|
||||
}
|
||||
@ -1226,7 +1226,7 @@ int check_sort( PCell cells, int count )
|
||||
typedef struct TBand_
|
||||
{
|
||||
FT_Pos min, max;
|
||||
|
||||
|
||||
} TBand;
|
||||
|
||||
static
|
||||
@ -1254,7 +1254,7 @@ int check_sort( PCell cells, int count )
|
||||
if ( ras.max_ex <= 0 || ras.min_ex >= ras.target.width ||
|
||||
ras.max_ey <= 0 || ras.min_ey >= ras.target.rows )
|
||||
return 0;
|
||||
|
||||
|
||||
if (ras.min_ex < 0) ras.min_ex = 0;
|
||||
if (ras.min_ey < 0) ras.min_ey = 0;
|
||||
|
||||
@ -1271,7 +1271,7 @@ int check_sort( PCell cells, int count )
|
||||
level++;
|
||||
if (ras.max_ex > 120 || ras.max_ey > 120)
|
||||
level+=2;
|
||||
|
||||
|
||||
ras.conic_level <<= level;
|
||||
ras.cubic_level <<= level;
|
||||
}
|
||||
@ -1280,7 +1280,7 @@ int check_sort( PCell cells, int count )
|
||||
num_bands = (ras.max_ey - ras.min_ey)/ras.band_size;
|
||||
if (num_bands == 0) num_bands = 1;
|
||||
if (num_bands >= 39) num_bands = 39;
|
||||
|
||||
|
||||
ras.band_shoot = 0;
|
||||
|
||||
min = ras.min_ey;
|
||||
@ -1290,24 +1290,24 @@ int check_sort( PCell cells, int count )
|
||||
max = min + ras.band_size;
|
||||
if (n == num_bands-1 || max > max_y)
|
||||
max = max_y;
|
||||
|
||||
|
||||
bands[0].min = min;
|
||||
bands[0].max = max;
|
||||
band = bands;
|
||||
|
||||
|
||||
while (band >= bands)
|
||||
{
|
||||
FT_Pos bottom, top, middle;
|
||||
int error;
|
||||
|
||||
|
||||
ras.num_cells = 0;
|
||||
ras.invalid = 1;
|
||||
ras.min_ey = band->min;
|
||||
ras.max_ey = band->max;
|
||||
|
||||
|
||||
error = FT_Outline_Decompose( outline, &interface, &ras ) ||
|
||||
record_cell( RAS_VAR );
|
||||
|
||||
|
||||
if (!error)
|
||||
{
|
||||
#ifdef SHELL_SORT
|
||||
@ -1315,22 +1315,22 @@ int check_sort( PCell cells, int count )
|
||||
#else
|
||||
quick_sort( ras.cells, ras.num_cells );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG_GRAYS
|
||||
check_sort( ras.cells, ras.num_cells );
|
||||
dump_cells( RAS_VAR );
|
||||
#endif
|
||||
|
||||
|
||||
grays_sweep( RAS_VAR_ &ras.target );
|
||||
band--;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* render pool overflow, we will reduce the render band by half */
|
||||
bottom = band->min;
|
||||
top = band->max;
|
||||
middle = bottom + ((top-bottom) >> 1);
|
||||
|
||||
|
||||
/* waoow !! this is too complex for a single scanline, something */
|
||||
/* must be really rotten here !! */
|
||||
if (middle == bottom)
|
||||
@ -1340,10 +1340,10 @@ int check_sort( PCell cells, int count )
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (bottom-top >= ras.band_size)
|
||||
ras.band_shoot++;
|
||||
|
||||
|
||||
band[1].min = bottom;
|
||||
band[1].max = middle;
|
||||
band[0].min = middle;
|
||||
@ -1461,10 +1461,10 @@ int check_sort( PCell cells, int count )
|
||||
long pool_size )
|
||||
{
|
||||
PRaster rast = (PRaster)raster;
|
||||
|
||||
|
||||
if (raster && pool_base && pool_size >= 4096)
|
||||
init_cells( rast, (char*)pool_base, pool_size );
|
||||
|
||||
|
||||
rast->band_size = (pool_size / sizeof(TCell))/8;
|
||||
}
|
||||
|
||||
|
@ -227,9 +227,9 @@
|
||||
memory = library->memory;
|
||||
if ( ALLOC( stream, sizeof ( *stream ) ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
stream->memory = memory;
|
||||
|
||||
|
||||
/* now, look at the stream flags */
|
||||
if ( args->flags & ft_open_memory )
|
||||
{
|
||||
@ -253,10 +253,10 @@
|
||||
{
|
||||
error = FT_Err_Invalid_Argument;
|
||||
}
|
||||
|
||||
|
||||
if ( error )
|
||||
FREE( stream );
|
||||
|
||||
|
||||
*astream = stream;
|
||||
Exit:
|
||||
return error;
|
||||
@ -341,7 +341,7 @@
|
||||
face->generic.finalizer( face );
|
||||
|
||||
/* close the stream for this face */
|
||||
ft_done_stream( &face->stream );
|
||||
ft_done_stream( &face->stream );
|
||||
|
||||
/* get rid of it */
|
||||
FREE( face );
|
||||
@ -394,8 +394,8 @@
|
||||
* FT_Get_Raster
|
||||
*
|
||||
* <Description>
|
||||
* Return a pointer to the raster corresponding to a given glyph
|
||||
* format tag.
|
||||
* Return a pointer to the raster corresponding to a given glyph
|
||||
* format tag.
|
||||
*
|
||||
* <Input>
|
||||
* library :: handle to source library object
|
||||
@ -408,13 +408,13 @@
|
||||
* a pointer to the corresponding raster object.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
EXPORT_FUNC(FT_Raster) FT_Get_Raster( FT_Library library,
|
||||
FT_Glyph_Format glyph_format,
|
||||
FT_Raster_Funcs *raster_funcs )
|
||||
{
|
||||
FT_Int n;
|
||||
|
||||
|
||||
for ( n = 0; n < FT_MAX_GLYPH_FORMATS; n++ )
|
||||
{
|
||||
FT_Raster_Funcs* funcs = &library->raster_funcs[n];
|
||||
@ -462,18 +462,18 @@
|
||||
FT_Raster raster;
|
||||
FT_Error error;
|
||||
FT_Int n, index;
|
||||
|
||||
|
||||
if ( glyph_format == ft_glyph_format_none)
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
|
||||
/* create a new raster object */
|
||||
error = raster_funcs->raster_new( library->memory, &raster );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
raster_funcs->raster_reset( raster,
|
||||
library->raster_pool,
|
||||
library->raster_pool_size );
|
||||
|
||||
|
||||
index = -1;
|
||||
for (n = 0; n < FT_MAX_GLYPH_FORMATS; n++)
|
||||
{
|
||||
@ -482,7 +482,7 @@
|
||||
/* record the first vacant entry in "index" */
|
||||
if (index < 0 && funcs->glyph_format == ft_glyph_format_none)
|
||||
index = n;
|
||||
|
||||
|
||||
/* compare this entry's glyph format with the one we need */
|
||||
if (funcs->glyph_format == glyph_format)
|
||||
{
|
||||
@ -511,7 +511,7 @@
|
||||
Fail:
|
||||
raster_funcs->raster_done( raster );
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -534,8 +534,8 @@
|
||||
FT_Glyph_Format glyph_format = raster_funcs->glyph_format;
|
||||
FT_Error error;
|
||||
FT_Int n;
|
||||
|
||||
error = FT_Err_Invalid_Argument;
|
||||
|
||||
error = FT_Err_Invalid_Argument;
|
||||
if ( glyph_format == ft_glyph_format_none)
|
||||
goto Exit;
|
||||
|
||||
@ -581,7 +581,7 @@
|
||||
{
|
||||
FT_Raster_Funcs funcs;
|
||||
FT_Raster raster;
|
||||
|
||||
|
||||
raster = FT_Get_Raster( library, format, &funcs );
|
||||
if (raster && funcs.raster_set_mode )
|
||||
return funcs.raster_set_mode( raster, mode, args );
|
||||
@ -657,7 +657,7 @@
|
||||
/* now register the default raster for the `outline' glyph image format */
|
||||
/* for now, ignore the error... */
|
||||
error = FT_Set_Raster( library, &ft_default_raster );
|
||||
|
||||
|
||||
|
||||
/* That's ok now */
|
||||
*alibrary = library;
|
||||
@ -1133,13 +1133,13 @@
|
||||
{
|
||||
FT_Int num_params = 0;
|
||||
FT_Parameter* params = 0;
|
||||
|
||||
|
||||
if ( args->flags & ft_open_params )
|
||||
{
|
||||
num_params = args->num_params;
|
||||
params = args->params;
|
||||
}
|
||||
|
||||
|
||||
error = open_face( driver, stream, face_index,
|
||||
num_params, params, &face );
|
||||
if ( !error )
|
||||
@ -1164,13 +1164,13 @@
|
||||
{
|
||||
FT_Int num_params = 0;
|
||||
FT_Parameter* params = 0;
|
||||
|
||||
|
||||
if ( args->flags & ft_open_params )
|
||||
{
|
||||
num_params = args->num_params;
|
||||
params = args->params;
|
||||
}
|
||||
|
||||
|
||||
error = open_face( driver, stream, face_index,
|
||||
num_params, params, &face );
|
||||
if ( !error )
|
||||
@ -1194,7 +1194,7 @@
|
||||
goto Fail;
|
||||
|
||||
node->data = face;
|
||||
/* don't assume driver is the same as face->driver, so use
|
||||
/* don't assume driver is the same as face->driver, so use
|
||||
face->driver instead. (JvR 3/5/2000) */
|
||||
FT_List_Add( &face->driver->faces_list, node );
|
||||
|
||||
@ -1283,7 +1283,7 @@
|
||||
return FT_Attach_Stream( face, &open );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -1315,33 +1315,33 @@
|
||||
FT_Stream stream;
|
||||
FT_Error error;
|
||||
FT_Driver driver;
|
||||
|
||||
|
||||
FTDriver_getInterface get_interface;
|
||||
|
||||
|
||||
if ( !face || !face->driver )
|
||||
return FT_Err_Invalid_Handle;
|
||||
|
||||
|
||||
driver = face->driver;
|
||||
error = ft_new_input_stream( driver->library, parameters, &stream );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
/* we implement FT_Attach_Stream in each driver through the */
|
||||
/* "attach_file" interface.. */
|
||||
error = FT_Err_Unimplemented_Feature;
|
||||
|
||||
get_interface = driver->interface.get_interface;
|
||||
if (get_interface)
|
||||
if (get_interface)
|
||||
{
|
||||
FT_Attach_Reader reader;
|
||||
|
||||
|
||||
reader = (FT_Attach_Reader)(get_interface( driver, "attach_file" ));
|
||||
if (reader)
|
||||
error = reader( face, stream );
|
||||
}
|
||||
|
||||
|
||||
/* close the attached stream */
|
||||
ft_done_stream( &stream );
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
@ -1653,7 +1653,7 @@
|
||||
face->units_per_EM );
|
||||
}
|
||||
|
||||
error = interface->set_pixel_sizes( face->size,
|
||||
error = interface->set_pixel_sizes( face->size,
|
||||
pixel_width,
|
||||
pixel_height );
|
||||
return error;
|
||||
@ -1814,7 +1814,7 @@
|
||||
return FT_Err_Invalid_Face_Handle;
|
||||
|
||||
driver = face->driver;
|
||||
|
||||
|
||||
/* when the flag NO_RECURSE is set, we disable hinting and scaling */
|
||||
if (load_flags & FT_LOAD_NO_RECURSE)
|
||||
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
|
||||
@ -1940,7 +1940,7 @@
|
||||
{
|
||||
FT_CharMap* cur = face->charmaps;
|
||||
FT_CharMap* limit = cur + face->num_charmaps;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
if ( cur[0]->encoding == encoding )
|
||||
@ -1979,7 +1979,7 @@
|
||||
{
|
||||
FT_CharMap* cur = face->charmaps;
|
||||
FT_CharMap* limit = cur + face->num_charmaps;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
if ( cur[0] == charmap )
|
||||
@ -2048,26 +2048,26 @@
|
||||
* You can load any table with a different function.. XXX
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
EXPORT_FUNC(void*) FT_Get_Sfnt_Table( FT_Face face,
|
||||
FT_Sfnt_Tag tag )
|
||||
{
|
||||
void* table = 0;
|
||||
FT_Get_Sfnt_Table_Func func;
|
||||
FT_Driver driver;
|
||||
|
||||
|
||||
if (!face || !FT_IS_SFNT(face))
|
||||
goto Exit;
|
||||
|
||||
|
||||
driver = face->driver;
|
||||
func = (FT_Get_Sfnt_Table_Func)driver->interface.get_interface( driver, "get_sfnt" );
|
||||
if (func)
|
||||
table = func(face,tag);
|
||||
|
||||
|
||||
Exit:
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
|
||||
v_start = outline->points[first];
|
||||
v_last = outline->points[last];
|
||||
|
||||
|
||||
v_start.x = SCALED(v_start.x); v_start.y = SCALED(v_start.y);
|
||||
v_last.x = SCALED(v_last.x); v_last.y = SCALED(v_last.y);
|
||||
|
||||
@ -133,91 +133,91 @@
|
||||
{
|
||||
point++;
|
||||
tags++;
|
||||
|
||||
|
||||
tag = FT_CURVE_TAG( tags[0] );
|
||||
switch (tag)
|
||||
{
|
||||
case FT_Curve_Tag_On: /* emit a single line_to */
|
||||
{
|
||||
FT_Vector vec;
|
||||
|
||||
|
||||
vec.x = SCALED(point->x);
|
||||
vec.y = SCALED(point->y);
|
||||
|
||||
|
||||
error = interface->line_to( &vec, user );
|
||||
if (error) goto Exit;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
case FT_Curve_Tag_Conic: /* consume conic arcs */
|
||||
{
|
||||
v_control.x = SCALED(point->x);
|
||||
v_control.y = SCALED(point->y);
|
||||
|
||||
|
||||
Do_Conic:
|
||||
if (point < limit)
|
||||
{
|
||||
FT_Vector vec;
|
||||
FT_Vector v_middle;
|
||||
|
||||
|
||||
point++;
|
||||
tags++;
|
||||
tag = FT_CURVE_TAG( tags[0] );
|
||||
|
||||
|
||||
vec.x = SCALED(point->x);
|
||||
vec.y = SCALED(point->y);
|
||||
|
||||
|
||||
if (tag == FT_Curve_Tag_On)
|
||||
{
|
||||
error = interface->conic_to( &v_control, &vec, user );
|
||||
if (error) goto Exit;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (tag != FT_Curve_Tag_Conic)
|
||||
goto Invalid_Outline;
|
||||
|
||||
|
||||
v_middle.x = (v_control.x + vec.x)/2;
|
||||
v_middle.y = (v_control.y + vec.y)/2;
|
||||
|
||||
|
||||
error = interface->conic_to( &v_control, &v_middle, user );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
v_control = vec;
|
||||
goto Do_Conic;
|
||||
}
|
||||
|
||||
|
||||
error = interface->conic_to( &v_control, &v_start, user );
|
||||
goto Close;
|
||||
}
|
||||
|
||||
|
||||
default: /* FT_Curve_Tag_Cubic */
|
||||
{
|
||||
FT_Vector vec1, vec2;
|
||||
|
||||
|
||||
if ( point+1 > limit ||
|
||||
FT_CURVE_TAG( tags[1] ) != FT_Curve_Tag_Cubic )
|
||||
goto Invalid_Outline;
|
||||
|
||||
|
||||
point += 2;
|
||||
tags += 2;
|
||||
|
||||
|
||||
vec1.x = SCALED(point[-2].x); vec1.y = SCALED(point[-2].y);
|
||||
vec2.x = SCALED(point[-1].x); vec2.y = SCALED(point[-1].y);
|
||||
|
||||
if (point <= limit)
|
||||
{
|
||||
FT_Vector vec;
|
||||
|
||||
|
||||
vec.x = SCALED(point->x);
|
||||
vec.y = SCALED(point->y);
|
||||
|
||||
|
||||
error = interface->cubic_to( &vec1, &vec2, &vec, user );
|
||||
if (error) goto Exit;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
error = interface->cubic_to( &vec1, &vec2, &v_start, user );
|
||||
goto Close;
|
||||
}
|
||||
@ -226,7 +226,7 @@
|
||||
|
||||
/* close the contour with a line segment */
|
||||
error = interface->line_to( &v_start, user );
|
||||
|
||||
|
||||
Close:
|
||||
if (error) goto Exit;
|
||||
first = last+1;
|
||||
@ -235,7 +235,7 @@
|
||||
return 0;
|
||||
Exit:
|
||||
return error;
|
||||
|
||||
|
||||
Invalid_Outline:
|
||||
return -1;
|
||||
}
|
||||
@ -389,7 +389,7 @@
|
||||
FT_BBox* cbox )
|
||||
{
|
||||
FT_Pos xMin, yMin, xMax, yMax;
|
||||
|
||||
|
||||
if ( outline && cbox )
|
||||
{
|
||||
if ( outline->n_points == 0 )
|
||||
@ -428,7 +428,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -481,18 +481,18 @@
|
||||
{
|
||||
FT_UShort n;
|
||||
FT_Int first, last;
|
||||
|
||||
|
||||
first = 0;
|
||||
for ( n = 0; n < outline->n_contours; n++ )
|
||||
{
|
||||
last = outline->contours[n];
|
||||
|
||||
|
||||
/* reverse point table */
|
||||
{
|
||||
FT_Vector* p = outline->points + first;
|
||||
FT_Vector* q = outline->points + last;
|
||||
FT_Vector swap;
|
||||
|
||||
|
||||
while (p < q)
|
||||
{
|
||||
swap = *p;
|
||||
@ -502,13 +502,13 @@
|
||||
q--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* reverse tags table */
|
||||
{
|
||||
char* p = outline->tags + first;
|
||||
char* q = outline->tags + last;
|
||||
char swap;
|
||||
|
||||
|
||||
while (p < q)
|
||||
{
|
||||
swap = *p;
|
||||
@ -518,7 +518,7 @@
|
||||
q--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
first = last+1;
|
||||
}
|
||||
outline->flags ^= ft_outline_reverse_fill;
|
||||
@ -538,7 +538,7 @@
|
||||
BASE_FUNC(void) FT_Done_GlyphZone( FT_GlyphZone* zone )
|
||||
{
|
||||
FT_Memory memory = zone->memory;
|
||||
|
||||
|
||||
FREE( zone->contours );
|
||||
FREE( zone->tags );
|
||||
FREE( zone->cur );
|
||||
@ -547,7 +547,7 @@
|
||||
zone->max_points = zone->n_points = 0;
|
||||
zone->max_contours = zone->n_contours = 0;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -581,7 +581,7 @@
|
||||
|
||||
MEM_Set( zone, 0, sizeof(*zone) );
|
||||
zone->memory = memory;
|
||||
|
||||
|
||||
if ( ALLOC_ARRAY( zone->org, maxPoints*2, FT_F26Dot6 ) ||
|
||||
ALLOC_ARRAY( zone->cur, maxPoints*2, FT_F26Dot6 ) ||
|
||||
ALLOC_ARRAY( zone->tags, maxPoints, FT_Byte ) ||
|
||||
@ -621,7 +621,7 @@
|
||||
{
|
||||
FT_Error error = FT_Err_Ok;
|
||||
FT_Memory memory = zone->memory;
|
||||
|
||||
|
||||
newPoints += 2;
|
||||
if ( zone->max_points < newPoints )
|
||||
{
|
||||
@ -630,16 +630,16 @@
|
||||
REALLOC_ARRAY( zone->cur, zone->max_points*2, newPoints*2, FT_F26Dot6 ) ||
|
||||
REALLOC_ARRAY( zone->tags, zone->max_points*2, newPoints, FT_Byte ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
zone->max_points = newPoints;
|
||||
}
|
||||
|
||||
|
||||
if ( zone->max_contours < newContours )
|
||||
{
|
||||
/* reallocate the contours array */
|
||||
if ( REALLOC_ARRAY( zone->contours, zone->max_contours, newContours, FT_UShort ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
zone->max_contours = newContours;
|
||||
}
|
||||
Exit:
|
||||
@ -692,7 +692,7 @@
|
||||
params.flags = 0;
|
||||
if (map->pixel_mode == ft_pixel_mode_grays)
|
||||
params.flags |= ft_raster_flag_aa;
|
||||
|
||||
|
||||
error = funcs.raster_render( raster, ¶ms );
|
||||
Exit:
|
||||
return error;
|
||||
@ -732,7 +732,7 @@
|
||||
EXPORT_FUNC(FT_Error) FT_Outline_Render( FT_Library library,
|
||||
FT_Outline* outline,
|
||||
FT_Raster_Params* params )
|
||||
{
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Raster raster;
|
||||
FT_Raster_Funcs funcs;
|
||||
@ -788,7 +788,7 @@
|
||||
FT_Outline* target )
|
||||
{
|
||||
FT_Int is_owner;
|
||||
|
||||
|
||||
if ( !source || !target ||
|
||||
source->n_points != target->n_points ||
|
||||
source->n_contours != target->n_contours )
|
||||
@ -806,7 +806,7 @@
|
||||
/* copy all flags, except the "ft_outline_owner" one */
|
||||
is_owner = target->flags & ft_outline_owner;
|
||||
target->flags = source->flags;
|
||||
|
||||
|
||||
target->flags &= ~ft_outline_owner;
|
||||
target->flags |= is_owner;
|
||||
return FT_Err_Ok;
|
||||
|
@ -189,14 +189,14 @@
|
||||
/** **/
|
||||
/****************************************************************/
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
typedef int Int;
|
||||
typedef unsigned int UInt;
|
||||
typedef short Short;
|
||||
typedef unsigned short UShort, *PUShort;
|
||||
typedef long Long, *PLong;
|
||||
typedef unsigned long ULong;
|
||||
|
||||
|
||||
typedef unsigned char Byte, *PByte;
|
||||
typedef char Bool;
|
||||
|
||||
@ -204,7 +204,7 @@
|
||||
{
|
||||
Long x;
|
||||
Long y;
|
||||
|
||||
|
||||
} TPoint;
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@
|
||||
Flow_None = 0,
|
||||
Flow_Up = 1,
|
||||
Flow_Down = -1
|
||||
|
||||
|
||||
} TFlow;
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
Ascending,
|
||||
Descending,
|
||||
Flat
|
||||
|
||||
|
||||
} TStates;
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@
|
||||
{
|
||||
Short y_min; /* band's minimum */
|
||||
Short y_max; /* band's maximum */
|
||||
|
||||
|
||||
} TBand;
|
||||
|
||||
|
||||
@ -410,7 +410,7 @@
|
||||
/* in bytes of at least 'gray_width*2' */
|
||||
|
||||
#endif /* FT_RASTER_ANTI_ALIASING */
|
||||
|
||||
|
||||
#if 0
|
||||
PByte flags; /* current flags table */
|
||||
PUShort outs; /* current outlines table */
|
||||
@ -428,7 +428,7 @@
|
||||
|
||||
static TRaster_Instance cur_ras;
|
||||
#define ras cur_ras
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#define ras (*raster)
|
||||
@ -442,7 +442,7 @@
|
||||
/** **/
|
||||
/****************************************************************/
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
@ -1415,7 +1415,7 @@
|
||||
SWAP_(v_start.x,v_start.y);
|
||||
SWAP_(v_last.x,v_last.y);
|
||||
}
|
||||
|
||||
|
||||
v_control = v_start;
|
||||
|
||||
point = points + first;
|
||||
@ -1457,14 +1457,14 @@
|
||||
{
|
||||
point++;
|
||||
tags++;
|
||||
|
||||
|
||||
tag = FT_CURVE_TAG( tags[0] );
|
||||
switch (tag)
|
||||
{
|
||||
case FT_Curve_Tag_On: /* emit a single line_to */
|
||||
{
|
||||
Long x, y;
|
||||
|
||||
|
||||
x = SCALED(point->x);
|
||||
y = SCALED(point->y);
|
||||
if (flipped) SWAP_(x,y);
|
||||
@ -1473,64 +1473,64 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
case FT_Curve_Tag_Conic: /* consume conic arcs */
|
||||
{
|
||||
v_control.x = SCALED(point[0].x);
|
||||
v_control.y = SCALED(point[0].y);
|
||||
if (flipped) SWAP_(v_control.x,v_control.y);
|
||||
|
||||
|
||||
Do_Conic:
|
||||
if (point < limit)
|
||||
{
|
||||
FT_Vector v_middle;
|
||||
Long x, y;
|
||||
|
||||
|
||||
point++;
|
||||
tags++;
|
||||
tag = FT_CURVE_TAG( tags[0] );
|
||||
|
||||
|
||||
x = SCALED(point[0].x);
|
||||
y = SCALED(point[0].y);
|
||||
if (flipped) SWAP_(x,y);
|
||||
|
||||
|
||||
if (tag == FT_Curve_Tag_On)
|
||||
{
|
||||
if (Conic_To( RAS_VARS v_control.x, v_control.y, x, y ))
|
||||
goto Fail;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (tag != FT_Curve_Tag_Conic)
|
||||
goto Invalid_Outline;
|
||||
|
||||
v_middle.x = (v_control.x + x)/2;
|
||||
v_middle.y = (v_control.y + y)/2;
|
||||
|
||||
if (Conic_To( RAS_VARS v_control.x, v_control.y,
|
||||
if (Conic_To( RAS_VARS v_control.x, v_control.y,
|
||||
v_middle.x, v_middle.y )) goto Fail;
|
||||
|
||||
|
||||
v_control.x = x;
|
||||
v_control.y = y;
|
||||
goto Do_Conic;
|
||||
}
|
||||
|
||||
|
||||
if (Conic_To( RAS_VARS v_control.x, v_control.y,
|
||||
v_start.x, v_start.y )) goto Fail;
|
||||
goto Close;
|
||||
}
|
||||
|
||||
|
||||
default: /* FT_Curve_Tag_Cubic */
|
||||
{
|
||||
Long x1, y1, x2, y2, x3, y3;
|
||||
|
||||
|
||||
if ( point+1 > limit ||
|
||||
FT_CURVE_TAG( tags[1] ) != FT_Curve_Tag_Cubic )
|
||||
goto Invalid_Outline;
|
||||
|
||||
|
||||
point += 2;
|
||||
tags += 2;
|
||||
|
||||
|
||||
x1 = SCALED(point[-2].x);
|
||||
y1 = SCALED(point[-2].y);
|
||||
x2 = SCALED(point[-1].x);
|
||||
@ -1549,7 +1549,7 @@
|
||||
goto Fail;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Cubic_To( RAS_VARS x1, y1, x2, y2, v_start.x, v_start.y ))
|
||||
goto Fail;
|
||||
goto Close;
|
||||
@ -1563,14 +1563,14 @@
|
||||
|
||||
Close:
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
Invalid_Outline:
|
||||
ras.error = Raster_Err_Invalid;
|
||||
|
||||
|
||||
Fail:
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* Function: Convert_Glyph */
|
||||
@ -1650,7 +1650,7 @@
|
||||
/** **/
|
||||
/****************************************************************/
|
||||
/****************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************/
|
||||
/* */
|
||||
@ -1820,14 +1820,14 @@
|
||||
static void Vertical_Sweep_Init( RAS_ARGS Short* min, Short* max )
|
||||
{
|
||||
Long pitch = ras.target.pitch;
|
||||
|
||||
|
||||
UNUSED(max);
|
||||
|
||||
|
||||
ras.traceIncr = (Short)- pitch;
|
||||
ras.traceOfs = - *min * pitch;
|
||||
if (pitch > 0)
|
||||
ras.traceOfs += (ras.target.rows-1)*pitch;
|
||||
|
||||
|
||||
ras.gray_min_x = 0;
|
||||
ras.gray_max_x = 0;
|
||||
}
|
||||
@ -2039,7 +2039,7 @@
|
||||
|
||||
UNUSED(left);
|
||||
UNUSED(right);
|
||||
|
||||
|
||||
if ( x2-x1 < ras.precision )
|
||||
{
|
||||
e1 = CEILING( x1 );
|
||||
@ -2059,7 +2059,7 @@
|
||||
p = bits - e1*ras.target.pitch;
|
||||
if (ras.target.pitch > 0)
|
||||
p += (ras.target.rows-1)*ras.target.pitch;
|
||||
|
||||
|
||||
p[0] |= f1;
|
||||
}
|
||||
}
|
||||
@ -2191,7 +2191,7 @@
|
||||
static void Vertical_Gray_Sweep_Init( RAS_ARGS Short* min, Short* max )
|
||||
{
|
||||
Long pitch, byte_len;
|
||||
|
||||
|
||||
*min = *min & -2;
|
||||
*max = ( *max + 3 ) & -2;
|
||||
|
||||
@ -2232,7 +2232,7 @@
|
||||
Int last_cell = last_pixel >> 2;
|
||||
Int last_bit = last_pixel & 3;
|
||||
Bool over = 0;
|
||||
|
||||
|
||||
if (ras.gray_max_x >= last_cell && last_bit != 3)
|
||||
{
|
||||
ras.gray_max_x = last_cell-1;
|
||||
@ -2267,7 +2267,7 @@
|
||||
pix += 4;
|
||||
c1 --;
|
||||
}
|
||||
|
||||
|
||||
if (over)
|
||||
{
|
||||
c2 = count[*bit] + count[*bit2];
|
||||
@ -2800,7 +2800,7 @@ Scan_DropOuts :
|
||||
|
||||
ras.bWidth = ras.gray_width;
|
||||
pixel_width = 2*((ras.target.width + 3) >> 2);
|
||||
|
||||
|
||||
if ( ras.bWidth > pixel_width )
|
||||
ras.bWidth = pixel_width;
|
||||
|
||||
@ -2850,7 +2850,7 @@ Scan_DropOuts :
|
||||
{
|
||||
FT_UInt n;
|
||||
FT_ULong c;
|
||||
|
||||
|
||||
/* setup count table */
|
||||
for ( n = 0; n < 256; n++ )
|
||||
{
|
||||
@ -2860,14 +2860,14 @@ Scan_DropOuts :
|
||||
((c << 4) & 0x0300) |
|
||||
((c << 2) & 0x0030) |
|
||||
(c & 0x0003);
|
||||
|
||||
|
||||
raster->count_table[n] = c;
|
||||
}
|
||||
|
||||
|
||||
/* set default 5-levels gray palette */
|
||||
for ( n = 0; n < 5; n++ )
|
||||
raster->grays[n] = (n*127/4);
|
||||
|
||||
|
||||
raster->gray_width = RASTER_GRAY_LINES/2;
|
||||
}
|
||||
|
||||
@ -2879,7 +2879,7 @@ Scan_DropOuts :
|
||||
int ft_black_new( void* memory, FT_Raster *araster )
|
||||
{
|
||||
static FT_RasterRec_ the_raster;
|
||||
*araster = &the_raster;
|
||||
*araster = &the_raster;
|
||||
memset( &the_raster, sizeof(the_raster), 0 );
|
||||
ft_black_init( &the_raster );
|
||||
return 0;
|
||||
@ -2901,7 +2901,7 @@ Scan_DropOuts :
|
||||
{
|
||||
FT_Error error;
|
||||
TRaster_Instance* raster;
|
||||
|
||||
|
||||
*araster = 0;
|
||||
if ( !ALLOC( raster, sizeof(*raster) ))
|
||||
{
|
||||
@ -2910,17 +2910,17 @@ Scan_DropOuts :
|
||||
|
||||
*araster = raster;
|
||||
}
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void ft_black_done( TRaster_Instance* raster )
|
||||
{
|
||||
FT_Memory memory = (FT_Memory)raster->memory;
|
||||
FREE( raster );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -2949,8 +2949,8 @@ Scan_DropOuts :
|
||||
raster->grays[3] = palette[3];
|
||||
raster->grays[4] = palette[4];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int ft_black_render( TRaster_Instance* raster,
|
||||
@ -2958,7 +2958,7 @@ Scan_DropOuts :
|
||||
{
|
||||
FT_Outline* outline = (FT_Outline*)params->source;
|
||||
FT_Bitmap* target_map = params->target;
|
||||
|
||||
|
||||
if ( !raster || !raster->buff || !raster->sizeBuff )
|
||||
return Raster_Err_Not_Ini;
|
||||
|
||||
@ -2981,8 +2981,8 @@ Scan_DropOuts :
|
||||
|
||||
ras.outline = *outline;
|
||||
ras.target = *target_map;
|
||||
|
||||
return ( params->flags & ft_raster_flag_aa
|
||||
|
||||
return ( params->flags & ft_raster_flag_aa
|
||||
? Render_Gray_Glyph( raster )
|
||||
: Render_Glyph( raster ) );
|
||||
}
|
||||
|
@ -428,29 +428,29 @@
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Bool frame_accessed = 0;
|
||||
|
||||
|
||||
if (!fields || !stream)
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
|
||||
error = FT_Err_Ok;
|
||||
do
|
||||
{
|
||||
FT_ULong value;
|
||||
FT_Int sign_shift;
|
||||
FT_Byte* p;
|
||||
|
||||
|
||||
switch (fields->value)
|
||||
{
|
||||
case ft_frame_start: /* access a new frame */
|
||||
{
|
||||
error = FT_Access_Frame( stream, fields->offset );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
frame_accessed = 1;
|
||||
fields++;
|
||||
continue; /* loop ! */
|
||||
}
|
||||
|
||||
|
||||
case ft_frame_byte:
|
||||
case ft_frame_schar: /* read a single byte */
|
||||
{
|
||||
@ -458,7 +458,7 @@
|
||||
sign_shift = 24;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case ft_frame_short_be:
|
||||
case ft_frame_ushort_be: /* read a 2-byte big-endian short */
|
||||
{
|
||||
@ -538,13 +538,13 @@
|
||||
/* otherwise, exit the loop */
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/* now, compute the signed value is necessary */
|
||||
if (fields->value & FT_FRAME_OP_SIGNED)
|
||||
value = (FT_ULong)((FT_Long)(value << sign_shift) >> sign_shift);
|
||||
|
||||
|
||||
/* finally, store the value in the object */
|
||||
|
||||
|
||||
p = (FT_Byte*)structure + fields->offset;
|
||||
switch (fields->size)
|
||||
{
|
||||
@ -553,7 +553,7 @@
|
||||
case 4: *(FT_ULong*)p = (FT_ULong) value; break;
|
||||
default: ; /* ignore !! */
|
||||
}
|
||||
|
||||
|
||||
/* go to next field */
|
||||
fields++;
|
||||
}
|
||||
@ -563,7 +563,7 @@
|
||||
/* close the frame if it was opened by this read */
|
||||
if (frame_accessed)
|
||||
FT_Forget_Frame(stream);
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -6,20 +6,20 @@
|
||||
*
|
||||
* This file contains the definition of interface used by FreeType
|
||||
* to access low-level, i.e. memory management, i/o access as well
|
||||
* as thread synchronisation.
|
||||
* as thread synchronisation.
|
||||
*
|
||||
*
|
||||
* Copyright 1996-1999 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Copyright 1996-1999 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include <freetype/config/ftconfig.h>
|
||||
#include <freetype/ftsystem.h>
|
||||
#include <freetype/fterrors.h>
|
||||
@ -48,7 +48,7 @@
|
||||
* <Output>
|
||||
* block :: address of newly allocated block
|
||||
*
|
||||
* <Return>
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
* <Note>
|
||||
@ -90,7 +90,7 @@
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
* <Note>
|
||||
* This function is _never_ called when the system flag
|
||||
* This function is _never_ called when the system flag
|
||||
* FT_SYSTEM_FLAG_NO_REALLOC is set. Instead, the engine will emulate
|
||||
* realloc through "alloc" and "free".
|
||||
*
|
||||
@ -165,10 +165,10 @@
|
||||
unsigned long count )
|
||||
{
|
||||
FILE* file;
|
||||
|
||||
|
||||
file = STREAM_FILE(stream);
|
||||
|
||||
fseek( file, offset, SEEK_SET );
|
||||
fseek( file, offset, SEEK_SET );
|
||||
return (unsigned long)fread( buffer, 1, count, file );
|
||||
}
|
||||
|
||||
@ -177,18 +177,18 @@
|
||||
FT_Stream stream )
|
||||
{
|
||||
FILE* file;
|
||||
|
||||
|
||||
file = fopen( filepathname, "rb" );
|
||||
if (!file)
|
||||
return FT_Err_Cannot_Open_Resource;
|
||||
|
||||
|
||||
fseek( file, 0, SEEK_END );
|
||||
stream->size = ftell(file);
|
||||
fseek( file, 0, SEEK_SET );
|
||||
|
||||
|
||||
stream->descriptor.pointer = file;
|
||||
stream->pos = 0;
|
||||
|
||||
|
||||
stream->read = ft_io_stream;
|
||||
stream->close = ft_close_stream;
|
||||
|
||||
@ -199,7 +199,7 @@
|
||||
EXPORT_FUNC(FT_Memory) FT_New_Memory( void )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
memory = (FT_Memory)malloc( sizeof(*memory) );
|
||||
if (memory)
|
||||
{
|
||||
|
@ -19,13 +19,13 @@
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Note:
|
||||
*
|
||||
* This is the only file that should be included by client
|
||||
* This is the only file that should be included by client
|
||||
* application sources. All other types and functions defined
|
||||
* in the "tt*.h" files are library internals and should not be
|
||||
* included.
|
||||
@ -115,7 +115,7 @@
|
||||
|
||||
|
||||
struct TT_UnitVector_ /* guess what... */
|
||||
{
|
||||
{
|
||||
TT_F2Dot14 x;
|
||||
TT_F2Dot14 y;
|
||||
};
|
||||
@ -215,7 +215,7 @@
|
||||
|
||||
typedef struct TT_Outline_ TT_Outline;
|
||||
|
||||
|
||||
|
||||
/* A structure used to return glyph metrics. */
|
||||
/* */
|
||||
/* The "bearingX" isn't called "left-side bearing" anymore because */
|
||||
@ -427,7 +427,7 @@
|
||||
|
||||
TT_Short metric_Data_Format;
|
||||
TT_UShort number_Of_HMetrics;
|
||||
|
||||
|
||||
/* The following fields are not defined by the TrueType specification */
|
||||
/* but they're used to connect the metrics header to the relevant */
|
||||
/* "HMTX" or "VMTX" table. */
|
||||
@ -463,7 +463,7 @@
|
||||
|
||||
TT_Short metric_Data_Format;
|
||||
TT_UShort number_Of_VMetrics;
|
||||
|
||||
|
||||
/* The following fields are not defined by the TrueType specification */
|
||||
/* but they're used to connect the metrics header to the relevant */
|
||||
/* "HMTX" or "VMTX" table. */
|
||||
@ -979,7 +979,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
/* */
|
||||
/* <Struct> TT_SBit_Component */
|
||||
@ -1225,7 +1225,7 @@
|
||||
EXPORT_DEF
|
||||
TT_Error TT_Set_Raster_Gray_Palette( TT_Engine engine,
|
||||
const TT_Byte* palette );
|
||||
|
||||
|
||||
|
||||
/* ----------------------- face management ----------------------- */
|
||||
|
||||
@ -1450,7 +1450,7 @@
|
||||
/* Return glyph outline pointers in 'outline'. Note that the returned */
|
||||
/* pointers are owned by the glyph object, and will be destroyed with */
|
||||
/* it. The client application should _not_ change the pointers. */
|
||||
|
||||
|
||||
EXPORT_DEF
|
||||
TT_Error TT_Get_Glyph_Outline( TT_Glyph glyph,
|
||||
TT_Outline* outline );
|
||||
@ -1580,7 +1580,7 @@
|
||||
EXPORT_DEF
|
||||
void TT_Matrix_Multiply( TT_Matrix* a,
|
||||
TT_Matrix* b );
|
||||
|
||||
|
||||
|
||||
/* Invert a transformation matrix. */
|
||||
|
||||
@ -1593,7 +1593,7 @@
|
||||
EXPORT_DEF
|
||||
TT_Long TT_MulDiv( TT_Long A, TT_Long B, TT_Long C );
|
||||
|
||||
|
||||
|
||||
/* Compute A*B/0x10000 with 64 bits intermediate precision. */
|
||||
/* Useful to multiply by a 16.16 fixed float value. */
|
||||
|
||||
@ -1697,7 +1697,7 @@
|
||||
TT_UShort* length ); /* string length
|
||||
address */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*******************************************************************
|
||||
*
|
||||
* ttapi.c
|
||||
* ttapi.c
|
||||
*
|
||||
* High-level interface implementation
|
||||
*
|
||||
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
@ -17,7 +17,7 @@
|
||||
*
|
||||
* This file is used to implement most of the functions that are
|
||||
* defined in the file "freetype.h". However, two functions are
|
||||
* implemented elsewhere :
|
||||
* implemented elsewhere :
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
static
|
||||
const FT_DriverInterface* tt_interface = &tt_driver_interface;
|
||||
|
||||
|
||||
static
|
||||
const TT_DriverInterface* tt_extension = &tt_format_interface;
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
|
||||
error = FT_New_System( &system );
|
||||
if (error) return error;
|
||||
|
||||
|
||||
error = FT_New_Library( system, &library );
|
||||
if (!error)
|
||||
/* Now create a new TrueType driver object */
|
||||
@ -163,12 +163,12 @@
|
||||
EXPORT_FUNC
|
||||
TT_Error TT_Set_Raster_Gray_Palette( TT_Engine engine,
|
||||
const TT_Byte* palette )
|
||||
{
|
||||
{
|
||||
FT_Library library;
|
||||
|
||||
|
||||
if (!engine)
|
||||
return TT_Err_Invalid_Engine;
|
||||
|
||||
|
||||
library = (FT_Library)engine;
|
||||
return FT_Set_Raster_Palette( library, 5, (unsigned char*)palette );
|
||||
}
|
||||
@ -216,13 +216,13 @@
|
||||
{
|
||||
TT_Error error;
|
||||
FT_Resource resource;
|
||||
|
||||
|
||||
*aface = 0;
|
||||
|
||||
|
||||
error = FT_New_Resource( library, pathname, &resource );
|
||||
if (error) return error;
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
error = FT_Add_Resource( library, resource );
|
||||
if (error) goto Fail_Install;
|
||||
#endif
|
||||
@ -231,10 +231,10 @@
|
||||
/* Destroy glyph slot to comply with the 1.x API */
|
||||
if (!error)
|
||||
FT_Done_GlyphSlot( (*aface)->root.slot );
|
||||
|
||||
|
||||
if (error)
|
||||
FT_Done_Resource(resource);
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@
|
||||
|
||||
return open_face( (FT_Library)engine, pathname, 0, aface );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
@ -318,7 +318,7 @@
|
||||
TT_Error TT_Close_Face( TT_Face face )
|
||||
{
|
||||
FT_Resource resource;
|
||||
|
||||
|
||||
if (!face)
|
||||
return TT_Err_Invalid_Face_Handle;
|
||||
|
||||
@ -377,7 +377,7 @@
|
||||
props->num_Names = face->num_names;
|
||||
props->header = &face->header;
|
||||
props->horizontal = &face->horizontal;
|
||||
|
||||
|
||||
/* The driver supports old Mac fonts where there are no OS/2 */
|
||||
/* tables present in the file. However, this is not true of */
|
||||
/* FreeType 1.1. For the sake of backwards compatibility, we */
|
||||
@ -390,7 +390,7 @@
|
||||
/* */
|
||||
|
||||
props->os2 = &face->os2;
|
||||
|
||||
|
||||
props->postscript = &face->postscript;
|
||||
props->hdmx = &face->hdmx;
|
||||
props->vertical = ( face->vertical_info ? &face->vertical : 0 );
|
||||
@ -508,7 +508,7 @@
|
||||
/* This function will much probably move to another */
|
||||
/* component in the short future, but I haven't decided */
|
||||
/* which yet... */
|
||||
|
||||
|
||||
static
|
||||
void get_metrics( TT_HoriHeader* header,
|
||||
TT_Int index,
|
||||
@ -516,10 +516,10 @@
|
||||
TT_UShort* advance )
|
||||
{
|
||||
TT_LongMetrics* longs_m;
|
||||
|
||||
|
||||
TT_UShort k = header->number_Of_HMetrics;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( index < k )
|
||||
{
|
||||
longs_m = (TT_LongMetrics*)header->long_metrics + index;
|
||||
@ -532,7 +532,7 @@
|
||||
*advance = ((TT_LongMetrics*)header->long_metrics)[k - 1].advance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
EXPORT_FUNC
|
||||
@ -769,7 +769,7 @@
|
||||
{
|
||||
/* The point size is now ignored by the driver */
|
||||
(void)pointSize;
|
||||
|
||||
|
||||
return FT_Set_Pixel_Sizes( (FT_Size)ins, pixelWidth, pixelHeight );
|
||||
}
|
||||
|
||||
@ -814,7 +814,7 @@
|
||||
metrics->x_ppem = size->root.metrics.x_ppem;
|
||||
metrics->y_ppem = size->root.metrics.y_ppem;
|
||||
|
||||
metrics->pointSize = size->root.metrics.pointSize;
|
||||
metrics->pointSize = size->root.metrics.pointSize;
|
||||
return TT_Err_Ok;
|
||||
}
|
||||
|
||||
@ -936,7 +936,7 @@
|
||||
(void)instance; /* the parameters are unused, the (void) prevents */
|
||||
(void)rotated; /* warnings from pedantic compilers.. */
|
||||
(void)stretched;
|
||||
|
||||
|
||||
return TT_Err_Ok;
|
||||
}
|
||||
|
||||
@ -1130,7 +1130,7 @@
|
||||
metrics->bearingX = slot->metrics.horiBearingX;
|
||||
metrics->bearingY = slot->metrics.horiBearingY;
|
||||
metrics->advance = slot->metrics.horiAdvance;
|
||||
|
||||
|
||||
return TT_Err_Ok;
|
||||
}
|
||||
|
||||
@ -1182,7 +1182,7 @@
|
||||
|
||||
metrics->linearVertAdvance = met2->vertAdvance;
|
||||
metrics->linearVertBearingY = met2->vertBearingY;
|
||||
|
||||
|
||||
return TT_Err_Ok;
|
||||
}
|
||||
|
||||
@ -1441,7 +1441,7 @@
|
||||
|
||||
#include <stdlib.h> /* for malloc and free */
|
||||
|
||||
static TT_Outline null_api_outline = { 0, 0, NULL, NULL, NULL,
|
||||
static TT_Outline null_api_outline = { 0, 0, NULL, NULL, NULL,
|
||||
0, 0, 0, 0 };
|
||||
|
||||
EXPORT_FUNC
|
||||
@ -1459,7 +1459,7 @@
|
||||
outline->points = (TT_Vector*)malloc( numPoints * sizeof(TT_Vector) );
|
||||
outline->flags = (TT_Byte*) malloc( numPoints * sizeof(TT_Char) );
|
||||
outline->contours = (TT_UShort*)malloc( numPoints * sizeof(TT_UShort) );
|
||||
|
||||
|
||||
if ( !outline->points || !outline->flags || !outline->contours )
|
||||
goto Fail;
|
||||
|
||||
@ -1573,7 +1573,7 @@
|
||||
TT_Matrix* matrix )
|
||||
{
|
||||
FT_Transform_Outline( (FT_Outline*)outline, (FT_Matrix*)matrix );
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
@ -1679,7 +1679,7 @@
|
||||
return FT_MulDiv( A, B, C );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -1910,12 +1910,12 @@
|
||||
|
||||
if (!face)
|
||||
return TT_Err_Invalid_Face_Handle;
|
||||
|
||||
|
||||
if ( nameIndex >= face->num_names )
|
||||
return TT_Err_Bad_Argument;
|
||||
|
||||
name = face->name_table.names + nameIndex;
|
||||
|
||||
|
||||
*platformID = name->platformID;
|
||||
*encodingID = name->encodingID;
|
||||
*languageID = name->languageID;
|
||||
@ -1953,18 +1953,18 @@
|
||||
TT_UShort* length )
|
||||
{
|
||||
TT_NameRec* name;
|
||||
|
||||
|
||||
if (!face)
|
||||
return TT_Err_Invalid_Face_Handle;
|
||||
|
||||
|
||||
if ( nameIndex >= face->num_names )
|
||||
return TT_Err_Bad_Argument;
|
||||
|
||||
name = face->name_table.names + nameIndex;
|
||||
|
||||
*stringPtr = (TT_String*)name->string;
|
||||
*length = name->stringLength;
|
||||
|
||||
*length = name->stringLength;
|
||||
|
||||
return TT_Err_Ok;
|
||||
}
|
||||
|
||||
|
@ -21,23 +21,23 @@
|
||||
TT_UInt count, max_langs;
|
||||
TT_Error error;
|
||||
|
||||
/* skip version of the JSTF table */
|
||||
/* skip version of the JSTF table */
|
||||
if (otl_type == otl_jstf)
|
||||
start += 4;
|
||||
|
||||
|
||||
p = start;
|
||||
|
||||
|
||||
/* we must allocate the script_tags and language_tags arrays */
|
||||
/* this requires that we compute the maximum number of languages */
|
||||
/* per script.. */
|
||||
|
||||
|
||||
count = table->num_scripts = OTL_UShort(p);
|
||||
max_langs = 0;
|
||||
for ( ; count > 0; count++ )
|
||||
{
|
||||
TT_Byte* script;
|
||||
TT_UInt num_langs;
|
||||
|
||||
|
||||
p += 4; /* skip tag */
|
||||
script = bytes + OTL_UShort(p);
|
||||
|
||||
@ -48,10 +48,10 @@
|
||||
/* test if there is a default language system */
|
||||
if ( OTL_UShort(script) )
|
||||
num_langs++;
|
||||
|
||||
|
||||
/* test other language systems */
|
||||
num_langs += OTL_UShort(script); /* add other lang sys */
|
||||
|
||||
|
||||
if (num_langs > max_langs)
|
||||
max_langs = num_langs;
|
||||
}
|
||||
@ -65,15 +65,15 @@
|
||||
table->max_languages = max_langs;
|
||||
table->num_languages = 0;
|
||||
table->otl_type = otl_type;
|
||||
|
||||
|
||||
table->scripts_table = bytes;
|
||||
table->scripts_len = len;
|
||||
|
||||
|
||||
/* fill the script_tags array */
|
||||
{
|
||||
TT_UInt n;
|
||||
TT_Byte* p = start + 2; /* skip count */
|
||||
|
||||
|
||||
for ( n = 0; n < table->num_scripts; n++ )
|
||||
{
|
||||
table->script_tags[n] = OTL_ULong(p);
|
||||
@ -96,7 +96,7 @@
|
||||
TT_Error error;
|
||||
TT_Byte* p = bytes;
|
||||
TT_UInt count;
|
||||
|
||||
|
||||
table->max_features = count = OTL_UShort(p);
|
||||
if ( !ALLOC_ARRAY( table->feature_tags, count, TT_ULong ) &&
|
||||
!ALLOC_ARRAY( table->features, count, TT_Bool ) )
|
||||
@ -104,7 +104,7 @@
|
||||
table->features_table = bytes;
|
||||
table->features_len = len;
|
||||
}
|
||||
return error;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@ -118,14 +118,14 @@
|
||||
TT_Error error;
|
||||
TT_Byte* p = bytes;
|
||||
TT_UInt count;
|
||||
|
||||
|
||||
table->max_lookups = count = OTL_UShort(p);
|
||||
if ( !ALLOC_ARRAY( table->lookups, count, TT_Bool ) )
|
||||
{
|
||||
table->lookups_table = bytes;
|
||||
table->lookups_len = len;
|
||||
}
|
||||
return error;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* discard table arrays */
|
||||
@ -149,12 +149,12 @@
|
||||
TT_Byte* p;
|
||||
TT_Byte* script = 0;
|
||||
TT_Byte* start = table->scripts_table;
|
||||
|
||||
|
||||
if ( table->otl_type == otl_type_jstf ) /* skip version for JSTF */
|
||||
start += 4;
|
||||
|
||||
|
||||
p = start + 6; /* skip count+first tag */
|
||||
|
||||
|
||||
for ( n = 0; n < table->num_scripts; n++, p += 6 )
|
||||
{
|
||||
if ( table->script_tags[n] == script_tag )
|
||||
@ -163,7 +163,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
table->cur_script = script;
|
||||
if (!script)
|
||||
table->num_languages = 0;
|
||||
@ -173,31 +173,31 @@
|
||||
/* not that we put a '0' tag in front of the list to indicate that */
|
||||
/* there is a default language for this script.. */
|
||||
TT_ULong* tags = table->language_tags;
|
||||
|
||||
|
||||
switch (table->otl_type)
|
||||
{
|
||||
case otl_type_base:
|
||||
case otl_type_jstf:
|
||||
script += 2; /* skip basevalue or extenders */
|
||||
/* fall-through */
|
||||
|
||||
|
||||
default:
|
||||
if ( OTL_UShort(script) )
|
||||
*tags++ = 0;
|
||||
}
|
||||
|
||||
|
||||
count = OTL_UShort(script);
|
||||
for ( ; count > 0; count-- )
|
||||
{
|
||||
*tags++ = OTL_ULong(script);
|
||||
script += 2; /* skip offset */
|
||||
}
|
||||
|
||||
|
||||
table->num_langs = tags - table->language_tags;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* return the list of available features for the current script/language */
|
||||
/* use with a GPOS or GSUB script table */
|
||||
LOCAL_FUNC
|
||||
@ -218,14 +218,14 @@
|
||||
{
|
||||
offset = OTL_UShort(script);
|
||||
if (!offset) return; /* if there is no default language, exit */
|
||||
|
||||
|
||||
language = script - 2 + offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
TT_Byte* p = script + 8; /* skip default+count+1st tag */
|
||||
TT_UShort index;
|
||||
|
||||
|
||||
for ( n = 0; n < table->num_languages; n++, p+=6 )
|
||||
{
|
||||
if ( table->language_tags[n] == language_tag )
|
||||
@ -235,9 +235,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
table->cur_language = language;
|
||||
table->cur_language = language;
|
||||
if (!language) return;
|
||||
|
||||
|
||||
p = language + 2; /* skip lookup order */
|
||||
index = OTL_UShort(p); /* required feature index */
|
||||
if (index != 0xFFFF)
|
||||
@ -245,7 +245,7 @@
|
||||
if (index < table->max_features)
|
||||
table->features[index] = 1;
|
||||
}
|
||||
|
||||
|
||||
count = OTL_UShort(p);
|
||||
for ( ; count > 0; count-- )
|
||||
{
|
||||
@ -265,11 +265,11 @@
|
||||
TT_UInt n;
|
||||
TT_Byte* features = table->features_table;
|
||||
TT_Byte* p = features + 6; /* skip count+1st tag */
|
||||
|
||||
|
||||
/* clear lookup list */
|
||||
for ( n = 0; n < table->max_lookups; n++ )
|
||||
table->lookups[n] = 0;
|
||||
|
||||
|
||||
/* now, parse the features list */
|
||||
for ( n = 0; n < table->features; n++ )
|
||||
{
|
||||
@ -278,10 +278,10 @@
|
||||
TT_UInt count;
|
||||
TT_UShort index;
|
||||
TT_Byte* feature;
|
||||
|
||||
|
||||
feature = features + OTL_UShort(p);
|
||||
p += 4; /* skip tag */
|
||||
|
||||
|
||||
/* now, select all lookups from this feature */
|
||||
count = OTL_UShort(feature);
|
||||
for ( ; count > 0; count-- )
|
||||
@ -293,9 +293,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* find the basevalues and minmax for the current script/language */
|
||||
|
||||
/* find the basevalues and minmax for the current script/language */
|
||||
/* only use it with a BASE table.. */
|
||||
LOCAL_FUNC
|
||||
void OTL_Get_Baseline_Values( OTL_Table* table,
|
||||
@ -307,12 +307,12 @@
|
||||
|
||||
table->cur_basevalues = 0;
|
||||
table->cur_minmax = 0;
|
||||
|
||||
/* read basevalues */
|
||||
|
||||
/* read basevalues */
|
||||
offset = OTL_UShort(p);
|
||||
if (offset)
|
||||
table->cur_basevalues = script + offset;
|
||||
|
||||
|
||||
offset = OTL_UShort(p);
|
||||
if (offset)
|
||||
table->cur_minmax = script + offset;
|
||||
@ -321,7 +321,7 @@
|
||||
for ( ; count > 0; count-- )
|
||||
{
|
||||
TT_ULong tag;
|
||||
|
||||
|
||||
tag = OTL_ULong(p);
|
||||
if ( language_tag == tag )
|
||||
{
|
||||
@ -341,7 +341,7 @@
|
||||
TT_Long result = -1;
|
||||
TT_UInt count, index, start, end;
|
||||
TT_Byte* p = coverage;
|
||||
|
||||
|
||||
switch ( OTL_UShort(p) )
|
||||
{
|
||||
case 1: /* coverage format 1 - array of glyph indices */
|
||||
@ -357,7 +357,7 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
{
|
||||
count = OTL_UShort(p);
|
||||
@ -387,14 +387,14 @@
|
||||
TT_Byte* p = class_def;
|
||||
TT_UInt result = 0;
|
||||
TT_UInt start, end, count, index;
|
||||
|
||||
|
||||
switch ( OTL_UShort(p) )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
start = OTL_UShort(p);
|
||||
count = OTL_UShort(p);
|
||||
|
||||
|
||||
glyph_id -= start;
|
||||
if (glyph_id < count)
|
||||
{
|
||||
@ -403,7 +403,7 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
{
|
||||
count = OTL_UShort(p);
|
||||
@ -434,7 +434,7 @@
|
||||
TT_Int result = 0;
|
||||
TT_UInt start, end;
|
||||
TT_Short value;
|
||||
|
||||
|
||||
start = OTL_UShort(p);
|
||||
end = OTL_UShort(p);
|
||||
if (size >= start && size <= end)
|
||||
@ -442,7 +442,7 @@
|
||||
/* I know we could do all of this without a switch, with */
|
||||
/* clever shifts and everything, but it makes the code */
|
||||
/* really difficult to understand.. */
|
||||
|
||||
|
||||
size -= start;
|
||||
switch ( OTL_UShort(p) )
|
||||
{
|
||||
@ -454,7 +454,7 @@
|
||||
result = value >> 14;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2: /* 4-bits per value */
|
||||
{
|
||||
p += 2*(size >> 2);
|
||||
@ -463,7 +463,7 @@
|
||||
result = value >> 12;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3: /* 8-bits per value */
|
||||
{
|
||||
p += 2*(size >> 1);
|
||||
@ -476,7 +476,7 @@
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* extract a BaseCoord value */
|
||||
LOCAL_FUNC
|
||||
void OTL_Get_Base_Coordinate( TT_Byte* base_coord,
|
||||
@ -484,7 +484,7 @@
|
||||
{
|
||||
TT_Byte* p = base_coord;
|
||||
TT_Int result = 0;
|
||||
|
||||
|
||||
coord->format = OTL_UShort(p);
|
||||
coord->coordinate = OTL_Short(p);
|
||||
coord->device = 0;
|
||||
@ -495,13 +495,13 @@
|
||||
coord->ref_glyph = OTL_UShort(p);
|
||||
coord->ref_point = OTL_UShort(p);
|
||||
break;
|
||||
|
||||
|
||||
case 3: /* format 3 */
|
||||
coord->device = p - 4 + OTL_UShort(p);
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,13 +514,13 @@
|
||||
|
||||
/* each bit in the value format corresponds to a single ushort */
|
||||
/* we thus count the bits, and multiply the result by 2 */
|
||||
|
||||
|
||||
count = (TT_Int)(format & 0xFF);
|
||||
count = ((count & 0xAA) >> 1) + (count & 0x55);
|
||||
count = ((count & 0xCC) >> 2) + (count & 0x33);
|
||||
count = ((count & 0xF0) >> 4) + (count & 0x0F);
|
||||
|
||||
return count*2;
|
||||
return count*2;
|
||||
}
|
||||
|
||||
|
||||
@ -533,28 +533,28 @@
|
||||
OTL_ValueRecord* record )
|
||||
{
|
||||
TT_Byte* p = value_record;
|
||||
|
||||
|
||||
/* clear vectors */
|
||||
record->placement.x = 0;
|
||||
record->placement.y = 0;
|
||||
record->advance.x = 0;
|
||||
record->advance.y = 0;
|
||||
|
||||
|
||||
record->device_pla_x = 0;
|
||||
record->device_pla_y = 0;
|
||||
record->device_adv_x = 0;
|
||||
record->device_adv_y = 0;
|
||||
|
||||
|
||||
if (value_format & 1) record->placement.x = NEXT_Short(p);
|
||||
if (value_format & 2) record->placement.y = NEXT_Short(p);
|
||||
if (value_format & 4) record->advance.x = NEXT_Short(p);
|
||||
if (value_format & 8) record->advance.y = NEXT_Short(p);
|
||||
|
||||
|
||||
if (value_format & 16) record->device_pla_x = pos_table + NEXT_UShort(p);
|
||||
if (value_format & 32) record->device_pla_y = pos_table + NEXT_UShort(p);
|
||||
if (value_format & 64) record->device_adv_x = pos_table + NEXT_UShort(p);
|
||||
if (value_format & 128) record->device_adv_y = pos_table + NEXT_UShort(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -564,32 +564,32 @@
|
||||
OTL_Anchor* anchor )
|
||||
{
|
||||
TT_Byte* p = anchor_table;
|
||||
|
||||
|
||||
anchor->format = NEXT_UShort(p);
|
||||
anchor->coord.x = NEXT_Short(p);
|
||||
anchor->coord.y = NEXT_Short(p);
|
||||
anchor->point = 0;
|
||||
anchor->device_x = 0;
|
||||
anchor->device_y = 0;
|
||||
|
||||
|
||||
switch (anchor->format)
|
||||
{
|
||||
case 2:
|
||||
anchor->point = NEXT_UShort(p);
|
||||
break;
|
||||
|
||||
|
||||
case 3:
|
||||
anchor->device_x = anchor_table + NEXT_UShort(p);
|
||||
anchor->device_y = anchor_table + NEXT_UShort(p);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* extract Mark from MarkArray */
|
||||
LOCAL_FUNC
|
||||
void OTL_Get_Mark( TT_Byte* mark_array,
|
||||
@ -599,10 +599,10 @@
|
||||
{
|
||||
TT_Byte* p = mark_array;
|
||||
TT_UInt count;
|
||||
|
||||
|
||||
*clazz = 0;
|
||||
MEM_Set( anchor, 0, sizeof(*anchor) );
|
||||
|
||||
|
||||
count = NEXT_UShort(p);
|
||||
if (index < count)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
* max_features :: total number of features in table
|
||||
* feature_tags :: tags of all features for current script/language
|
||||
* features :: selection flags for all features in current script/lang
|
||||
*
|
||||
*
|
||||
* max_lookups :: total number of lookups in table
|
||||
* lookups :: selection flags for all lookups for current
|
||||
* feature list.
|
||||
@ -40,17 +40,17 @@
|
||||
otl_type_gpos,
|
||||
otl_type_gsub,
|
||||
otl_type_jstf
|
||||
|
||||
|
||||
} OTL_Type;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct OTL_Table_
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
TT_Int num_scripts;
|
||||
TT_Tag* script_tags;
|
||||
|
||||
|
||||
TT_Int max_languages;
|
||||
TT_Int num_languages;
|
||||
TT_Tag* language_tags;
|
||||
@ -61,19 +61,19 @@
|
||||
|
||||
TT_Int max_lookups;
|
||||
TT_Bool* lookups;
|
||||
|
||||
|
||||
TT_Byte* scripts_table;
|
||||
TT_Long scripts_len;
|
||||
|
||||
|
||||
TT_Byte* features_table;
|
||||
TT_Long* features_len;
|
||||
|
||||
|
||||
TT_Byte* lookups_table;
|
||||
TT_Byte* lookups_len;
|
||||
|
||||
TT_Byte* cur_script; /* current script */
|
||||
TT_Byte* cur_language; /* current language */
|
||||
|
||||
|
||||
TT_Byte* cur_base_values;
|
||||
TT_Byte* cur_min_max;
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
TT_UShort ref_glyph;
|
||||
TT_UShort ref_point;
|
||||
TT_Byte* device;
|
||||
|
||||
|
||||
} OTL_BaseCoord;
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
TT_Byte* device_pla_y;
|
||||
TT_Byte* device_adv_x;
|
||||
TT_Byte* device_adv_y;
|
||||
|
||||
|
||||
} OTL_ValueRecord;
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@
|
||||
TT_UInt anchor_point;
|
||||
TT_Byte* device_x;
|
||||
TT_Byte* device_y;
|
||||
|
||||
|
||||
} OTL_Anchor;
|
||||
|
||||
LOCAL_DEF
|
||||
@ -153,7 +153,7 @@
|
||||
* table->num_scripts is the number of scripts
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/********************************************************
|
||||
*
|
||||
* - after calling OTL_Table_Set_Features:
|
||||
@ -169,7 +169,7 @@
|
||||
* it is empty (zero-filled) by default.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* - after calling OTL_Get_Languages_List(script_tag):
|
||||
@ -217,7 +217,7 @@
|
||||
LOCAL_DEF
|
||||
void OTL_Get_Justification( OTL_Table* table,
|
||||
TT_ULong language_tag );
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* - after calling OTL_Get_Lookups_List():
|
||||
|
@ -20,7 +20,7 @@
|
||||
FT_Int n;
|
||||
char first = glyph_name[0];
|
||||
char temp[64];
|
||||
|
||||
|
||||
/* if the name begins with "uni", then the glyph name may be a */
|
||||
/* hard-coded unicode character code.. */
|
||||
if ( glyph_name[0] == 'u' &&
|
||||
@ -36,7 +36,7 @@
|
||||
{
|
||||
char c = *p;
|
||||
unsigned char d;
|
||||
|
||||
|
||||
d = (unsigned char)c-'0';
|
||||
if (d >= 10)
|
||||
{
|
||||
@ -49,7 +49,7 @@
|
||||
/* exit if one non-uppercase-hexadecimal character was found */
|
||||
if (d >= 16)
|
||||
break;
|
||||
|
||||
|
||||
value = (value << 4) + d;
|
||||
if (count == 0)
|
||||
return value;
|
||||
@ -61,11 +61,11 @@
|
||||
{
|
||||
const char* p;
|
||||
int len;
|
||||
|
||||
|
||||
p = glyph_name;
|
||||
while ( *p && *p != '.' ) p++;
|
||||
len = p-glyph_name;
|
||||
|
||||
|
||||
if ( *p && len < 64 )
|
||||
{
|
||||
strncpy( temp, glyph_name, len );
|
||||
@ -73,12 +73,12 @@
|
||||
glyph_name = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now, lookup the glyph in the Adobe Glyph List */
|
||||
for ( n = 0; n < NUM_ADOBE_GLYPHS; n++ )
|
||||
{
|
||||
const char* name = t1_standard_glyphs[n];
|
||||
|
||||
|
||||
if ( first == name[0] && strcmp( glyph_name, name ) == 0 )
|
||||
return names_to_unicode[n];
|
||||
}
|
||||
@ -86,14 +86,14 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* qsort callback to sort the unicode map */
|
||||
static
|
||||
int compare_uni_maps( const void* a, const void* b )
|
||||
{
|
||||
PS_UniMap* map1 = (PS_UniMap*)a;
|
||||
PS_UniMap* map2 = (PS_UniMap*)b;
|
||||
|
||||
|
||||
return ( map1->unicode < map2->unicode ? -1 :
|
||||
map1->unicode > map2->unicode ? 1 : 0 );
|
||||
}
|
||||
@ -107,18 +107,18 @@
|
||||
PS_Unicodes *table )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
/* we first allocate the table */
|
||||
table->num_maps = 0;
|
||||
table->maps = 0;
|
||||
|
||||
|
||||
if ( !ALLOC_ARRAY( table->maps, num_glyphs, PS_UniMap ) )
|
||||
{
|
||||
FT_UInt n;
|
||||
FT_UInt count;
|
||||
PS_UniMap* map;
|
||||
FT_ULong uni_char;
|
||||
|
||||
|
||||
map = table->maps;
|
||||
for ( n = 0; n < num_glyphs; n++ )
|
||||
{
|
||||
@ -143,7 +143,7 @@
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
FREE( table->maps );
|
||||
@ -167,23 +167,23 @@
|
||||
/* perform a binary search on the table */
|
||||
min = table->maps;
|
||||
max = min + table->num_maps - 1;
|
||||
|
||||
|
||||
while (min <= max)
|
||||
{
|
||||
mid = min + (max-min)/2;
|
||||
if ( mid->unicode == unicode )
|
||||
return mid->glyph_index;
|
||||
|
||||
|
||||
if (min == max)
|
||||
break;
|
||||
|
||||
|
||||
if ( mid->unicode < unicode ) min = mid+1;
|
||||
else max = mid-1;
|
||||
}
|
||||
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
static
|
||||
@ -191,17 +191,17 @@
|
||||
{
|
||||
if (name_index >= 258)
|
||||
name_index = 0;
|
||||
|
||||
|
||||
return standard_glyph_names[ mac_standard_names[name_index] ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
const char* PS_Standard_Strings( FT_UInt sid )
|
||||
{
|
||||
return (sid < NUM_STD_GLYPHS ? t1_standard_glyphs[sid] : 0);
|
||||
}
|
||||
|
||||
|
||||
static const PSNames_Interface psnames_interface =
|
||||
{
|
||||
#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
||||
@ -216,11 +216,11 @@
|
||||
|
||||
(PS_Macintosh_Name_Func) PS_Macintosh_Name,
|
||||
(PS_Adobe_Std_Strings_Func) PS_Standard_Strings,
|
||||
|
||||
|
||||
t1_standard_encoding,
|
||||
t1_expert_encoding
|
||||
};
|
||||
|
||||
|
||||
|
||||
const FT_DriverInterface psnames_driver_interface =
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ ifndef PSNAMES_INCLUDE
|
||||
# compilation flags for the driver
|
||||
#
|
||||
PSNAMES_CFLAGS := $(PSNAMES_INCLUDE:%=$I%)
|
||||
PSNAMES_COMPILE := $(FT_COMPILE) $(PSNAMES_CFLAGS)
|
||||
PSNAMES_COMPILE := $(FT_COMPILE) $(PSNAMES_CFLAGS)
|
||||
|
||||
|
||||
# driver sources (i.e., C files)
|
||||
|
@ -29,7 +29,7 @@ ifndef SFNT_INCLUDE
|
||||
# compilation flags for the driver
|
||||
#
|
||||
SFNT_CFLAGS := $(SFNT_INCLUDE:%=$I%)
|
||||
SFNT_COMPILE := $(FT_COMPILE) $(SFNT_CFLAGS)
|
||||
SFNT_COMPILE := $(FT_COMPILE) $(SFNT_CFLAGS)
|
||||
|
||||
|
||||
# driver sources (i.e., C files)
|
||||
|
@ -8,7 +8,7 @@
|
||||
static const SFNT_Interface sfnt_interface =
|
||||
{
|
||||
TT_Goto_Table,
|
||||
|
||||
|
||||
TT_Load_Any,
|
||||
TT_Load_Format_Tag,
|
||||
TT_Load_Directory,
|
||||
@ -38,22 +38,22 @@
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* see `ttpost.h' */
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
TT_Get_PS_Name,
|
||||
TT_Free_Post_Names,
|
||||
TT_Free_Post_Names,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* see `ttcmap.h' */
|
||||
TT_CharMap_Load,
|
||||
TT_CharMap_Free,
|
||||
};
|
||||
|
||||
|
||||
|
||||
const FT_DriverInterface sfnt_driver_interface =
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
||||
static TT_UInt code_to_index0( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index2( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index4( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index6( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index6( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -152,7 +152,7 @@
|
||||
cmap2->glyphIdArray[i] = GET_UShort();
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
|
||||
cmap->get_index = code_to_index2;
|
||||
break;
|
||||
|
||||
@ -212,7 +212,7 @@
|
||||
cmap4->glyphIdArray[i] = GET_UShort();
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
|
||||
cmap->get_index = code_to_index4;
|
||||
break;
|
||||
|
||||
@ -338,7 +338,7 @@
|
||||
TT_ULong charCode )
|
||||
{
|
||||
TT_CMap0* cmap0 = &cmap->c.cmap0;
|
||||
|
||||
|
||||
return ( charCode <= 0xFF ? cmap0->glyphIdArray[charCode] : 0 );
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
{
|
||||
TT_Table* entry;
|
||||
TT_Table* limit;
|
||||
|
||||
|
||||
FT_TRACE4(( "TT_LookUp_Table( %08lx, %c%c%c%c )\n",
|
||||
(TT_Long)face,
|
||||
(TT_Char)(tag >> 24),
|
||||
@ -70,7 +70,7 @@
|
||||
{
|
||||
if ( entry->Tag == tag )
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
FT_TRACE4(( " Could not find table!\n" ));
|
||||
return 0;
|
||||
}
|
||||
@ -99,18 +99,18 @@
|
||||
{
|
||||
TT_Table* table;
|
||||
TT_Error error;
|
||||
|
||||
|
||||
table = TT_LookUp_Table( face, tag );
|
||||
if (table)
|
||||
{
|
||||
if (length)
|
||||
*length = table->Length;
|
||||
|
||||
|
||||
(void)FILE_Seek( table->Offset );
|
||||
}
|
||||
else
|
||||
error = TT_Err_Table_Missing;
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
{
|
||||
TT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
|
||||
|
||||
#ifdef READ_FIELDS
|
||||
const FT_Frame_Field ttc_header_fields[] = {
|
||||
FT_FRAME_START(8), /* frame of 8 bytes */
|
||||
@ -173,9 +173,9 @@
|
||||
if ( *format_tag == TTAG_ttcf )
|
||||
{
|
||||
TT_Int n;
|
||||
|
||||
|
||||
FT_TRACE4(( "TT_Load_Format_Tag: file is a collection\n" ));
|
||||
|
||||
|
||||
/* it's a TrueType collection, i.e. a file containing several */
|
||||
/* font files. Read the font directory now */
|
||||
/* */
|
||||
@ -183,7 +183,7 @@
|
||||
if ( READ_Fields( ttc_header_fields, &face->ttc_header ) )
|
||||
goto Exit;
|
||||
#else
|
||||
if ( ACCESS_Frame( 8 ) ) goto Exit;
|
||||
if ( ACCESS_Frame( 8 ) ) goto Exit;
|
||||
|
||||
face->ttc_header.version = GET_Long();
|
||||
face->ttc_header.DirCount = GET_Long();
|
||||
@ -209,12 +209,12 @@
|
||||
{
|
||||
error = TT_Err_Bad_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* if we're checking the font format, exit immediately */
|
||||
if (faceIndex < 0)
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* seek to the appropriate TrueType file, then read tag */
|
||||
if ( FILE_Seek( face->ttc_header.TableDirectory[faceIndex] ) ||
|
||||
READ_Long( *format_tag ) )
|
||||
@ -544,7 +544,7 @@
|
||||
FT_FRAME_USHORT( TT_MaxProfile, numGlyphs ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxPoints ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxContours ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxCompositePoints ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxCompositePoints ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxCompositeContours ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxZones ),
|
||||
FT_FRAME_USHORT( TT_MaxProfile, maxTwilightPoints ),
|
||||
@ -998,17 +998,17 @@
|
||||
FILE_Read_At( table_pos + names->storageOffset,
|
||||
(void*)names->storage, storageSize ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* Go through and assign the string pointers to the name records. */
|
||||
{
|
||||
TT_NameRec* cur = names->names;
|
||||
TT_NameRec* limit = cur + names->numNameRecords;
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
cur->string = names->storage + cur->stringOffset;
|
||||
}
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
/* Print Name Record Table in case of debugging */
|
||||
{
|
||||
TT_NameRec* cur = names->names;
|
||||
@ -1017,20 +1017,20 @@
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
TT_UInt j;
|
||||
|
||||
|
||||
FT_TRACE2(( "%d %d %x %d ",
|
||||
cur->platformID,
|
||||
cur->encodingID,
|
||||
cur->languageID,
|
||||
cur->nameID ));
|
||||
|
||||
|
||||
/* I know that M$ encoded strings are Unicode, */
|
||||
/* but this works reasonable well for debugging purposes. */
|
||||
if ( cur->string )
|
||||
for ( j = 0; j < cur->stringLength; j++ )
|
||||
{
|
||||
TT_Char c = *(cur->string + j);
|
||||
|
||||
|
||||
if ( (TT_Byte)c < 128 )
|
||||
FT_TRACE2(( "%c", c ));
|
||||
}
|
||||
@ -1165,12 +1165,12 @@
|
||||
cmap->offset = (TT_ULong)GET_Long();
|
||||
}
|
||||
FORGET_Frame();
|
||||
|
||||
|
||||
/* now read the rest of each table */
|
||||
for ( charmap = face->charmaps; charmap < limit; charmap++ )
|
||||
{
|
||||
TT_CMapTable* cmap = &charmap->cmap;
|
||||
|
||||
|
||||
#ifdef READ_FIELDS
|
||||
if ( FILE_Seek( table_start + (TT_Long)cmap->offset ) ||
|
||||
READ_Fields( cmap_rec_fields, cmap ) )
|
||||
@ -1179,11 +1179,11 @@
|
||||
if ( FILE_Seek( table_start + (TT_Long)cmap->offset ) ||
|
||||
ACCESS_Frame(6L) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
cmap->format = GET_UShort();
|
||||
cmap->length = GET_UShort();
|
||||
cmap->version = GET_UShort();
|
||||
|
||||
|
||||
FORGET_Frame();
|
||||
#endif
|
||||
cmap->offset = FILE_Pos();
|
||||
@ -1264,7 +1264,7 @@
|
||||
FT_FRAME_USHORT( TT_OS2, usWinAscent ),
|
||||
FT_FRAME_USHORT( TT_OS2, usWinDescent ),
|
||||
FT_FRAME_END };
|
||||
|
||||
|
||||
const FT_Frame_Field os2_fields_extra[] = {
|
||||
FT_FRAME_START(8),
|
||||
FT_FRAME_ULONG( TT_OS2, ulCodePageRange1 ),
|
||||
@ -1579,7 +1579,7 @@
|
||||
coverage = GET_UShort();
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
|
||||
if ( coverage == 0x0001 )
|
||||
{
|
||||
TT_UInt num_pairs;
|
||||
@ -1615,7 +1615,7 @@
|
||||
face->kern_table_index = n;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if ( FILE_Skip( length ) )
|
||||
goto Exit;
|
||||
}
|
||||
@ -1646,7 +1646,7 @@
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
TT_Error TT_Load_Hdmx( TT_Face face,
|
||||
TT_Error TT_Load_Hdmx( TT_Face face,
|
||||
FT_Stream stream )
|
||||
{
|
||||
TT_Error error;
|
||||
@ -1692,11 +1692,11 @@
|
||||
if ( READ_Byte( cur->ppem ) ||
|
||||
READ_Byte( cur->max_width ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
if ( ALLOC( cur->widths, num_glyphs ) ||
|
||||
FILE_Read( cur->widths, num_glyphs ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* skip padding bytes */
|
||||
if ( record_size > 0 && FILE_Skip(record_size) )
|
||||
goto Exit;
|
||||
|
@ -75,7 +75,7 @@
|
||||
/* first of all, compute starting write position */
|
||||
line_incr = target->pitch;
|
||||
line_buff = target->buffer;
|
||||
|
||||
|
||||
if (line_incr < 0)
|
||||
line_buff -= line_incr*(target->rows-1);
|
||||
|
||||
@ -354,7 +354,7 @@
|
||||
range->glyph_codes[n] = GET_UShort();
|
||||
|
||||
if (load_offsets)
|
||||
range->glyph_offsets[n] = (TT_ULong)range->image_offset +
|
||||
range->glyph_offsets[n] = (TT_ULong)range->image_offset +
|
||||
GET_UShort();
|
||||
}
|
||||
|
||||
@ -1226,19 +1226,19 @@
|
||||
switch ( strike->bit_depth )
|
||||
{
|
||||
case 1:
|
||||
map->pixel_mode = ft_pixel_mode_mono;
|
||||
map->pixel_mode = ft_pixel_mode_mono;
|
||||
map->pitch = (map->width+7) >> 3;
|
||||
break;
|
||||
case 2:
|
||||
map->pixel_mode = ft_pixel_mode_pal2;
|
||||
map->pixel_mode = ft_pixel_mode_pal2;
|
||||
map->pitch = (map->width+3) >> 2;
|
||||
break;
|
||||
case 4:
|
||||
map->pixel_mode = ft_pixel_mode_pal4;
|
||||
map->pixel_mode = ft_pixel_mode_pal4;
|
||||
map->pitch = (map->width+1) >> 1;
|
||||
break;
|
||||
case 8:
|
||||
map->pixel_mode = ft_pixel_mode_grays;
|
||||
map->pixel_mode = ft_pixel_mode_grays;
|
||||
map->pitch = map->width;
|
||||
break;
|
||||
|
||||
@ -1399,13 +1399,13 @@
|
||||
/* the font file */
|
||||
error = face->goto_table( face, TTAG_EBDT, stream, 0 );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
ebdt_pos = FILE_Pos();
|
||||
|
||||
/* clear the bitmap & load the bitmap */
|
||||
if (face->root.glyph->flags & ft_glyph_own_bitmap)
|
||||
FREE( map->buffer );
|
||||
|
||||
|
||||
map->rows = map->pitch = map->width = 0;
|
||||
|
||||
error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,
|
||||
@ -1415,7 +1415,7 @@
|
||||
|
||||
/* the glyph slot owns this bitmap buffer */
|
||||
face->root.glyph->flags |= ft_glyph_own_bitmap;
|
||||
|
||||
|
||||
/* setup vertical metrics if needed */
|
||||
if ( strike->flags & 1 )
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ TT_INCLUDE := $(SFNT_INCLUDE) $(TT_DIR) $(TT_EXT_DIR)
|
||||
# compilation flags for the driver
|
||||
#
|
||||
TT_CFLAGS := $(TT_INCLUDE:%=$I%)
|
||||
TT_COMPILE := $(FT_COMPILE) $(TT_CFLAGS)
|
||||
TT_COMPILE := $(FT_COMPILE) $(TT_CFLAGS)
|
||||
|
||||
|
||||
# driver sources (i.e., C files)
|
||||
|
@ -49,7 +49,7 @@
|
||||
* find_encoding
|
||||
*
|
||||
* <Description>
|
||||
* return the FT_Encoding corresponding to a given
|
||||
* return the FT_Encoding corresponding to a given
|
||||
* (platform_id,encoding_id) pair, as found in TrueType charmaps
|
||||
*
|
||||
* <Input>
|
||||
@ -60,7 +60,7 @@
|
||||
* the corresponding FT_Encoding tag. ft_encoding_none by default
|
||||
*
|
||||
*****************************************************************/
|
||||
|
||||
|
||||
static
|
||||
FT_Encoding find_encoding( int platform_id,
|
||||
int encoding_id )
|
||||
@ -70,28 +70,28 @@
|
||||
int platform_id;
|
||||
int encoding_id;
|
||||
FT_Encoding encoding;
|
||||
|
||||
|
||||
} TEncoding;
|
||||
|
||||
static
|
||||
const TEncoding tt_encodings[] =
|
||||
{
|
||||
{ TT_PLATFORM_ISO, -1, ft_encoding_unicode },
|
||||
|
||||
|
||||
{ TT_PLATFORM_APPLE_UNICODE, -1, ft_encoding_unicode },
|
||||
|
||||
|
||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, ft_encoding_apple_roman },
|
||||
|
||||
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, ft_encoding_unicode },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, ft_encoding_sjis },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, ft_encoding_big5 }
|
||||
};
|
||||
|
||||
|
||||
const TEncoding *cur, *limit;
|
||||
|
||||
|
||||
cur = tt_encodings;
|
||||
limit = cur + sizeof(tt_encodings)/sizeof(tt_encodings[0]);
|
||||
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
if (cur->platform_id == platform_id)
|
||||
@ -235,7 +235,7 @@
|
||||
/* now, set root->charmap with a unicode charmap wherever available */
|
||||
if (!root->charmap && charmap->root.encoding == ft_encoding_unicode)
|
||||
root->charmap = (FT_CharMap)charmap;
|
||||
|
||||
|
||||
root->charmaps[n] = (FT_CharMap)charmap;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@
|
||||
metrics->x_ppem = (TT_UShort)(dim_x >> 6);
|
||||
metrics->y_ppem = (TT_UShort)(dim_y >> 6);
|
||||
}
|
||||
|
||||
|
||||
size->ttmetrics.valid = FALSE;
|
||||
|
||||
return TT_Reset_Size( size );
|
||||
@ -593,7 +593,7 @@
|
||||
TT_Error error;
|
||||
TT_Face face;
|
||||
TT_CMapTable* cmap;
|
||||
|
||||
|
||||
cmap = &charmap->cmap;
|
||||
face = (TT_Face)charmap->root.face;
|
||||
|
||||
@ -601,7 +601,7 @@
|
||||
if ( !cmap->loaded )
|
||||
{
|
||||
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
|
||||
|
||||
|
||||
error = sfnt->load_charmap( face, cmap, face->root.stream );
|
||||
if (error)
|
||||
return error;
|
||||
@ -620,7 +620,7 @@
|
||||
void* tt_get_sfnt_table( TT_Face face, FT_Sfnt_Tag tag )
|
||||
{
|
||||
void* table;
|
||||
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case ft_sfnt_head: table = &face->header; break;
|
||||
@ -629,7 +629,7 @@
|
||||
case ft_sfnt_os2: table = (face->os2.version == 0xFFFF ? 0 : &face->os2 ); break;
|
||||
case ft_sfnt_post: table = &face->postscript; break;
|
||||
case ft_sfnt_maxp: table = &face->max_profile; break;
|
||||
|
||||
|
||||
default:
|
||||
table = 0;
|
||||
}
|
||||
@ -641,10 +641,10 @@
|
||||
FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface )
|
||||
{
|
||||
UNUSED(driver);
|
||||
|
||||
|
||||
if (strcmp(interface,"get_sfnt")==0)
|
||||
return (FTDriver_Interface)tt_get_sfnt_table;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -198,10 +198,10 @@
|
||||
|
||||
TT_UShort n_ins;
|
||||
TT_Int n, n_points;
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* simple check */
|
||||
|
||||
|
||||
if ( n_contours > load->left_contours )
|
||||
{
|
||||
FT_TRACE0(( "ERROR: Glyph index %ld has %d contours > left %d\n",
|
||||
@ -216,7 +216,7 @@
|
||||
|
||||
/*********************************************************************/
|
||||
/* reading the contours endpoints */
|
||||
|
||||
|
||||
if ( ACCESS_Frame( byte_count ) )
|
||||
return error;
|
||||
|
||||
@ -230,7 +230,7 @@
|
||||
|
||||
/*********************************************************************/
|
||||
/* reading the bytecode instructions */
|
||||
|
||||
|
||||
n_ins = GET_UShort();
|
||||
load->face->root.glyph->control_len = n_ins;
|
||||
|
||||
@ -269,15 +269,15 @@
|
||||
#endif
|
||||
|
||||
stream->cursor += n_ins;
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
/* reading the point tags */
|
||||
|
||||
{
|
||||
{
|
||||
TT_Byte* flag = load->zone.tags;
|
||||
TT_Byte* limit = flag + n_points;
|
||||
TT_Byte c, count;
|
||||
|
||||
|
||||
for (; flag < limit; flag++)
|
||||
{
|
||||
*flag = c = GET_Byte();
|
||||
@ -291,17 +291,17 @@
|
||||
|
||||
/*********************************************************************/
|
||||
/* reading the X coordinates */
|
||||
|
||||
|
||||
{
|
||||
TT_Vector* vec = zone->org;
|
||||
TT_Vector* limit = vec + n_points;
|
||||
TT_Byte* flag = zone->tags;
|
||||
TT_Pos x = 0;
|
||||
|
||||
|
||||
for ( ; vec < limit; vec++, flag++ )
|
||||
{
|
||||
TT_Pos y = 0;
|
||||
|
||||
|
||||
if ( *flag & 2 )
|
||||
{
|
||||
y = GET_Byte();
|
||||
@ -309,7 +309,7 @@
|
||||
}
|
||||
else if ((*flag & 16) == 0)
|
||||
y = GET_Short();
|
||||
|
||||
|
||||
x += y;
|
||||
vec->x = x;
|
||||
}
|
||||
@ -323,11 +323,11 @@
|
||||
TT_Vector* limit = vec + n_points;
|
||||
TT_Byte* flag = zone->tags;
|
||||
TT_Pos x = 0;
|
||||
|
||||
|
||||
for ( ; vec < limit; vec++, flag++ )
|
||||
{
|
||||
TT_Pos y = 0;
|
||||
|
||||
|
||||
if ( *flag & 4 )
|
||||
{
|
||||
y = GET_Byte();
|
||||
@ -335,7 +335,7 @@
|
||||
}
|
||||
else if ((*flag & 32) == 0)
|
||||
y = GET_Short();
|
||||
|
||||
|
||||
x += y;
|
||||
vec->y = x;
|
||||
}
|
||||
@ -345,24 +345,24 @@
|
||||
|
||||
/*********************************************************************/
|
||||
/* Add shadow points */
|
||||
|
||||
|
||||
/* Now add the two shadow points at n and n + 1. */
|
||||
/* We need the left side bearing and advance width. */
|
||||
|
||||
{
|
||||
TT_Vector* pp1;
|
||||
TT_Vector* pp2;
|
||||
|
||||
|
||||
/* pp1 = xMin - lsb */
|
||||
pp1 = zone->org + n_points;
|
||||
pp1->x = load->bbox.xMin - load->left_bearing;
|
||||
pp1->y = 0;
|
||||
|
||||
|
||||
/* pp2 = pp1 + aw */
|
||||
pp2 = pp1 + 1;
|
||||
pp2->x = pp1->x + load->advance;
|
||||
pp2->y = 0;
|
||||
|
||||
|
||||
/* clear the touch tags */
|
||||
for ( n = 0; n < n_points; n++ )
|
||||
zone->tags[n] &= FT_Curve_Tag_On;
|
||||
@ -439,7 +439,7 @@
|
||||
}
|
||||
|
||||
return TT_Err_Ok;
|
||||
|
||||
|
||||
Fail:
|
||||
FORGET_Frame();
|
||||
return error;
|
||||
@ -472,7 +472,7 @@
|
||||
TT_UInt index, num_points, num_contours, count;
|
||||
TT_Fixed x_scale, y_scale;
|
||||
TT_ULong ins_offset;
|
||||
|
||||
|
||||
/* check glyph index */
|
||||
index = glyph_index;
|
||||
if ( index >= (TT_UInt)face->root.num_glyphs )
|
||||
@ -485,7 +485,7 @@
|
||||
num_contours = 0;
|
||||
num_points = 0;
|
||||
ins_offset = 0;
|
||||
|
||||
|
||||
x_scale = 0x10000;
|
||||
y_scale = 0x10000;
|
||||
if ( (loader->load_flags & FT_LOAD_NO_SCALE)==0 )
|
||||
@ -514,7 +514,7 @@
|
||||
count = 0;
|
||||
if (index < (TT_UInt)face->num_locations-1)
|
||||
count = face->glyph_locations[index+1] - offset;
|
||||
|
||||
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
@ -574,7 +574,7 @@
|
||||
loader->pp1.y = 0;
|
||||
loader->pp2.x = loader->pp1.x + loader->advance;
|
||||
loader->pp2.y = 0;
|
||||
|
||||
|
||||
if ((loader->load_flags & FT_LOAD_NO_SCALE)==0)
|
||||
{
|
||||
loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
|
||||
@ -590,7 +590,7 @@
|
||||
if (contours_count >= 0)
|
||||
{
|
||||
TT_UInt num_base_points;
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
error = Load_Simple( loader,
|
||||
count,
|
||||
@ -599,7 +599,7 @@
|
||||
loader->size->debug ) );
|
||||
#else
|
||||
error = Load_Simple( loader, count, contours_count, 0 );
|
||||
#endif
|
||||
#endif
|
||||
if ( error )
|
||||
goto Fail;
|
||||
|
||||
@ -607,7 +607,7 @@
|
||||
/* but the code is fat enough already :-) */
|
||||
num_points = loader->zone.n_points;
|
||||
num_contours = loader->zone.n_contours;
|
||||
|
||||
|
||||
num_base_points = loader->base.n_points;
|
||||
{
|
||||
TT_UInt k;
|
||||
@ -633,16 +633,16 @@
|
||||
{
|
||||
/* for each subglyph, read composite header */
|
||||
FT_SubGlyph* subglyph = subglyphs;
|
||||
|
||||
|
||||
if (ACCESS_Frame(count)) goto Fail;
|
||||
|
||||
|
||||
num_subglyphs = 0;
|
||||
do
|
||||
{
|
||||
TT_Fixed xx, xy, yy, yx;
|
||||
|
||||
|
||||
subglyph->arg1 = subglyph->arg2 = 0;
|
||||
|
||||
|
||||
subglyph->flags = GET_UShort();
|
||||
subglyph->index = GET_UShort();
|
||||
|
||||
@ -657,11 +657,11 @@
|
||||
subglyph->arg1 = GET_Char();
|
||||
subglyph->arg2 = GET_Char();
|
||||
}
|
||||
|
||||
|
||||
/* read transform */
|
||||
xx = yy = 0x10000;
|
||||
xy = yx = 0;
|
||||
|
||||
|
||||
if (subglyph->flags & WE_HAVE_A_SCALE)
|
||||
{
|
||||
xx = (TT_Fixed)GET_Short() << 2;
|
||||
@ -679,12 +679,12 @@
|
||||
yx = (TT_Fixed)GET_Short() << 2;
|
||||
yy = (TT_Fixed)GET_Short() << 2;
|
||||
}
|
||||
|
||||
|
||||
subglyph->transform.xx = xx;
|
||||
subglyph->transform.xy = xy;
|
||||
subglyph->transform.yx = yx;
|
||||
subglyph->transform.yy = yy;
|
||||
|
||||
|
||||
subglyph++;
|
||||
num_subglyphs++;
|
||||
if (num_subglyphs >= TT_MAX_SUBGLYPHS)
|
||||
@ -709,22 +709,22 @@
|
||||
{
|
||||
FT_GlyphSlot glyph = loader->glyph;
|
||||
|
||||
/* reallocate subglyph array if necessary */
|
||||
/* reallocate subglyph array if necessary */
|
||||
if (glyph->max_subglyphs < num_subglyphs)
|
||||
{
|
||||
FT_Memory memory = loader->face->root.memory;
|
||||
|
||||
|
||||
if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
|
||||
num_subglyphs, FT_SubGlyph ) )
|
||||
goto Fail;
|
||||
|
||||
|
||||
glyph->max_subglyphs = num_subglyphs;
|
||||
}
|
||||
|
||||
/* copy subglyph array */
|
||||
MEM_Copy( glyph->subglyphs, subglyphs,
|
||||
num_subglyphs*sizeof(FT_SubGlyph));
|
||||
|
||||
|
||||
/* set up remaining glyph fields */
|
||||
glyph->num_subglyphs = num_subglyphs;
|
||||
glyph->format = ft_glyph_format_composite;
|
||||
@ -740,18 +740,18 @@
|
||||
/* Now, read each subglyph independently.. */
|
||||
{
|
||||
TT_Int n, num_base_points, num_new_points;
|
||||
|
||||
|
||||
subglyph = subglyphs;
|
||||
for ( n = 0; n < num_subglyphs; n++, subglyph++ )
|
||||
{
|
||||
TT_Vector pp1, pp2;
|
||||
TT_Pos x, y;
|
||||
|
||||
|
||||
pp1 = loader->pp1;
|
||||
pp2 = loader->pp2;
|
||||
|
||||
num_base_points = loader->base.n_points;
|
||||
|
||||
|
||||
error = load_truetype_glyph( loader, subglyph->index );
|
||||
if ( subglyph->flags & USE_MY_METRICS )
|
||||
{
|
||||
@ -763,15 +763,15 @@
|
||||
loader->pp1 = pp1;
|
||||
loader->pp2 = pp2;
|
||||
}
|
||||
|
||||
|
||||
num_points = loader->base.n_points;
|
||||
num_contours = loader->base.n_contours;
|
||||
|
||||
|
||||
num_new_points = num_points - num_base_points;
|
||||
|
||||
|
||||
/********************************************************/
|
||||
/* now perform the transform required for this subglyph */
|
||||
|
||||
|
||||
if ( subglyph->flags & ( WE_HAVE_A_SCALE |
|
||||
WE_HAVE_AN_XY_SCALE |
|
||||
WE_HAVE_A_2X2 ) )
|
||||
@ -783,7 +783,7 @@
|
||||
for ( ; cur < limit; cur++, org++ )
|
||||
{
|
||||
TT_Pos nx, ny;
|
||||
|
||||
|
||||
nx = FT_MulFix( cur->x, subglyph->transform.xx ) +
|
||||
FT_MulFix( cur->y, subglyph->transform.yx );
|
||||
|
||||
@ -818,8 +818,8 @@
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
l += num_base_points;
|
||||
|
||||
l += num_base_points;
|
||||
|
||||
x = loader->base.cur[k].x - loader->base.cur[l].x;
|
||||
y = loader->base.cur[k].y - loader->base.cur[l].y;
|
||||
}
|
||||
@ -832,7 +832,7 @@
|
||||
{
|
||||
x = FT_MulFix( x, x_scale );
|
||||
y = FT_MulFix( y, y_scale );
|
||||
|
||||
|
||||
if ( subglyph->flags & ROUND_XY_TO_GRID )
|
||||
{
|
||||
x = (x + 32) & -64;
|
||||
@ -844,7 +844,7 @@
|
||||
translate_array( num_new_points, loader->zone.cur, x, y );
|
||||
cur_to_org( num_new_points, &loader->zone );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
@ -861,12 +861,12 @@
|
||||
TT_UInt n_points = loader->base.n_points;
|
||||
FT_GlyphZone* pts;
|
||||
TT_Vector* pp1;
|
||||
|
||||
|
||||
/* read size of instructions */
|
||||
if ( FILE_Seek( ins_offset ) ||
|
||||
READ_UShort(n_ins) ) goto Fail;
|
||||
FT_TRACE4(( "Instructions size = %d\n", n_ins ));
|
||||
|
||||
|
||||
/* check it */
|
||||
if ( n_ins > face->max_profile.maxSizeOfInstructions )
|
||||
{
|
||||
@ -874,68 +874,68 @@
|
||||
subglyph->index ));
|
||||
return TT_Err_Too_Many_Ins;
|
||||
}
|
||||
|
||||
|
||||
if (exec)
|
||||
{
|
||||
}
|
||||
/* read the instructions */
|
||||
if ( FILE_Read( exec->glyphIns, n_ins ) )
|
||||
goto Fail;
|
||||
|
||||
|
||||
error = TT_Set_CodeRange( exec,
|
||||
tt_coderange_glyph,
|
||||
exec->glyphIns,
|
||||
n_ins );
|
||||
if ( error ) goto Fail;
|
||||
|
||||
|
||||
/* prepare the execution context */
|
||||
exec->pts = loader->base;
|
||||
pts = &exec->pts;
|
||||
|
||||
|
||||
pts->n_points = num_points + 2;
|
||||
pts->n_contours = num_contours;
|
||||
|
||||
|
||||
/* add phantom points */
|
||||
pp1 = pts->cur + num_points;
|
||||
pp1[0] = loader->pp1;
|
||||
pp1[1] = loader->pp2;
|
||||
|
||||
|
||||
pts->tags[num_points + 1] = 0;
|
||||
pts->tags[num_points + 2] = 0;
|
||||
|
||||
|
||||
/* if hinting, round the phantom points */
|
||||
if ( IS_HINTED(loader->load_flags) )
|
||||
{
|
||||
pp1[0].x = ((loader->pp1.x + 32) & -64);
|
||||
pp1[1].x = ((loader->pp2.x + 32) & -64);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
TT_UInt k;
|
||||
for ( k = 0; k < n_points; k++ )
|
||||
pts->tags[k] &= FT_Curve_Tag_On;
|
||||
}
|
||||
|
||||
|
||||
cur_to_org( n_points, pts );
|
||||
|
||||
|
||||
/* now consider hinting */
|
||||
if ( IS_HINTED(loader->load_flags) && n_ins > 0 )
|
||||
{
|
||||
exec->is_composite = TRUE;
|
||||
exec->pedantic_hinting =
|
||||
(TT_Bool)(loader->load_flags & FT_LOAD_PEDANTIC);
|
||||
|
||||
|
||||
error = TT_Run_Context( exec, loader->size->debug );
|
||||
if ( error && exec->pedantic_hinting )
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
|
||||
/* save glyph origin and advance points */
|
||||
loader->pp1 = pp1[0];
|
||||
loader->pp2 = pp1[1];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -948,7 +948,7 @@
|
||||
error = TT_Err_Ok;
|
||||
|
||||
Fail:
|
||||
return error;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@ -966,7 +966,7 @@
|
||||
TT_Fixed x_scale, y_scale;
|
||||
TT_GlyphSlot glyph = loader->glyph;
|
||||
TT_Size size = loader->size;
|
||||
|
||||
|
||||
/* when a simple glyph was loaded, the value of */
|
||||
/* "base.n_points" and "base.n_contours" is 0, we must */
|
||||
/* take those in the "zone" instead.. */
|
||||
@ -975,7 +975,7 @@
|
||||
num_points = loader->zone.n_points;
|
||||
num_contours = loader->zone.n_contours;
|
||||
}
|
||||
|
||||
|
||||
x_scale = 0x10000;
|
||||
y_scale = 0x10000;
|
||||
if ( (loader->load_flags & FT_LOAD_NO_SCALE) == 0)
|
||||
@ -983,7 +983,7 @@
|
||||
x_scale = size->root.metrics.x_scale;
|
||||
y_scale = size->root.metrics.y_scale;
|
||||
}
|
||||
|
||||
|
||||
if ( glyph->format != ft_glyph_format_composite )
|
||||
{
|
||||
TT_UInt u;
|
||||
@ -1000,13 +1000,13 @@
|
||||
glyph->outline.flags &= ~ft_outline_single_pass;
|
||||
glyph->outline.n_points = num_points;
|
||||
glyph->outline.n_contours = num_contours;
|
||||
|
||||
|
||||
/* translate array so that (0,0) is the glyph's origin */
|
||||
translate_array( (TT_UShort)(num_points + 2),
|
||||
glyph->outline.points,
|
||||
-loader->pp1.x,
|
||||
0 );
|
||||
|
||||
|
||||
FT_Outline_Get_CBox( &glyph->outline, &bbox );
|
||||
|
||||
if ( IS_HINTED(loader->load_flags) )
|
||||
@ -1199,7 +1199,7 @@
|
||||
TT_Error error;
|
||||
TT_Loader loader;
|
||||
FT_GlyphZone* zone;
|
||||
|
||||
|
||||
face = (TT_Face)glyph->face;
|
||||
sfnt = (SFNT_Interface*)face->sfnt;
|
||||
stream = face->root.stream;
|
||||
@ -1223,7 +1223,7 @@
|
||||
if ( size && (load_flags & FT_LOAD_NO_BITMAP) == 0 && sfnt->load_sbits )
|
||||
{
|
||||
TT_SBit_Metrics metrics;
|
||||
|
||||
|
||||
error = sfnt->load_sbit_image( face,
|
||||
size->root.metrics.x_ppem,
|
||||
size->root.metrics.y_ppem,
|
||||
@ -1279,7 +1279,7 @@
|
||||
goto Exit;
|
||||
}
|
||||
loader.base = *zone;
|
||||
|
||||
|
||||
loader.zone.n_points = 0;
|
||||
loader.zone.n_contours = 0;
|
||||
|
||||
@ -1290,7 +1290,7 @@
|
||||
loader.exec = size->debug ? size->context : TT_New_Context(face);
|
||||
if ( !loader.exec )
|
||||
return TT_Err_Could_Not_Find_Context;
|
||||
|
||||
|
||||
TT_Load_Context( loader.exec, face, size );
|
||||
|
||||
/* load default graphics state - if needed */
|
||||
@ -1301,7 +1301,7 @@
|
||||
|
||||
/* clear all outline flags, except the "owner" one */
|
||||
glyph->outline.flags &= ft_outline_owner;
|
||||
|
||||
|
||||
if (size && size->root.metrics.y_ppem < 24 )
|
||||
glyph->outline.flags |= ft_outline_high_precision;
|
||||
|
||||
@ -1315,7 +1315,7 @@
|
||||
loader.size = size;
|
||||
loader.glyph = glyph;
|
||||
loader.stream = stream;
|
||||
|
||||
|
||||
loader.glyf_offset = FILE_Pos();
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
|
@ -49,13 +49,13 @@
|
||||
TT_Bool preserve_pps;
|
||||
TT_Vector pp1;
|
||||
TT_Vector pp2;
|
||||
|
||||
|
||||
TT_ULong glyf_offset;
|
||||
|
||||
|
||||
/* the zone where we load our glyphs */
|
||||
FT_GlyphZone base;
|
||||
FT_GlyphZone zone;
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
TT_ExecContext exec;
|
||||
TT_Byte* instructions;
|
||||
|
@ -1561,7 +1561,7 @@
|
||||
{
|
||||
TT_F26Dot6 val;
|
||||
|
||||
|
||||
|
||||
UNUSED_EXEC;
|
||||
|
||||
if ( distance >= 0 )
|
||||
@ -2040,7 +2040,7 @@
|
||||
TT_Vector* v2 )
|
||||
{
|
||||
UNUSED_EXEC;
|
||||
|
||||
|
||||
return (v1->y - v2->y);
|
||||
}
|
||||
|
||||
@ -2153,7 +2153,7 @@
|
||||
TT_Bool S1, S2;
|
||||
|
||||
UNUSED_EXEC;
|
||||
|
||||
|
||||
if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
|
||||
{
|
||||
Vx *= 0x100;
|
||||
@ -2236,7 +2236,7 @@
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
static
|
||||
TT_Bool Normalize( EXEC_OP_ TT_F26Dot6 Vx,
|
||||
TT_F26Dot6 Vy,
|
||||
@ -2258,7 +2258,7 @@
|
||||
|
||||
R->x = 0;
|
||||
R->y = 0;
|
||||
|
||||
|
||||
/* check that we're not trying to normalise zero !! */
|
||||
if (u==0) return SUCCESS;
|
||||
|
||||
@ -2266,21 +2266,21 @@
|
||||
hi = (TT_ULong)u >> 16;
|
||||
lo = (TT_ULong)u & 0xFFFF;
|
||||
med = hi*lo;
|
||||
|
||||
|
||||
H = hi*hi + (med >> 15);
|
||||
med <<= 17;
|
||||
L = lo*lo + med;
|
||||
if (L < med) H++;
|
||||
|
||||
|
||||
hi = (TT_ULong)v >> 16;
|
||||
lo = (TT_ULong)v & 0xFFFF;
|
||||
med = hi*lo;
|
||||
|
||||
|
||||
H += hi*hi + (med >> 15);
|
||||
med <<= 17;
|
||||
L2 = lo*lo + med;
|
||||
if (L2 < med) H++;
|
||||
|
||||
|
||||
L += L2;
|
||||
if (L < L2) H++;
|
||||
|
||||
@ -2293,7 +2293,7 @@
|
||||
L <<= 2;
|
||||
shift++;
|
||||
}
|
||||
|
||||
|
||||
d = FT_Sqrt32(L);
|
||||
R->x = (TT_F2Dot14)TT_MULDIV( Vx << shift, 0x4000, d );
|
||||
R->y = (TT_F2Dot14)TT_MULDIV( Vy << shift, 0x4000, d );
|
||||
@ -2308,7 +2308,7 @@
|
||||
H >>= 2;
|
||||
shift++;
|
||||
}
|
||||
|
||||
|
||||
d = FT_Sqrt32(L);
|
||||
R->x = (TT_F2Dot14)TT_MULDIV( Vx >> shift, 0x4000, d );
|
||||
R->y = (TT_F2Dot14)TT_MULDIV( Vy >> shift, 0x4000, d );
|
||||
@ -2322,7 +2322,7 @@
|
||||
sy = ( R->y >= 0 ? 1 : -1 );
|
||||
x = (TT_ULong)sx*R->x;
|
||||
y = (TT_ULong)sy*R->y;
|
||||
|
||||
|
||||
w = x*x+y*y;
|
||||
|
||||
/* we now want to adjust (x,y) in order to have sqrt(w) == 0x4000 */
|
||||
@ -2332,10 +2332,10 @@
|
||||
/* increment the smallest coordinate */
|
||||
if ( x < y ) x++;
|
||||
else y++;
|
||||
|
||||
|
||||
w = x*x+y*y;
|
||||
}
|
||||
|
||||
|
||||
while ( w >= 0x10040000L )
|
||||
{
|
||||
/* decrement the smallest coordinate */
|
||||
@ -4055,13 +4055,13 @@
|
||||
rec = CUR.FDefs;
|
||||
limit = rec + CUR.numFDefs;
|
||||
n = args[0];
|
||||
|
||||
|
||||
for ( ; rec < limit; rec++ )
|
||||
{
|
||||
if (rec->opc == n)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( rec == limit )
|
||||
{
|
||||
/* check that there is enough room for new functions */
|
||||
@ -4072,15 +4072,15 @@
|
||||
}
|
||||
CUR.numFDefs++;
|
||||
}
|
||||
|
||||
|
||||
rec->range = CUR.curRange;
|
||||
rec->opc = n;
|
||||
rec->start = CUR.IP+1;
|
||||
rec->active = TRUE;
|
||||
|
||||
|
||||
if ( n > CUR.maxFunc )
|
||||
CUR.maxFunc = n;
|
||||
|
||||
|
||||
/* Now skip the whole function definition. */
|
||||
/* We don't allow nested IDEFS & FDEFs. */
|
||||
|
||||
@ -4164,7 +4164,7 @@
|
||||
/* first of all, check the index */
|
||||
F = args[0];
|
||||
if ( BOUNDS( F, CUR.maxFunc+1 ) ) goto Fail;
|
||||
|
||||
|
||||
/* Except for some old Apple fonts, all functions in a TrueType */
|
||||
/* font are defined in increasing order, starting from 0. This */
|
||||
/* means that we normally have */
|
||||
@ -4179,20 +4179,20 @@
|
||||
{
|
||||
/* look up the FDefs table */
|
||||
TT_DefRecord* limit;
|
||||
|
||||
|
||||
def = CUR.FDefs;
|
||||
limit = def + CUR.numFDefs;
|
||||
|
||||
|
||||
while (def < limit && def->opc != F)
|
||||
def++;
|
||||
|
||||
|
||||
if (def == limit) goto Fail;
|
||||
}
|
||||
|
||||
|
||||
/* check that the function is active */
|
||||
if (!def->active)
|
||||
goto Fail;
|
||||
|
||||
|
||||
/* check the call stack */
|
||||
if ( CUR.callTop >= CUR.callSize )
|
||||
{
|
||||
@ -4211,10 +4211,10 @@
|
||||
|
||||
INS_Goto_CodeRange( def->range,
|
||||
def->start );
|
||||
|
||||
|
||||
CUR.step_ins = FALSE;
|
||||
return;
|
||||
|
||||
|
||||
Fail:
|
||||
CUR.error = TT_Err_Invalid_Reference;
|
||||
}
|
||||
@ -4236,7 +4236,7 @@
|
||||
/* first of all, check the index */
|
||||
F = args[1];
|
||||
if ( BOUNDS( F, CUR.maxFunc+1 ) ) goto Fail;
|
||||
|
||||
|
||||
/* Except for some old Apple fonts, all functions in a TrueType */
|
||||
/* font are defined in increasing order, starting from 0. This */
|
||||
/* means that we normally have */
|
||||
@ -4251,21 +4251,21 @@
|
||||
{
|
||||
/* look up the FDefs table */
|
||||
TT_DefRecord* limit;
|
||||
|
||||
|
||||
def = CUR.FDefs;
|
||||
limit = def + CUR.numFDefs;
|
||||
|
||||
|
||||
while (def < limit && def->opc != F)
|
||||
def++;
|
||||
|
||||
|
||||
if (def == limit) goto Fail;
|
||||
}
|
||||
|
||||
|
||||
/* check that the function is active */
|
||||
if (!def->active)
|
||||
goto Fail;
|
||||
|
||||
/* check stack */
|
||||
/* check stack */
|
||||
if ( CUR.callTop >= CUR.callSize )
|
||||
{
|
||||
CUR.error = TT_Err_Stack_Overflow;
|
||||
@ -4312,7 +4312,7 @@
|
||||
for ( ; def < limit; def++ )
|
||||
if (def->opc == (TT_ULong)args[0] )
|
||||
break;
|
||||
|
||||
|
||||
if ( def == limit )
|
||||
{
|
||||
/* check that there is enough room for a new instruction */
|
||||
@ -4323,15 +4323,15 @@
|
||||
}
|
||||
CUR.numIDefs++;
|
||||
}
|
||||
|
||||
|
||||
def->opc = args[0];
|
||||
def->start = CUR.IP+1;
|
||||
def->range = CUR.curRange;
|
||||
def->active = TRUE;
|
||||
|
||||
|
||||
if ( (TT_ULong)args[0] > CUR.maxIns )
|
||||
CUR.maxIns = args[0];
|
||||
|
||||
|
||||
/* Now skip the whole function definition. */
|
||||
/* We don't allow nested IDEFs & FDEFs. */
|
||||
|
||||
@ -6320,30 +6320,30 @@
|
||||
{
|
||||
TT_DefRecord* def = CUR.IDefs;
|
||||
TT_DefRecord* limit = def + CUR.numIDefs;
|
||||
|
||||
|
||||
UNUSED_ARG;
|
||||
|
||||
|
||||
for ( ; def < limit; def++ )
|
||||
{
|
||||
if (def->opc == CUR.opcode && def->active )
|
||||
{
|
||||
TT_CallRec* call;
|
||||
|
||||
|
||||
if ( CUR.callTop >= CUR.callSize )
|
||||
{
|
||||
CUR.error = TT_Err_Stack_Overflow;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
call = CUR.callStack + CUR.callTop++;
|
||||
|
||||
call->Caller_Range = CUR.curRange;
|
||||
call->Caller_IP = CUR.IP+1;
|
||||
call->Cur_Count = 1;
|
||||
call->Cur_Restart = def->start;
|
||||
|
||||
|
||||
INS_Goto_CodeRange( def->range, def->start );
|
||||
|
||||
|
||||
CUR.step_ins = FALSE;
|
||||
return;
|
||||
}
|
||||
@ -7292,29 +7292,29 @@
|
||||
{
|
||||
TT_DefRecord* def = CUR.IDefs;
|
||||
TT_DefRecord* limit = def + CUR.numIDefs;
|
||||
|
||||
|
||||
for ( ; def < limit; def++ )
|
||||
{
|
||||
if ( def->active && CUR.opcode == def->opc )
|
||||
{
|
||||
TT_CallRec* callrec;
|
||||
|
||||
|
||||
if ( CUR.callTop >= CUR.callSize )
|
||||
{
|
||||
CUR.error = TT_Err_Invalid_Reference;
|
||||
goto LErrorLabel_;
|
||||
}
|
||||
|
||||
|
||||
callrec = &CUR.callStack[CUR.callTop];
|
||||
|
||||
|
||||
callrec->Caller_Range = CUR.curRange;
|
||||
callrec->Caller_IP = CUR.IP + 1;
|
||||
callrec->Cur_Count = 1;
|
||||
callrec->Cur_Restart = def->start;
|
||||
|
||||
|
||||
if ( INS_Goto_CodeRange( def->range, def->start ) == FAILURE )
|
||||
goto LErrorLabel_;
|
||||
|
||||
|
||||
goto LSuiteLabel_;
|
||||
}
|
||||
}
|
||||
|
@ -365,7 +365,7 @@
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Face Funcs */
|
||||
/* Face Funcs */
|
||||
|
||||
LOCAL_DEF TT_Error TT_Init_Face( FT_Stream stream,
|
||||
TT_Face face,
|
||||
@ -377,7 +377,7 @@
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Size funcs */
|
||||
/* Size funcs */
|
||||
|
||||
LOCAL_DEF TT_Error TT_Init_Size ( TT_Size size );
|
||||
LOCAL_DEF void TT_Done_Size ( TT_Size size );
|
||||
@ -385,14 +385,14 @@
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* GlyphSlot funcs */
|
||||
/* GlyphSlot funcs */
|
||||
|
||||
LOCAL_DEF TT_Error TT_Init_GlyphSlot( TT_GlyphSlot slot );
|
||||
LOCAL_DEF void TT_Done_GlyphSlot( TT_GlyphSlot slot );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Driver funcs */
|
||||
/* Driver funcs */
|
||||
|
||||
LOCAL_DEF TT_Error TT_Init_Driver( TT_Driver driver );
|
||||
LOCAL_DEF void TT_Done_Driver( TT_Driver driver );
|
||||
|
@ -34,27 +34,27 @@
|
||||
FT_UInt result = 0;
|
||||
char temp[64];
|
||||
|
||||
/* skip whitespace */
|
||||
/* skip whitespace */
|
||||
while ( (*p == ' ' || *p == '\t' || *p == ':' || *p == ';') && p < limit )
|
||||
p++;
|
||||
*start = p;
|
||||
|
||||
|
||||
/* now, read glyph name */
|
||||
while ( IS_ALPHANUM(*p) && p < limit ) p++;
|
||||
len = p - *start;
|
||||
if (len > 0 && len < 64)
|
||||
{
|
||||
FT_Int n;
|
||||
|
||||
|
||||
/* copy glyph name to intermediate array */
|
||||
MEM_Copy( temp, *start, len );
|
||||
temp[len] = 0;
|
||||
|
||||
|
||||
/* lookup glyph name in face array */
|
||||
for ( n = 0; n < type1->num_glyphs; n++ )
|
||||
{
|
||||
char* gname = (char*)type1->glyph_names[n];
|
||||
|
||||
|
||||
if ( gname && gname[0] == temp[0] && strcmp(gname,temp) == 0 )
|
||||
{
|
||||
result = n;
|
||||
@ -74,17 +74,17 @@
|
||||
FT_Byte* p = *start;
|
||||
int sum = 0;
|
||||
int sign = 1;
|
||||
|
||||
|
||||
/* skip everything that is not a number */
|
||||
while ( p < limit && (*p < '0' || *p > '9') )
|
||||
{
|
||||
sign = 1;
|
||||
if (*p == '-')
|
||||
sign = -1;
|
||||
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
while ( p < limit && (*p >= '0' && *p < '9') )
|
||||
{
|
||||
sum = sum*10 + (*p - '0');
|
||||
@ -104,10 +104,10 @@
|
||||
{
|
||||
T1_Kern_Pair* pair1 = (T1_Kern_Pair*)a;
|
||||
T1_Kern_Pair* pair2 = (T1_Kern_Pair*)b;
|
||||
|
||||
|
||||
T1_ULong index1 = KERN_INDEX(pair1->glyph1,pair1->glyph2);
|
||||
T1_ULong index2 = KERN_INDEX(pair2->glyph1,pair2->glyph2);
|
||||
|
||||
|
||||
return ( index1 < index2 ? -1 :
|
||||
( index1 > index2 ? 1 : 0 ));
|
||||
}
|
||||
@ -127,14 +127,14 @@
|
||||
T1_Kern_Pair* pair;
|
||||
T1_Font* type1 = &((T1_Face)t1_face)->type1;
|
||||
T1_AFM* afm = 0;
|
||||
|
||||
|
||||
if ( ACCESS_Frame(stream->size) )
|
||||
return error;
|
||||
|
||||
|
||||
start = (FT_Byte*)stream->cursor;
|
||||
limit = (FT_Byte*)stream->limit;
|
||||
p = start;
|
||||
|
||||
|
||||
/* we are now going to count the occurences of "KP" or "KPX" in */
|
||||
/* the AFM file.. */
|
||||
count = 0;
|
||||
@ -147,16 +147,16 @@
|
||||
/* Actually, kerning pairs are simply optional !! */
|
||||
if (count == 0)
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* allocate the pairs */
|
||||
if ( ALLOC( afm, sizeof(*afm ) ) ||
|
||||
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* now, read each kern pair */
|
||||
pair = afm->kern_pairs;
|
||||
afm->num_pairs = count;
|
||||
|
||||
|
||||
/* save in face object */
|
||||
((T1_Face)t1_face)->afm_data = afm;
|
||||
|
||||
@ -165,26 +165,26 @@
|
||||
if ( IS_KERN_PAIR(p) )
|
||||
{
|
||||
FT_Byte* q;
|
||||
|
||||
|
||||
/* skip keyword (KP or KPX) */
|
||||
q = p+2;
|
||||
if (*q == 'X') q++;
|
||||
|
||||
|
||||
pair->glyph1 = afm_atoindex( &q, limit, type1 );
|
||||
pair->glyph2 = afm_atoindex( &q, limit, type1 );
|
||||
pair->kerning.x = afm_atoi( &q, limit );
|
||||
|
||||
|
||||
pair->kerning.y = 0;
|
||||
if ( p[2] != 'X' )
|
||||
pair->kerning.y = afm_atoi( &q, limit );
|
||||
|
||||
|
||||
pair++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now, sort the kern pairs according to their glyph indices */
|
||||
qsort( afm->kern_pairs, count, sizeof(T1_Kern_Pair), compare_kern_pairs );
|
||||
|
||||
|
||||
Exit:
|
||||
if (error)
|
||||
FREE( afm );
|
||||
@ -194,7 +194,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* find the kerning for a given glyph pair */
|
||||
/* find the kerning for a given glyph pair */
|
||||
LOCAL_FUNC
|
||||
void T1_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
@ -203,23 +203,23 @@
|
||||
{
|
||||
T1_Kern_Pair *min, *mid, *max;
|
||||
T1_ULong index = KERN_INDEX(glyph1,glyph2);
|
||||
|
||||
|
||||
/* simple binary search */
|
||||
min = afm->kern_pairs;
|
||||
max = min + afm->num_pairs-1;
|
||||
|
||||
|
||||
while (min <= max)
|
||||
{
|
||||
T1_ULong midi;
|
||||
|
||||
|
||||
mid = min + (max-min)/2;
|
||||
midi = KERN_INDEX(mid->glyph1,mid->glyph2);
|
||||
midi = KERN_INDEX(mid->glyph1,mid->glyph2);
|
||||
if ( midi == index )
|
||||
{
|
||||
*kerning = mid->kerning;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( midi < index ) min = mid+1;
|
||||
else max = mid-1;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ typedef struct T1_Kern_Pair_
|
||||
FT_UInt glyph1;
|
||||
FT_UInt glyph2;
|
||||
FT_Vector kerning;
|
||||
|
||||
|
||||
} T1_Kern_Pair;
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
@ -59,10 +59,10 @@
|
||||
const FT_String* interface )
|
||||
{
|
||||
UNUSED(driver);
|
||||
|
||||
|
||||
if ( strcmp( (const char*)interface, "attach_file" ) == 0 )
|
||||
return (FTDriver_Interface)T1_Read_AFM;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
T1_Vector* kerning )
|
||||
{
|
||||
T1_AFM* afm;
|
||||
|
||||
|
||||
kerning->x = 0;
|
||||
kerning->y = 0;
|
||||
|
||||
@ -185,7 +185,7 @@
|
||||
UNUSED(pixel_width);
|
||||
UNUSED(pixel_height);
|
||||
|
||||
size->valid = FALSE;
|
||||
size->valid = FALSE;
|
||||
return T1_Reset_Size(size);
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@
|
||||
|
||||
face = (T1_Face)charmap->face;
|
||||
psnames = (PSNames_Interface*)face->psnames;
|
||||
if (psnames)
|
||||
if (psnames)
|
||||
switch (charmap->encoding)
|
||||
{
|
||||
/********************************************************************/
|
||||
@ -233,7 +233,7 @@
|
||||
result = 0;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Custom Type 1 encoding */
|
||||
@ -248,7 +248,7 @@
|
||||
}
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Adobe Standard & Expert encoding support */
|
||||
@ -259,18 +259,18 @@
|
||||
FT_UInt code;
|
||||
FT_Int n;
|
||||
const char* glyph_name;
|
||||
|
||||
|
||||
code = psnames->adobe_std_encoding[charcode];
|
||||
if (charmap->encoding == ft_encoding_adobe_expert)
|
||||
code = psnames->adobe_expert_encoding[charcode];
|
||||
|
||||
|
||||
glyph_name = psnames->adobe_std_strings(code);
|
||||
if (!glyph_name) break;
|
||||
|
||||
|
||||
for ( n = 0; n < face->type1.num_glyphs; n++ )
|
||||
{
|
||||
const char* gname = face->type1.glyph_names[n];
|
||||
|
||||
|
||||
if ( gname && gname[0] == glyph_name[0] &&
|
||||
strcmp( gname, glyph_name ) == 0 )
|
||||
{
|
||||
@ -280,7 +280,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
Exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@
|
||||
sizeof( T1_FaceRec ),
|
||||
sizeof( T1_SizeRec ),
|
||||
sizeof( T1_GlyphSlotRec ),
|
||||
|
||||
|
||||
"type1",
|
||||
100,
|
||||
200,
|
||||
@ -385,7 +385,7 @@
|
||||
(FTDriver_initFace) T1_Init_Face,
|
||||
(FTDriver_doneFace) T1_Done_Face,
|
||||
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
(FTDriver_getKerning) 0,
|
||||
#else
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
@ -425,12 +425,12 @@
|
||||
/* */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
|
||||
|
||||
|
||||
EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void )
|
||||
{
|
||||
return &t1_driver_interface;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
||||
#define T1_Err_Ok FT_Err_Ok
|
||||
|
||||
/* ----------- high level API errors -------- */
|
||||
|
||||
|
||||
#define T1_Err_Invalid_File_Format FT_Err_Invalid_File_Format
|
||||
#define T1_Err_Invalid_Argument FT_Err_Invalid_Argument
|
||||
#define T1_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle
|
||||
@ -53,7 +53,7 @@
|
||||
#define T1_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
|
||||
|
||||
/* ------------- internal errors ------------ */
|
||||
|
||||
|
||||
#define T1_Err_Out_Of_Memory FT_Err_Out_Of_Memory
|
||||
#define T1_Err_Unlisted_Object FT_Err_Unlisted_Object
|
||||
|
||||
|
@ -168,7 +168,7 @@
|
||||
* to implement the SEAC Type 1 operator.
|
||||
*
|
||||
* <Input>
|
||||
* face :: current face object
|
||||
* face :: current face object
|
||||
* charcode :: charcode to look for
|
||||
*
|
||||
* <Return>
|
||||
@ -184,18 +184,18 @@
|
||||
T1_Int n;
|
||||
const T1_String* glyph_name;
|
||||
PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
|
||||
|
||||
|
||||
/* check range of standard char code */
|
||||
if (charcode < 0 || charcode > 255)
|
||||
return -1;
|
||||
|
||||
|
||||
glyph_name = psnames->adobe_std_strings(
|
||||
psnames->adobe_std_encoding[charcode]);
|
||||
|
||||
|
||||
for ( n = 0; n < face->type1.num_glyphs; n++ )
|
||||
{
|
||||
T1_String* name = (T1_String*)face->type1.glyph_names[n];
|
||||
|
||||
|
||||
if ( name && strcmp(name,glyph_name) == 0 )
|
||||
return n;
|
||||
}
|
||||
@ -221,7 +221,7 @@
|
||||
* achar :: accent character's StandardEncoding charcode
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
@ -240,10 +240,10 @@
|
||||
FT_Outline* base = &decoder->builder.base;
|
||||
T1_Vector left_bearing, advance;
|
||||
T1_Font* type1 = &face->type1;
|
||||
|
||||
|
||||
bchar_index = lookup_glyph_by_stdcharcode( face, bchar );
|
||||
achar_index = lookup_glyph_by_stdcharcode( face, achar );
|
||||
|
||||
|
||||
if (bchar_index < 0 || achar_index < 0)
|
||||
{
|
||||
FT_ERROR(( "T1.Parse_Seac : invalid seac character code arguments\n" ));
|
||||
@ -275,20 +275,20 @@
|
||||
FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
|
||||
FT_SubGlyph* subg;
|
||||
|
||||
/* reallocate subglyph array if necessary */
|
||||
/* reallocate subglyph array if necessary */
|
||||
if (glyph->max_subglyphs < 2)
|
||||
{
|
||||
FT_Memory memory = decoder->builder.face->root.memory;
|
||||
|
||||
|
||||
if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
|
||||
2, FT_SubGlyph ) )
|
||||
return error;
|
||||
|
||||
|
||||
glyph->max_subglyphs = 2;
|
||||
}
|
||||
|
||||
subg = glyph->subglyphs;
|
||||
|
||||
|
||||
/* subglyph 0 = base character */
|
||||
subg->index = bchar_index;
|
||||
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
|
||||
@ -296,7 +296,7 @@
|
||||
subg->arg1 = 0;
|
||||
subg->arg2 = 0;
|
||||
subg++;
|
||||
|
||||
|
||||
/* subglyph 1 = accent character */
|
||||
subg->index = achar_index;
|
||||
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
|
||||
@ -313,19 +313,19 @@
|
||||
/* as they will be erased by the next load.. */
|
||||
left_bearing = decoder->builder.left_bearing;
|
||||
advance = decoder->builder.advance;
|
||||
|
||||
|
||||
decoder->builder.left_bearing.x = 0;
|
||||
decoder->builder.left_bearing.y = 0;
|
||||
|
||||
decoder->builder.left_bearing.y = 0;
|
||||
|
||||
/* Now load "achar" on top of */
|
||||
/* the base outline */
|
||||
/* */
|
||||
/* */
|
||||
cur->n_points = 0;
|
||||
cur->n_contours = 0;
|
||||
cur->points = base->points + base->n_points;
|
||||
cur->tags = base->tags + base->n_points;
|
||||
cur->contours = base->contours + base->n_contours;
|
||||
|
||||
|
||||
error = T1_Parse_CharStrings( decoder,
|
||||
type1->charstrings [achar_index],
|
||||
type1->charstrings_len[achar_index],
|
||||
@ -333,20 +333,20 @@
|
||||
type1->subrs,
|
||||
type1->subrs_len );
|
||||
if (error) return error;
|
||||
|
||||
|
||||
/* adjust contours in accented character outline */
|
||||
{
|
||||
T1_Int n;
|
||||
|
||||
|
||||
for ( n = 0; n < cur->n_contours; n++ )
|
||||
cur->contours[n] += n_base_points;
|
||||
}
|
||||
|
||||
|
||||
/* restore the left side bearing and */
|
||||
/* advance width of the base character */
|
||||
decoder->builder.left_bearing = left_bearing;
|
||||
decoder->builder.advance = advance;
|
||||
|
||||
|
||||
/* Finally, move the accent */
|
||||
FT_Outline_Translate( cur, adx - asb, ady );
|
||||
}
|
||||
@ -368,7 +368,7 @@
|
||||
* end_y :: position of final flex point
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
@ -434,7 +434,7 @@
|
||||
* subrs_len :: array of sub-routines lengths
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
@ -454,7 +454,7 @@
|
||||
T1_Builder_Funcs* builds = &builder->funcs;
|
||||
T1_Hinter_Funcs* hints = &decoder->hinter;
|
||||
|
||||
static const T1_Int args_count[ op_max ] =
|
||||
static const T1_Int args_count[ op_max ] =
|
||||
{
|
||||
0, /* none */
|
||||
0, /* endchar */
|
||||
@ -959,11 +959,11 @@
|
||||
|
||||
if ( REALLOC_ARRAY( builder->base.points,
|
||||
current, builder->max_points, T1_Vector ) ||
|
||||
|
||||
|
||||
REALLOC_ARRAY( builder->base.tags,
|
||||
current, builder->max_points, T1_Byte ) )
|
||||
return error;
|
||||
|
||||
|
||||
builder->current.points = builder->base.points + increment;
|
||||
builder->current.tags = builder->base.tags + increment;
|
||||
}
|
||||
@ -1015,7 +1015,7 @@
|
||||
if ( REALLOC_ARRAY( builder->base.contours,
|
||||
current, builder->max_contours, T1_Short ) )
|
||||
return error;
|
||||
|
||||
|
||||
builder->current.contours = builder->base.contours + increment;
|
||||
}
|
||||
|
||||
@ -1160,7 +1160,7 @@
|
||||
FT_Outline* cur = &builder->current;
|
||||
T1_Int num_points;
|
||||
T1_Int first_point;
|
||||
|
||||
|
||||
/* Some fonts, like Hershey, are made of "open paths" which are */
|
||||
/* now managed directly by FreeType. In this case, it is necessary */
|
||||
/* to close the path by duplicating its points in reverse order, */
|
||||
@ -1171,7 +1171,7 @@
|
||||
first_point = cur->contours[ cur->n_contours-2 ]+1;
|
||||
else
|
||||
first_point = 0;
|
||||
|
||||
|
||||
num_points = cur->n_points - first_point - 2;
|
||||
if ( num_points > 0 )
|
||||
{
|
||||
@ -1179,19 +1179,19 @@
|
||||
char* source_tags;
|
||||
T1_Vector* point;
|
||||
char* tags;
|
||||
|
||||
|
||||
error = T1_Add_Points( builder, num_points );
|
||||
if (error) return error;
|
||||
|
||||
point = cur->points + cur->n_points;
|
||||
tags = cur->tags + cur->n_points;
|
||||
|
||||
|
||||
source_point = point - 2;
|
||||
source_tags = tags - 2;
|
||||
|
||||
cur->n_points += num_points;
|
||||
|
||||
if ( builder->load_points )
|
||||
if ( builder->load_points )
|
||||
do
|
||||
{
|
||||
*point++ = *source_point--;
|
||||
@ -1241,7 +1241,7 @@
|
||||
if (error) return error;
|
||||
}
|
||||
|
||||
error = gload_closepath( builder );
|
||||
error = gload_closepath( builder );
|
||||
|
||||
builder->base.n_points += cur->n_points;
|
||||
builder->base.n_contours += cur->n_contours;
|
||||
@ -1324,7 +1324,7 @@
|
||||
if (error) return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* grow buffer if necessary */
|
||||
error = T1_Add_Contours( builder, 1 ) ||
|
||||
T1_Add_Points ( builder, 1 );
|
||||
@ -1391,7 +1391,7 @@
|
||||
|
||||
builder->last = vec;
|
||||
}
|
||||
|
||||
|
||||
cur->n_points += 3;
|
||||
builder->path_begun = 1;
|
||||
return T1_Err_Ok;
|
||||
@ -1532,9 +1532,9 @@
|
||||
|
||||
T1_Init_Builder( &decoder.builder, face, size, glyph,
|
||||
&gload_builder_interface );
|
||||
|
||||
|
||||
decoder.builder.no_recurse = !!(load_flags & FT_LOAD_NO_RECURSE);
|
||||
|
||||
|
||||
/* now load the unscaled outline */
|
||||
error = T1_Parse_CharStrings( &decoder,
|
||||
type1->charstrings [glyph_index],
|
||||
@ -1542,7 +1542,7 @@
|
||||
type1->num_subrs,
|
||||
type1->subrs,
|
||||
type1->subrs_len );
|
||||
|
||||
|
||||
/* save new glyph tables */
|
||||
T1_Done_Builder( &decoder.builder );
|
||||
}
|
||||
@ -1564,9 +1564,9 @@
|
||||
{
|
||||
FT_BBox cbox;
|
||||
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
|
||||
|
||||
|
||||
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
|
||||
|
||||
|
||||
/* grid fit the bounding box if necessary */
|
||||
if (hinting)
|
||||
{
|
||||
@ -1575,36 +1575,36 @@
|
||||
cbox.xMax = ( cbox.xMax+63 ) & -64;
|
||||
cbox.yMax = ( cbox.yMax+63 ) & -64;
|
||||
}
|
||||
|
||||
|
||||
metrics->width = cbox.xMax - cbox.xMin;
|
||||
metrics->height = cbox.yMax - cbox.yMin;
|
||||
|
||||
|
||||
metrics->horiBearingX = cbox.xMin;
|
||||
metrics->horiBearingY = cbox.yMax;
|
||||
|
||||
|
||||
/* copy the _unscaled_ advance width */
|
||||
metrics->horiAdvance = decoder.builder.advance.x;
|
||||
|
||||
|
||||
/* make up vertical metrics */
|
||||
metrics->vertBearingX = 0;
|
||||
metrics->vertBearingY = 0;
|
||||
metrics->vertAdvance = 0;
|
||||
|
||||
|
||||
glyph->root.format = ft_glyph_format_outline;
|
||||
|
||||
|
||||
glyph->root.outline.flags &= ft_outline_owner;
|
||||
|
||||
|
||||
if ( size->root.metrics.y_ppem < 24 )
|
||||
glyph->root.outline.flags |= ft_outline_high_precision;
|
||||
|
||||
glyph->root.outline.flags |= ft_outline_reverse_fill;
|
||||
|
||||
|
||||
/*
|
||||
glyph->root.outline.second_pass = TRUE;
|
||||
glyph->root.outline.high_precision = ( size->root.metrics.y_ppem < 24 );
|
||||
glyph->root.outline.dropout_mode = 2;
|
||||
*/
|
||||
|
||||
|
||||
if ( hinting )
|
||||
{
|
||||
/* adjust the advance width */
|
||||
@ -1620,30 +1620,30 @@
|
||||
T1_Vector* vec = cur->points;
|
||||
T1_Fixed x_scale = glyph->x_scale;
|
||||
T1_Fixed y_scale = glyph->y_scale;
|
||||
|
||||
|
||||
/* First of all, scale the points */
|
||||
for ( n = cur->n_points; n > 0; n--, vec++ )
|
||||
{
|
||||
vec->x = FT_MulFix( vec->x, x_scale );
|
||||
vec->y = FT_MulFix( vec->y, y_scale );
|
||||
}
|
||||
|
||||
|
||||
/* Then scale the metrics */
|
||||
metrics->width = FT_MulFix( metrics->width, x_scale );
|
||||
metrics->height = FT_MulFix( metrics->height, y_scale );
|
||||
|
||||
|
||||
metrics->horiBearingX = FT_MulFix( metrics->horiBearingX, x_scale );
|
||||
metrics->horiBearingY = FT_MulFix( metrics->horiBearingY, y_scale );
|
||||
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
|
||||
|
||||
|
||||
metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
|
||||
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
|
||||
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, x_scale );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@
|
||||
/* a structure used to store the address of various functions */
|
||||
/* used by a Type 1 hinter to perform outline hinting. */
|
||||
/* */
|
||||
|
||||
|
||||
typedef T1_Error (*T1_Hinter_ChangeHints)( T1_Builder* builder );
|
||||
|
||||
typedef T1_Error (*T1_Hinter_DotSection)( T1_Builder* builder );
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1hinter.c 1.2
|
||||
*
|
||||
* Type1 hinter.
|
||||
* Type1 hinter.
|
||||
*
|
||||
* Copyright 1996-1999 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -66,7 +66,7 @@
|
||||
* 1. It extracts the bottom and top blue zones from the
|
||||
* face object.
|
||||
*
|
||||
* 2. Each zone is then grown by BlueFuzz, overlapping
|
||||
* 2. Each zone is then grown by BlueFuzz, overlapping
|
||||
* is eliminated by adjusting the zone edges appropriately
|
||||
*
|
||||
* 3. For each zone, we keep its original font units position, its
|
||||
@ -83,7 +83,7 @@
|
||||
{
|
||||
T1_Int i, swap;
|
||||
T1_Int* cur;
|
||||
|
||||
|
||||
for ( i = 2; i < count; i += 2 )
|
||||
{
|
||||
cur = blues + i;
|
||||
@ -91,7 +91,7 @@
|
||||
{
|
||||
if ( cur[-1] < cur[0] )
|
||||
break;
|
||||
|
||||
|
||||
swap = cur[-2]; cur[-2] = cur[0]; cur[0] = swap;
|
||||
swap = cur[-1]; cur[-1] = cur[1]; cur[1] = swap;
|
||||
cur -= 2;
|
||||
@ -210,27 +210,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Compare the current pixel size with the BlueScale value */
|
||||
/* to know wether to supress overshoots.. */
|
||||
|
||||
hints->supress_overshoots =
|
||||
|
||||
hints->supress_overshoots =
|
||||
( size->root.metrics.y_ppem < FT_MulFix(1000,priv->blue_scale) );
|
||||
|
||||
/* Now print the new blue values in tracing mode */
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
|
||||
FT_TRACE2(( "Blue Zones for size object at $%08lx :\n", (long)size ));
|
||||
FT_TRACE2(( " orus pix min max\n" ));
|
||||
FT_TRACE2(( "-------------------------------\n" ));
|
||||
|
||||
|
||||
zone = hints->blue_zones;
|
||||
for ( n = 0; n < hints->num_blue_zones; n++ )
|
||||
{
|
||||
FT_TRACE2(( " %3d %.2f %.2f %.2f\n",
|
||||
zone->orus,
|
||||
zone->orus,
|
||||
zone->pix/64.0,
|
||||
zone->min/64.0,
|
||||
zone->min/64.0,
|
||||
zone->max/64.0 ));
|
||||
zone++;
|
||||
}
|
||||
@ -238,7 +238,7 @@
|
||||
hints->supress_overshoots ? "supressed" : "active" ));
|
||||
|
||||
#endif /* DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@
|
||||
* This function performs the following :
|
||||
*
|
||||
* 1. It reads and scales the stem snap widths from the parent face
|
||||
*
|
||||
*
|
||||
* 2. A "snap zone" is computed for each snap width, by "growing"
|
||||
* it with a threshold of a 1/2 pixel. Overlapping is avoided
|
||||
* through proper edge adjustment.
|
||||
@ -296,7 +296,7 @@
|
||||
base_zone = hints->snap_widths;
|
||||
orgs = priv->stem_snap_widths;
|
||||
scale = size->root.metrics.x_scale;
|
||||
|
||||
|
||||
while (direction < 2)
|
||||
{
|
||||
/*****************************************************************/
|
||||
@ -305,7 +305,7 @@
|
||||
/* font record. */
|
||||
/* */
|
||||
T1_Pos prev, orus, pix, min, max, threshold;
|
||||
|
||||
|
||||
threshold = ONE_PIXEL/4;
|
||||
zone = base_zone;
|
||||
|
||||
@ -347,14 +347,14 @@
|
||||
|
||||
/* print the scaled stem snap values in tracing modes */
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
FT_TRACE2(( "Set_Snap_Zones : first %s pass\n",
|
||||
|
||||
FT_TRACE2(( "Set_Snap_Zones : first %s pass\n",
|
||||
direction ? "vertical" : "horizontal" ));
|
||||
|
||||
|
||||
FT_TRACE2(( "Scaled original stem snap zones :\n" ));
|
||||
FT_TRACE2(( " orus pix min max\n" ));
|
||||
FT_TRACE2(( "-----------------------------\n" ));
|
||||
|
||||
|
||||
zone = base_zone;
|
||||
for ( n = 0; n < n_zones; n++, zone++ )
|
||||
FT_TRACE2(( " %3d %.2f %.2f %.2f\n",
|
||||
@ -363,7 +363,7 @@
|
||||
zone->min/64.0,
|
||||
zone->max/64.0 ));
|
||||
FT_TRACE2(( "\n" ));
|
||||
|
||||
|
||||
FT_TRACE2(( "Standard width = %d\n", standard_width ));
|
||||
#endif
|
||||
|
||||
@ -378,7 +378,7 @@
|
||||
T1_Snap_Zone* parent;
|
||||
T1_Pos std_pix, std_min, std_max;
|
||||
|
||||
std_pix = SCALE( standard_width );
|
||||
std_pix = SCALE( standard_width );
|
||||
|
||||
std_min = std_pix-threshold;
|
||||
std_max = std_pix+threshold;
|
||||
@ -402,29 +402,29 @@
|
||||
}
|
||||
zone++;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* Now, insert the standard width zone */
|
||||
|
||||
|
||||
zone = base_zone+num_zones;
|
||||
while ( zone > base_zone && zone[-1].pix > std_max )
|
||||
{
|
||||
zone[0] = zone[-1];
|
||||
zone --;
|
||||
}
|
||||
|
||||
|
||||
/* check border zones */
|
||||
if ( zone > base_zone && zone[-1].max > std_min )
|
||||
zone[-1].max = std_min;
|
||||
|
||||
|
||||
if ( zone < base_zone+num_zones && zone[1].min < std_max )
|
||||
zone[1].min = std_max;
|
||||
|
||||
|
||||
zone->orus = standard_width;
|
||||
zone->pix = std_pix;
|
||||
zone->min = std_min;
|
||||
zone->max = std_max;
|
||||
|
||||
|
||||
num_zones++;
|
||||
}
|
||||
else
|
||||
@ -436,14 +436,14 @@
|
||||
|
||||
/* print the scaled stem snap values in tracing modes */
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
FT_TRACE2(( "Set_Snap_Zones : second %s pass\n",
|
||||
|
||||
FT_TRACE2(( "Set_Snap_Zones : second %s pass\n",
|
||||
direction ? "vertical" : "horizontal" ));
|
||||
|
||||
|
||||
FT_TRACE2(( "Scaled clipped stem snap zones :\n" ));
|
||||
FT_TRACE2(( " orus pix min max\n" ));
|
||||
FT_TRACE2(( "-----------------------------\n" ));
|
||||
|
||||
|
||||
zone = base_zone;
|
||||
for ( n = 0; n < num_zones; n++, zone++ )
|
||||
FT_TRACE2(( " %3d %.2f %.2f %.2f\n",
|
||||
@ -452,10 +452,10 @@
|
||||
zone->min/64.0,
|
||||
zone->max/64.0 ));
|
||||
FT_TRACE2(( "\n" ));
|
||||
|
||||
|
||||
FT_TRACE2(( "Standard width = %d\n", standard_width ));
|
||||
#endif
|
||||
|
||||
|
||||
/* continue with vertical snap zone */
|
||||
direction++;
|
||||
standard_width = priv->standard_height;
|
||||
@ -467,7 +467,7 @@
|
||||
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
@ -489,7 +489,7 @@
|
||||
T1_Error T1_New_Size_Hinter( T1_Size size )
|
||||
{
|
||||
FT_Memory memory = size->root.face->memory;
|
||||
|
||||
|
||||
return MEM_Alloc( size->hints, sizeof(*size->hints) );
|
||||
}
|
||||
|
||||
@ -562,7 +562,7 @@
|
||||
T1_Error T1_New_Glyph_Hinter( T1_GlyphSlot glyph )
|
||||
{
|
||||
FT_Memory memory = glyph->root.face->memory;
|
||||
|
||||
|
||||
return MEM_Alloc( glyph->hints, sizeof(*glyph->hints) );
|
||||
}
|
||||
|
||||
@ -846,7 +846,7 @@
|
||||
* table :: the horizontal stem hints table
|
||||
* hints :: the current size's hint structure
|
||||
* blueShift :: the value of the /BlueShift as taken from the
|
||||
* face object.
|
||||
* face object.
|
||||
* scale :: the 16.16 scale used to convert outline
|
||||
* units to 26.6 pixels
|
||||
*
|
||||
@ -895,7 +895,7 @@
|
||||
for ( ; zone < zone_limit; zone++ )
|
||||
{
|
||||
T1_Pos dist;
|
||||
|
||||
|
||||
dist = width_pix - zone->min; if (dist < 0) dist = -dist;
|
||||
if (dist < best_dist)
|
||||
{
|
||||
@ -903,7 +903,7 @@
|
||||
best_dist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (best_zone)
|
||||
{
|
||||
if (width_pix > best_zone->pix)
|
||||
@ -948,7 +948,7 @@
|
||||
if (!hints->supress_overshoots)
|
||||
{
|
||||
T1_Pos delta = blue->pix - bottom_pix;
|
||||
|
||||
|
||||
delta = ( delta < blueShift ? 0 : ROUND( delta ) );
|
||||
bottom -= delta;
|
||||
}
|
||||
@ -960,7 +960,7 @@
|
||||
/******************************************************************/
|
||||
/* Check for top blue zones alignement */
|
||||
{
|
||||
T1_Int num_blues = hints->num_blue_zones -
|
||||
T1_Int num_blues = hints->num_blue_zones -
|
||||
hints->num_bottom_zones;
|
||||
|
||||
T1_Snap_Zone* blue = hints->blue_zones +
|
||||
@ -982,7 +982,7 @@
|
||||
if (!hints->supress_overshoots)
|
||||
{
|
||||
T1_Pos delta = top - blue->pix;
|
||||
|
||||
|
||||
delta = ( delta < blueShift ? 0 : ROUND( delta ) );
|
||||
top += delta;
|
||||
}
|
||||
@ -999,27 +999,27 @@
|
||||
bottom_pix = bottom;
|
||||
top_pix = bottom + width_pix;
|
||||
break;
|
||||
|
||||
|
||||
case T1_ALIGN_TOP: /* top zone alignement */
|
||||
top_pix = top;
|
||||
bottom_pix = top - width_pix;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case T1_ALIGN_BOTH: /* bottom+top zone alignement */
|
||||
bottom_pix = bottom;
|
||||
top_pix = top;
|
||||
break;
|
||||
|
||||
|
||||
default: /* no alignement */
|
||||
|
||||
/* XXXX : TODO : Add management of controlled stems */
|
||||
/* XXXX : TODO : Add management of controlled stems */
|
||||
bottom = ( SCALE(bottom_orus+top_orus) - width_pix )/2;
|
||||
|
||||
|
||||
bottom_pix = ROUND(bottom);
|
||||
top_pix = bottom_pix + width_pix;
|
||||
}
|
||||
|
||||
|
||||
stem->min_edge.pix = bottom_pix;
|
||||
stem->max_edge.pix = top_pix;
|
||||
}
|
||||
@ -1079,7 +1079,7 @@
|
||||
for ( ; zone < zone_limit; zone++ )
|
||||
{
|
||||
T1_Pos dist;
|
||||
|
||||
|
||||
dist = width_pix - zone->min; if (dist < 0) dist = -dist;
|
||||
if (dist < best_dist)
|
||||
{
|
||||
@ -1087,7 +1087,7 @@
|
||||
best_dist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (best_zone)
|
||||
{
|
||||
if (width_pix > best_zone->pix)
|
||||
@ -1104,7 +1104,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* round width - minimum 1 pixel if this isn't a ghost stem */
|
||||
if ( width_pix > 0 )
|
||||
width_pix = ( width_pix < ONE_PIXEL ? ONE_PIXEL :
|
||||
@ -1227,7 +1227,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* this function grid-fits several points in a given Type 1 builder
|
||||
* at once.
|
||||
* at once.
|
||||
*
|
||||
* <Input>
|
||||
* builder :: handle to target Type 1 builder
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1hinter.h 1.2
|
||||
*
|
||||
* Type1 hinter.
|
||||
* Type1 hinter.
|
||||
*
|
||||
* Copyright 1996-1999 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -56,10 +56,10 @@
|
||||
typedef struct T1_Snap_Zone_
|
||||
{
|
||||
T1_Pos orus;
|
||||
T1_Pos pix;
|
||||
T1_Pos min;
|
||||
T1_Pos max;
|
||||
|
||||
T1_Pos pix;
|
||||
T1_Pos min;
|
||||
T1_Pos max;
|
||||
|
||||
} T1_Snap_Zone;
|
||||
|
||||
|
||||
@ -80,8 +80,8 @@
|
||||
typedef struct T1_Edge_
|
||||
{
|
||||
T1_Pos orus;
|
||||
T1_Pos pix;
|
||||
|
||||
T1_Pos pix;
|
||||
|
||||
} T1_Edge;
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* A structure used to model the stem hints of a given glyph outline
|
||||
* during glyph loading.
|
||||
* during glyph loading.
|
||||
*
|
||||
* <Fields>
|
||||
* hori_stems :: horizontal stem hints table
|
||||
@ -344,7 +344,7 @@
|
||||
*
|
||||
* <Description>
|
||||
* this function grid-fits several points in a given Type 1 builder
|
||||
* at once.
|
||||
* at once.
|
||||
*
|
||||
* <Input>
|
||||
* builder :: handle to target Type 1 builder
|
||||
|
@ -1131,7 +1131,7 @@
|
||||
error = Expect_Dict_Arguments( parser, 1, tok_error,
|
||||
dict_font, 0 );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
/* clear stack from all the previous content. This */
|
||||
/* could be some stupid Postscript code ... */
|
||||
parser->top = parser->stack;
|
||||
@ -1384,7 +1384,7 @@
|
||||
/* syntax, we never escape from the private dictionary */
|
||||
if (dict_state != dict_private)
|
||||
parser->state_index--;
|
||||
|
||||
|
||||
/* many fonts use a NP instead of def or put, so */
|
||||
/* we simply ignore the nest token.. */
|
||||
#if 0
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1load.h 1.0
|
||||
*
|
||||
* Type1 Loader.
|
||||
* Type1 Loader.
|
||||
*
|
||||
* Copyright 1996-1998 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1objs.c 1.0
|
||||
*
|
||||
* Type1 Objects manager.
|
||||
* Type1 Objects manager.
|
||||
*
|
||||
* Copyright 1996-1998 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -88,9 +88,9 @@
|
||||
T1_Error T1_Init_Size( T1_Size size )
|
||||
{
|
||||
T1_Error error;
|
||||
|
||||
|
||||
size->valid = 0;
|
||||
|
||||
|
||||
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
|
||||
error = T1_New_Size_Hinter( size );
|
||||
return error;
|
||||
@ -117,7 +117,7 @@
|
||||
* Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
T1_Error T1_Reset_Size( T1_Size size )
|
||||
{
|
||||
@ -148,7 +148,7 @@
|
||||
* face :: typeless pointer to the face object to destroy
|
||||
*
|
||||
* <Return>
|
||||
* Error code.
|
||||
* Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
@ -161,11 +161,11 @@
|
||||
if (face)
|
||||
{
|
||||
memory = face->root.memory;
|
||||
|
||||
/* release font info strings */
|
||||
|
||||
/* release font info strings */
|
||||
{
|
||||
T1_FontInfo* info = &type1->font_info;
|
||||
|
||||
|
||||
FREE( info->version );
|
||||
FREE( info->notice );
|
||||
FREE( info->full_name );
|
||||
@ -173,21 +173,21 @@
|
||||
FREE( info->weight );
|
||||
}
|
||||
|
||||
/* release top dictionary */
|
||||
/* release top dictionary */
|
||||
FREE( type1->charstrings_len );
|
||||
FREE( type1->charstrings );
|
||||
FREE( type1->glyph_names );
|
||||
|
||||
FREE( type1->subrs );
|
||||
FREE( type1->subrs_len );
|
||||
|
||||
|
||||
FREE( type1->subrs_block );
|
||||
FREE( type1->charstrings_block );
|
||||
FREE( type1->glyph_names_block );
|
||||
|
||||
FREE( type1->encoding.char_index );
|
||||
FREE( type1->font_name );
|
||||
|
||||
|
||||
#ifndef T1_CONFIG_OPTION_NO_AFM
|
||||
/* release afm data if present */
|
||||
if ( face->afm_data)
|
||||
@ -242,7 +242,7 @@
|
||||
{
|
||||
/* look-up the PSNames driver */
|
||||
FT_Driver psnames_driver;
|
||||
|
||||
|
||||
psnames_driver = FT_Get_Driver( face->root.driver->library, "psnames" );
|
||||
if (psnames_driver)
|
||||
face->psnames = (PSNames_Interface*)
|
||||
@ -278,15 +278,15 @@
|
||||
{
|
||||
FT_Face root = (FT_Face)&face->root;
|
||||
T1_Font* type1 = &face->type1;
|
||||
|
||||
|
||||
root->num_glyphs = type1->num_glyphs;
|
||||
root->num_charmaps = 1;
|
||||
|
||||
|
||||
root->face_index = face_index;
|
||||
root->face_flags = FT_FACE_FLAG_SCALABLE;
|
||||
|
||||
|
||||
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
|
||||
|
||||
|
||||
if ( type1->font_info.is_fixed_pitch )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
@ -299,13 +299,13 @@
|
||||
{
|
||||
char* full = type1->font_info.full_name;
|
||||
char* family = root->family_name;
|
||||
|
||||
|
||||
while ( *family && *full == *family )
|
||||
{
|
||||
family++;
|
||||
full++;
|
||||
}
|
||||
|
||||
|
||||
root->style_name = ( *full == ' ' ? full+1 : "Regular" );
|
||||
}
|
||||
else
|
||||
@ -317,17 +317,17 @@
|
||||
root->style_name = "Regular";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* no embedded bitmap support */
|
||||
root->num_fixed_sizes = 0;
|
||||
root->available_sizes = 0;
|
||||
|
||||
|
||||
root->bbox = type1->font_bbox;
|
||||
root->units_per_EM = 1000;
|
||||
root->ascender = (T1_Short)type1->font_bbox.yMax;
|
||||
root->descender = -(T1_Short)type1->font_bbox.yMin;
|
||||
root->height = ((root->ascender + root->descender)*12)/10;
|
||||
|
||||
|
||||
/* now compute the maximum advance width */
|
||||
|
||||
root->max_advance_width = type1->private_dict.standard_width;
|
||||
@ -347,10 +347,10 @@
|
||||
}
|
||||
|
||||
root->max_advance_height = root->height;
|
||||
|
||||
|
||||
root->underline_position = type1->font_info.underline_position;
|
||||
root->underline_thickness = type1->font_info.underline_thickness;
|
||||
|
||||
|
||||
root->max_points = 0;
|
||||
root->max_contours = 0;
|
||||
}
|
||||
@ -381,7 +381,7 @@
|
||||
charmap->encoding_id = 1;
|
||||
charmap++;
|
||||
}
|
||||
|
||||
|
||||
/* simply clear the error in case of failure (which really) */
|
||||
/* means that out of memory or no unicode glyph names */
|
||||
error = 0;
|
||||
@ -391,25 +391,25 @@
|
||||
/* now, support either the standard, expert, or custom encodings */
|
||||
charmap->face = (FT_Face)face;
|
||||
charmap->platform_id = 7; /* a new platform id for Adobe fonts ?? */
|
||||
|
||||
|
||||
switch (face->type1.encoding_type)
|
||||
{
|
||||
case t1_encoding_standard:
|
||||
charmap->encoding = ft_encoding_adobe_standard;
|
||||
charmap->encoding_id = 0;
|
||||
break;
|
||||
|
||||
|
||||
case t1_encoding_expert:
|
||||
charmap->encoding = ft_encoding_adobe_expert;
|
||||
charmap->encoding_id = 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
charmap->encoding = ft_encoding_adobe_custom;
|
||||
charmap->encoding_id = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
root->charmaps = face->charmaps;
|
||||
root->num_charmaps = charmap - face->charmaprecs + 1;
|
||||
face->charmaps[0] = &face->charmaprecs[0];
|
||||
@ -432,7 +432,7 @@
|
||||
*
|
||||
* Input : _glyph typeless pointer to the glyph record to destroy
|
||||
*
|
||||
* Output : Error code.
|
||||
* Output : Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
@ -459,7 +459,7 @@
|
||||
* Description : The glyph object constructor.
|
||||
*
|
||||
* Input : glyph glyph record to build.
|
||||
* face the glyph's parent face.
|
||||
* face the glyph's parent face.
|
||||
*
|
||||
* Output : Error code.
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1objs.h 1.0
|
||||
*
|
||||
* Type1 objects definition.
|
||||
* Type1 objects definition.
|
||||
*
|
||||
* Copyright 1996-1999 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -83,7 +83,7 @@
|
||||
/* NOW BEGINS THE TYPE1 SPECIFIC STUFF .............................. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
|
||||
/***************************************************/
|
||||
/* */
|
||||
@ -91,7 +91,7 @@
|
||||
/* */
|
||||
/* Type 1 size record.. */
|
||||
/* */
|
||||
|
||||
|
||||
typedef struct T1_SizeRec_
|
||||
{
|
||||
FT_SizeRec root;
|
||||
@ -110,14 +110,14 @@
|
||||
/* */
|
||||
/* TrueDoc glyph record.. */
|
||||
/* */
|
||||
|
||||
|
||||
typedef struct T1_GlyphSlotRec_
|
||||
{
|
||||
FT_GlyphSlotRec root;
|
||||
|
||||
T1_Bool hint;
|
||||
T1_Bool scaled;
|
||||
|
||||
|
||||
T1_Int max_points;
|
||||
T1_Int max_contours;
|
||||
|
||||
@ -251,7 +251,7 @@
|
||||
*
|
||||
* <Input> glyph :: handle to glyph slot object
|
||||
*
|
||||
* <Output> Error code.
|
||||
* <Output> Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
@ -157,16 +157,16 @@
|
||||
old_base = table->block;
|
||||
if (!old_base)
|
||||
return;
|
||||
|
||||
|
||||
(void)REALLOC( table->block, table->capacity, table->cursor );
|
||||
table->capacity = table->cursor;
|
||||
|
||||
|
||||
if (old_base != table->block)
|
||||
{
|
||||
T1_Long delta = table->block - old_base;
|
||||
T1_Byte** element = table->elements;
|
||||
T1_Byte** limit = element + table->max_elems;
|
||||
|
||||
|
||||
for ( ; element < limit; element++ )
|
||||
if (element[0])
|
||||
element[0] += delta;
|
||||
|
@ -170,7 +170,7 @@
|
||||
|
||||
FT_TRACE2(( "Growing tokenizer buffer by %d bytes\n", left_bytes ));
|
||||
|
||||
if ( !REALLOC( tokzer->base, tokzer->limit,
|
||||
if ( !REALLOC( tokzer->base, tokzer->limit,
|
||||
tokzer->limit + left_bytes ) &&
|
||||
!FILE_Read( tokzer->base + tokzer->limit, left_bytes ) )
|
||||
tokzer->limit += left_bytes;
|
||||
@ -309,13 +309,13 @@
|
||||
tokzer->cursor = 0;
|
||||
|
||||
*tokenizer = tokzer;
|
||||
|
||||
|
||||
/* Now check font format, we must see a '%!PS-AdobeFont-1' */
|
||||
/* or a '%!FontType' */
|
||||
{
|
||||
if ( 16 > tokzer->limit )
|
||||
grow( tokzer );
|
||||
|
||||
|
||||
if ( tokzer->limit <= 16 ||
|
||||
( strncmp( (const char*)tokzer->base, "%!PS-AdobeFont-1", 16 ) &&
|
||||
strncmp( (const char*)tokzer->base, "%!FontType", 10 ) ) )
|
||||
@ -817,7 +817,7 @@
|
||||
case '(':
|
||||
case '<':
|
||||
case '/':
|
||||
goto Any_Token;
|
||||
goto Any_Token;
|
||||
|
||||
case ' ':
|
||||
case '\r':
|
||||
@ -842,7 +842,7 @@
|
||||
case '+':
|
||||
if (token_started)
|
||||
goto Next;
|
||||
|
||||
|
||||
token_started = 1;
|
||||
tok->token.start = cur-1;
|
||||
for (;;)
|
||||
|
@ -34,27 +34,27 @@
|
||||
FT_UInt result = 0;
|
||||
char temp[64];
|
||||
|
||||
/* skip whitespace */
|
||||
/* skip whitespace */
|
||||
while ( (*p == ' ' || *p == '\t' || *p == ':' || *p == ';') && p < limit )
|
||||
p++;
|
||||
*start = p;
|
||||
|
||||
|
||||
/* now, read glyph name */
|
||||
while ( IS_ALPHANUM(*p) && p < limit ) p++;
|
||||
len = p - *start;
|
||||
if (len > 0 && len < 64)
|
||||
{
|
||||
FT_Int n;
|
||||
|
||||
|
||||
/* copy glyph name to intermediate array */
|
||||
MEM_Copy( temp, *start, len );
|
||||
temp[len] = 0;
|
||||
|
||||
|
||||
/* lookup glyph name in face array */
|
||||
for ( n = 0; n < type1->num_glyphs; n++ )
|
||||
{
|
||||
char* gname = (char*)type1->glyph_names[n];
|
||||
|
||||
|
||||
if ( gname && gname[0] == temp[0] && strcmp(gname,temp) == 0 )
|
||||
{
|
||||
result = n;
|
||||
@ -74,17 +74,17 @@
|
||||
FT_Byte* p = *start;
|
||||
int sum = 0;
|
||||
int sign = 1;
|
||||
|
||||
|
||||
/* skip everything that is not a number */
|
||||
while ( p < limit && (*p < '0' || *p > '9') )
|
||||
{
|
||||
sign = 1;
|
||||
if (*p == '-')
|
||||
sign = -1;
|
||||
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
while ( p < limit && (*p >= '0' && *p < '9') )
|
||||
{
|
||||
sum = sum*10 + (*p - '0');
|
||||
@ -104,10 +104,10 @@
|
||||
{
|
||||
T1_Kern_Pair* pair1 = (T1_Kern_Pair*)a;
|
||||
T1_Kern_Pair* pair2 = (T1_Kern_Pair*)b;
|
||||
|
||||
|
||||
T1_ULong index1 = KERN_INDEX(pair1->glyph1,pair1->glyph2);
|
||||
T1_ULong index2 = KERN_INDEX(pair2->glyph1,pair2->glyph2);
|
||||
|
||||
|
||||
return ( index1 < index2 ? -1 :
|
||||
( index1 > index2 ? 1 : 0 ));
|
||||
}
|
||||
@ -127,14 +127,14 @@
|
||||
T1_Kern_Pair* pair;
|
||||
T1_Font* type1 = &((T1_Face)t1_face)->type1;
|
||||
T1_AFM* afm = 0;
|
||||
|
||||
|
||||
if ( ACCESS_Frame(stream->size) )
|
||||
return error;
|
||||
|
||||
|
||||
start = (FT_Byte*)stream->cursor;
|
||||
limit = (FT_Byte*)stream->limit;
|
||||
p = start;
|
||||
|
||||
|
||||
/* we are now going to count the occurences of "KP" or "KPX" in */
|
||||
/* the AFM file.. */
|
||||
count = 0;
|
||||
@ -147,16 +147,16 @@
|
||||
/* Actually, kerning pairs are simply optional !! */
|
||||
if (count == 0)
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* allocate the pairs */
|
||||
if ( ALLOC( afm, sizeof(*afm ) ) ||
|
||||
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
/* now, read each kern pair */
|
||||
pair = afm->kern_pairs;
|
||||
afm->num_pairs = count;
|
||||
|
||||
|
||||
/* save in face object */
|
||||
((T1_Face)t1_face)->afm_data = afm;
|
||||
|
||||
@ -165,26 +165,26 @@
|
||||
if ( IS_KERN_PAIR(p) )
|
||||
{
|
||||
FT_Byte* q;
|
||||
|
||||
|
||||
/* skip keyword (KP or KPX) */
|
||||
q = p+2;
|
||||
if (*q == 'X') q++;
|
||||
|
||||
|
||||
pair->glyph1 = afm_atoindex( &q, limit, type1 );
|
||||
pair->glyph2 = afm_atoindex( &q, limit, type1 );
|
||||
pair->kerning.x = afm_atoi( &q, limit );
|
||||
|
||||
|
||||
pair->kerning.y = 0;
|
||||
if ( p[2] != 'X' )
|
||||
pair->kerning.y = afm_atoi( &q, limit );
|
||||
|
||||
|
||||
pair++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now, sort the kern pairs according to their glyph indices */
|
||||
qsort( afm->kern_pairs, count, sizeof(T1_Kern_Pair), compare_kern_pairs );
|
||||
|
||||
|
||||
Exit:
|
||||
if (error)
|
||||
FREE( afm );
|
||||
@ -194,7 +194,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* find the kerning for a given glyph pair */
|
||||
/* find the kerning for a given glyph pair */
|
||||
LOCAL_FUNC
|
||||
void T1_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
@ -203,23 +203,23 @@
|
||||
{
|
||||
T1_Kern_Pair *min, *mid, *max;
|
||||
T1_ULong index = KERN_INDEX(glyph1,glyph2);
|
||||
|
||||
|
||||
/* simple binary search */
|
||||
min = afm->kern_pairs;
|
||||
max = min + afm->num_pairs-1;
|
||||
|
||||
|
||||
while (min <= max)
|
||||
{
|
||||
T1_ULong midi;
|
||||
|
||||
|
||||
mid = min + (max-min)/2;
|
||||
midi = KERN_INDEX(mid->glyph1,mid->glyph2);
|
||||
midi = KERN_INDEX(mid->glyph1,mid->glyph2);
|
||||
if ( midi == index )
|
||||
{
|
||||
*kerning = mid->kerning;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( midi < index ) min = mid+1;
|
||||
else max = mid-1;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ typedef struct T1_Kern_Pair_
|
||||
FT_UInt glyph1;
|
||||
FT_UInt glyph2;
|
||||
FT_Vector kerning;
|
||||
|
||||
|
||||
} T1_Kern_Pair;
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
@ -59,10 +59,10 @@
|
||||
const FT_String* interface )
|
||||
{
|
||||
UNUSED(driver);
|
||||
|
||||
|
||||
if ( strcmp( (const char*)interface, "attach_file" ) == 0 )
|
||||
return (FTDriver_Interface)T1_Read_AFM;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
T1_Vector* kerning )
|
||||
{
|
||||
T1_AFM* afm;
|
||||
|
||||
|
||||
kerning->x = 0;
|
||||
kerning->y = 0;
|
||||
|
||||
@ -185,7 +185,7 @@
|
||||
UNUSED(pixel_width);
|
||||
UNUSED(pixel_height);
|
||||
|
||||
size->valid = FALSE;
|
||||
size->valid = FALSE;
|
||||
return T1_Reset_Size(size);
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@
|
||||
|
||||
face = (T1_Face)charmap->face;
|
||||
psnames = (PSNames_Interface*)face->psnames;
|
||||
if (psnames)
|
||||
if (psnames)
|
||||
switch (charmap->encoding)
|
||||
{
|
||||
/********************************************************************/
|
||||
@ -233,7 +233,7 @@
|
||||
result = 0;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Custom Type 1 encoding */
|
||||
@ -248,7 +248,7 @@
|
||||
}
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Adobe Standard & Expert encoding support */
|
||||
@ -259,18 +259,18 @@
|
||||
FT_UInt code;
|
||||
FT_Int n;
|
||||
const char* glyph_name;
|
||||
|
||||
|
||||
code = psnames->adobe_std_encoding[charcode];
|
||||
if (charmap->encoding == ft_encoding_adobe_expert)
|
||||
code = psnames->adobe_expert_encoding[charcode];
|
||||
|
||||
|
||||
glyph_name = psnames->adobe_std_strings(code);
|
||||
if (!glyph_name) break;
|
||||
|
||||
|
||||
for ( n = 0; n < face->type1.num_glyphs; n++ )
|
||||
{
|
||||
const char* gname = face->type1.glyph_names[n];
|
||||
|
||||
|
||||
if ( gname && gname[0] == glyph_name[0] &&
|
||||
strcmp( gname, glyph_name ) == 0 )
|
||||
{
|
||||
@ -280,7 +280,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
Exit:
|
||||
Exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@
|
||||
sizeof( T1_FaceRec ),
|
||||
sizeof( T1_SizeRec ),
|
||||
sizeof( T1_GlyphSlotRec ),
|
||||
|
||||
|
||||
"type1",
|
||||
100,
|
||||
200,
|
||||
@ -384,7 +384,7 @@
|
||||
(FTDriver_initFace) T1_Init_Face,
|
||||
(FTDriver_doneFace) T1_Done_Face,
|
||||
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
(FTDriver_getKerning) 0,
|
||||
#else
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
@ -424,12 +424,12 @@
|
||||
/* */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
|
||||
|
||||
|
||||
EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void )
|
||||
{
|
||||
return &t1_driver_interface;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
|
@ -32,7 +32,7 @@
|
||||
#define T1_Err_Ok FT_Err_Ok
|
||||
|
||||
/* ----------- high level API errors -------- */
|
||||
|
||||
|
||||
#define T1_Err_Invalid_File_Format FT_Err_Invalid_File_Format
|
||||
#define T1_Err_Invalid_Argument FT_Err_Invalid_Argument
|
||||
#define T1_Err_Invalid_Driver_Handle FT_Err_Invalid_Driver_Handle
|
||||
@ -51,7 +51,7 @@
|
||||
#define T1_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
|
||||
|
||||
/* ------------- internal errors ------------ */
|
||||
|
||||
|
||||
#define T1_Err_Out_Of_Memory FT_Err_Out_Of_Memory
|
||||
#define T1_Err_Unlisted_Object FT_Err_Unlisted_Object
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
} T1_Operator;
|
||||
|
||||
static const T1_Int t1_args_count[ op_max ] =
|
||||
static const T1_Int t1_args_count[ op_max ] =
|
||||
{
|
||||
0, /* none */
|
||||
0, /* endchar */
|
||||
@ -223,7 +223,7 @@
|
||||
return T1_Err_Ok;
|
||||
|
||||
count += base->n_points + outline->n_points;
|
||||
|
||||
|
||||
/* realloc points table if necessary */
|
||||
if ( count >= builder->max_points )
|
||||
{
|
||||
@ -237,14 +237,14 @@
|
||||
|
||||
if ( REALLOC_ARRAY( base->points, current,
|
||||
builder->max_points, T1_Vector ) ||
|
||||
|
||||
|
||||
REALLOC_ARRAY( base->tags, current,
|
||||
builder->max_points, T1_Byte ) )
|
||||
{
|
||||
builder->error = error;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
outline->points = base->points + increment;
|
||||
outline->tags = base->tags + increment;
|
||||
}
|
||||
@ -265,17 +265,17 @@
|
||||
{
|
||||
FT_Vector* point = outline->points + outline->n_points;
|
||||
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
||||
|
||||
|
||||
point->x = x;
|
||||
point->y = y;
|
||||
*control = ( flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic );
|
||||
|
||||
|
||||
builder->last = *point;
|
||||
}
|
||||
|
||||
|
||||
outline->n_points++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* check room for a new on-curve point, then add it */
|
||||
static
|
||||
@ -284,7 +284,7 @@
|
||||
FT_Pos y )
|
||||
{
|
||||
T1_Error error;
|
||||
|
||||
|
||||
error = check_points(builder,1);
|
||||
if (!error)
|
||||
add_point( builder, x, y, 1 );
|
||||
@ -305,7 +305,7 @@
|
||||
outline->n_contours++;
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
/* realloc contours array if necessary */
|
||||
if ( base->n_contours + outline->n_contours >= builder->max_contours &&
|
||||
builder->load_points )
|
||||
@ -323,7 +323,7 @@
|
||||
builder->error = error;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
outline->contours = base->contours + increment;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@
|
||||
if (!builder->path_begun)
|
||||
{
|
||||
T1_Error error;
|
||||
|
||||
|
||||
builder->path_begun = 1;
|
||||
error = add_contour( builder );
|
||||
if (error) return error;
|
||||
@ -374,7 +374,7 @@
|
||||
* to implement the SEAC Type 1 operator.
|
||||
*
|
||||
* <Input>
|
||||
* face :: current face object
|
||||
* face :: current face object
|
||||
* charcode :: charcode to look for
|
||||
*
|
||||
* <Return>
|
||||
@ -390,18 +390,18 @@
|
||||
T1_Int n;
|
||||
const T1_String* glyph_name;
|
||||
PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
|
||||
|
||||
|
||||
/* check range of standard char code */
|
||||
if (charcode < 0 || charcode > 255)
|
||||
return -1;
|
||||
|
||||
|
||||
glyph_name = psnames->adobe_std_strings(
|
||||
psnames->adobe_std_encoding[charcode]);
|
||||
|
||||
|
||||
for ( n = 0; n < face->type1.num_glyphs; n++ )
|
||||
{
|
||||
T1_String* name = (T1_String*)face->type1.glyph_names[n];
|
||||
|
||||
|
||||
if ( name && strcmp(name,glyph_name) == 0 )
|
||||
return n;
|
||||
}
|
||||
@ -428,7 +428,7 @@
|
||||
* achar :: accent character's StandardEncoding charcode
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
@ -447,10 +447,10 @@
|
||||
FT_Outline* base = &decoder->builder.base;
|
||||
T1_Vector left_bearing, advance;
|
||||
T1_Font* type1 = &face->type1;
|
||||
|
||||
|
||||
bchar_index = lookup_glyph_by_stdcharcode( face, bchar );
|
||||
achar_index = lookup_glyph_by_stdcharcode( face, achar );
|
||||
|
||||
|
||||
if (bchar_index < 0 || achar_index < 0)
|
||||
{
|
||||
FT_ERROR(( "T1.Parse_Seac : invalid seac character code arguments\n" ));
|
||||
@ -482,20 +482,20 @@
|
||||
FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
|
||||
FT_SubGlyph* subg;
|
||||
|
||||
/* reallocate subglyph array if necessary */
|
||||
/* reallocate subglyph array if necessary */
|
||||
if (glyph->max_subglyphs < 2)
|
||||
{
|
||||
FT_Memory memory = decoder->builder.face->root.memory;
|
||||
|
||||
|
||||
if ( REALLOC_ARRAY( glyph->subglyphs, glyph->max_subglyphs,
|
||||
2, FT_SubGlyph ) )
|
||||
return error;
|
||||
|
||||
|
||||
glyph->max_subglyphs = 2;
|
||||
}
|
||||
|
||||
subg = glyph->subglyphs;
|
||||
|
||||
|
||||
/* subglyph 0 = base character */
|
||||
subg->index = bchar_index;
|
||||
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
|
||||
@ -503,7 +503,7 @@
|
||||
subg->arg1 = 0;
|
||||
subg->arg2 = 0;
|
||||
subg++;
|
||||
|
||||
|
||||
/* subglyph 1 = accent character */
|
||||
subg->index = achar_index;
|
||||
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
|
||||
@ -520,19 +520,19 @@
|
||||
/* as they will be erase by the next load.. */
|
||||
left_bearing = decoder->builder.left_bearing;
|
||||
advance = decoder->builder.advance;
|
||||
|
||||
|
||||
decoder->builder.left_bearing.x = 0;
|
||||
decoder->builder.left_bearing.y = 0;
|
||||
|
||||
decoder->builder.left_bearing.y = 0;
|
||||
|
||||
/* Now load "achar" on top of */
|
||||
/* the base outline */
|
||||
/* */
|
||||
/* */
|
||||
cur->n_points = 0;
|
||||
cur->n_contours = 0;
|
||||
cur->points = base->points + base->n_points;
|
||||
cur->tags = base->tags + base->n_points;
|
||||
cur->contours = base->contours + base->n_contours;
|
||||
|
||||
|
||||
error = T1_Parse_CharStrings( decoder,
|
||||
type1->charstrings [achar_index],
|
||||
type1->charstrings_len[achar_index],
|
||||
@ -540,21 +540,21 @@
|
||||
type1->subrs,
|
||||
type1->subrs_len );
|
||||
if (error) return error;
|
||||
|
||||
|
||||
/* adjust contours in accented character outline */
|
||||
if (decoder->builder.load_points)
|
||||
{
|
||||
T1_Int n;
|
||||
|
||||
|
||||
for ( n = 0; n < cur->n_contours; n++ )
|
||||
cur->contours[n] += n_base_points;
|
||||
}
|
||||
|
||||
|
||||
/* restore the left side bearing and */
|
||||
/* advance width of the base character */
|
||||
decoder->builder.left_bearing = left_bearing;
|
||||
decoder->builder.advance = advance;
|
||||
|
||||
|
||||
/* Finally, move the accent */
|
||||
if (decoder->builder.load_points)
|
||||
FT_Outline_Translate( cur, adx - asb, ady );
|
||||
@ -580,7 +580,7 @@
|
||||
* subrs_len :: array of sub-routines lengths
|
||||
*
|
||||
* <Return>
|
||||
* Error code. 0 means success.
|
||||
* Error code. 0 means success.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
@ -615,7 +615,7 @@
|
||||
|
||||
error = T1_Err_Ok;
|
||||
outline = &builder->current;
|
||||
|
||||
|
||||
x = builder->pos_x;
|
||||
y = builder->pos_y;
|
||||
|
||||
@ -749,27 +749,27 @@
|
||||
FT_TRACE4(( " callothersubr" ));
|
||||
if ( top - decoder->stack < 2 )
|
||||
goto Stack_Underflow;
|
||||
|
||||
|
||||
top -= 2;
|
||||
switch ( top[1] )
|
||||
{
|
||||
case 1: /* start flex feature ---------------------- */
|
||||
{
|
||||
if ( top[0] != 0 ) goto Unexpected_OtherSubr;
|
||||
|
||||
|
||||
decoder->flex_state = 1;
|
||||
decoder->num_flex_vectors = 0;
|
||||
if ( start_point(builder, x, y) ||
|
||||
check_points(builder,6) ) goto Memory_Error;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 2: /* add flex vectors ------------------------ */
|
||||
{
|
||||
T1_Int index;
|
||||
|
||||
|
||||
if ( top[0] != 0 ) goto Unexpected_OtherSubr;
|
||||
|
||||
|
||||
/* note that we should not add a point for index 0 */
|
||||
/* this will move our current position to the flex */
|
||||
/* point without adding any point to the outline */
|
||||
@ -781,18 +781,18 @@
|
||||
(T1_Byte)( index==3 || index==6 ) );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 0: /* end flex feature ------------------------- */
|
||||
{
|
||||
if ( top[0] != 3 ) goto Unexpected_OtherSubr;
|
||||
|
||||
|
||||
if ( decoder->flex_state == 0 ||
|
||||
decoder->num_flex_vectors != 7 )
|
||||
{
|
||||
FT_ERROR(( "T1.Parse_CharStrings: unexpected flex end\n" ));
|
||||
goto Syntax_Error;
|
||||
}
|
||||
|
||||
|
||||
/* now consume the remaining "pop pop setcurpoint" */
|
||||
if ( ip+6 > limit ||
|
||||
ip[0] != 12 || ip[1] != 17 || /* pop */
|
||||
@ -802,16 +802,16 @@
|
||||
FT_ERROR(( "T1.Parse_CharStrings: invalid flex charstring\n" ));
|
||||
goto Syntax_Error;
|
||||
}
|
||||
|
||||
|
||||
ip += 6;
|
||||
decoder->flex_state = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 3: /* change hints ---------------------------- */
|
||||
{
|
||||
if ( top[0] != 1 ) goto Unexpected_OtherSubr;
|
||||
|
||||
|
||||
/* eat the following "pop" */
|
||||
if (ip+2 > limit)
|
||||
{
|
||||
@ -819,7 +819,7 @@
|
||||
ip[-1] ));
|
||||
goto Syntax_Error;
|
||||
}
|
||||
|
||||
|
||||
if (ip[0] != 12 || ip[1] != 17)
|
||||
{
|
||||
FT_ERROR(( "T1.Parse_CharStrings: 'pop' expected, found (%d %d)\n",
|
||||
@ -829,7 +829,7 @@
|
||||
ip += 2;
|
||||
break;;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
Unexpected_OtherSubr:
|
||||
FT_ERROR(( "T1.Parse_CharStrings: invalid othersubr [%d %d]!!\n",
|
||||
@ -852,12 +852,12 @@
|
||||
case op_endchar: /*************************************************/
|
||||
{
|
||||
FT_TRACE4(( " endchar" ));
|
||||
close_contour( builder );
|
||||
close_contour( builder );
|
||||
|
||||
/* add current outline to the glyph slot */
|
||||
builder->base.n_points += builder->current.n_points;
|
||||
builder->base.n_contours += builder->current.n_contours;
|
||||
|
||||
|
||||
/* return now !! */
|
||||
FT_TRACE4(( "\n\n" ));
|
||||
return T1_Err_Ok;
|
||||
@ -870,16 +870,16 @@
|
||||
builder->left_bearing.x += top[0];
|
||||
builder->advance.x = top[1];
|
||||
builder->advance.y = 0;
|
||||
|
||||
|
||||
builder->last.x = x = top[0];
|
||||
builder->last.y = y = 0;
|
||||
|
||||
|
||||
/* the "metrics_only" indicates that we only want to compute */
|
||||
/* the glyph's metrics (lsb + advance width), not load the */
|
||||
/* rest of it.. so exit immediately */
|
||||
if (builder->metrics_only)
|
||||
return T1_Err_Ok;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -896,16 +896,16 @@
|
||||
builder->left_bearing.y += top[1];
|
||||
builder->advance.x = top[2];
|
||||
builder->advance.y = top[3];
|
||||
|
||||
|
||||
builder->last.x = x = top[0];
|
||||
builder->last.y = y = top[1];
|
||||
|
||||
|
||||
/* the "metrics_only" indicates that we only want to compute */
|
||||
/* the glyph's metrics (lsb + advance width), not load the */
|
||||
/* rest of it.. so exit immediately */
|
||||
if (builder->metrics_only)
|
||||
return T1_Err_Ok;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -942,7 +942,7 @@
|
||||
FT_TRACE4(( " hvcurveto" ));
|
||||
if ( start_point( builder, x, y ) ||
|
||||
check_points( builder, 3 ) ) goto Memory_Error;
|
||||
|
||||
|
||||
x += top[0];
|
||||
add_point( builder, x, y, 0 );
|
||||
x += top[1];
|
||||
@ -958,7 +958,7 @@
|
||||
{
|
||||
FT_TRACE4(( " rlineto" ));
|
||||
if ( start_point( builder, x, y ) ) goto Memory_Error;
|
||||
|
||||
|
||||
x += top[0];
|
||||
y += top[1];
|
||||
Add_Line:
|
||||
@ -980,11 +980,11 @@
|
||||
FT_TRACE4(( " rcurveto" ));
|
||||
if ( start_point( builder, x, y ) ||
|
||||
check_points( builder, 3 ) ) goto Memory_Error;
|
||||
|
||||
|
||||
x += top[0];
|
||||
y += top[1];
|
||||
add_point( builder, x, y, 0 );
|
||||
|
||||
|
||||
x += top[2];
|
||||
y += top[3];
|
||||
add_point( builder, x, y, 0 );
|
||||
@ -993,7 +993,7 @@
|
||||
y += top[5];
|
||||
add_point( builder, x, y, 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
case op_vhcurveto: /**********************************************/
|
||||
@ -1001,7 +1001,7 @@
|
||||
FT_TRACE4(( " vhcurveto" ));
|
||||
if ( start_point( builder, x, y ) ||
|
||||
check_points( builder, 3 ) ) goto Memory_Error;
|
||||
|
||||
|
||||
y += top[0];
|
||||
add_point( builder, x, y, 0 );
|
||||
x += top[1];
|
||||
@ -1017,7 +1017,7 @@
|
||||
{
|
||||
FT_TRACE4(( " vlineto" ));
|
||||
if ( start_point( builder, x, y ) ) goto Memory_Error;
|
||||
|
||||
|
||||
y += top[0];
|
||||
goto Add_Line;
|
||||
}
|
||||
@ -1150,10 +1150,10 @@
|
||||
}
|
||||
|
||||
decoder->top = top;
|
||||
|
||||
|
||||
} /* general operator processing */
|
||||
|
||||
|
||||
|
||||
} /* while ip < limit */
|
||||
FT_TRACE4(( "..end..\n\n" ));
|
||||
return error;
|
||||
@ -1163,7 +1163,7 @@
|
||||
|
||||
Stack_Underflow:
|
||||
return T1_Err_Stack_Underflow;
|
||||
|
||||
|
||||
Memory_Error:
|
||||
return builder->error;
|
||||
}
|
||||
@ -1269,9 +1269,9 @@
|
||||
{
|
||||
T1_Init_Decoder( &decoder );
|
||||
T1_Init_Builder( &decoder.builder, face, size, glyph );
|
||||
|
||||
|
||||
decoder.builder.no_recurse = (FT_Bool)!!(load_flags & FT_LOAD_NO_RECURSE);
|
||||
|
||||
|
||||
/* now load the unscaled outline */
|
||||
error = T1_Parse_CharStrings( &decoder,
|
||||
type1->charstrings [glyph_index],
|
||||
@ -1279,7 +1279,7 @@
|
||||
type1->num_subrs,
|
||||
type1->subrs,
|
||||
type1->subrs_len );
|
||||
|
||||
|
||||
/* save new glyph tables */
|
||||
T1_Done_Builder( &decoder.builder );
|
||||
}
|
||||
@ -1300,29 +1300,29 @@
|
||||
{
|
||||
FT_BBox cbox;
|
||||
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
|
||||
|
||||
|
||||
/* copy the _unscaled_ advance width */
|
||||
metrics->horiAdvance = decoder.builder.advance.x;
|
||||
|
||||
|
||||
/* make up vertical metrics */
|
||||
metrics->vertBearingX = 0;
|
||||
metrics->vertBearingY = 0;
|
||||
metrics->vertAdvance = 0;
|
||||
|
||||
|
||||
glyph->root.format = ft_glyph_format_outline;
|
||||
|
||||
|
||||
glyph->root.outline.flags &= ft_outline_owner;
|
||||
if ( size && size->root.metrics.y_ppem < 24 )
|
||||
glyph->root.outline.flags |= ft_outline_high_precision;
|
||||
|
||||
glyph->root.outline.flags |= ft_outline_reverse_fill;
|
||||
|
||||
|
||||
/*
|
||||
glyph->root.outline.second_pass = TRUE;
|
||||
glyph->root.outline.high_precision = ( size->root.metrics.y_ppem < 24 );
|
||||
glyph->root.outline.dropout_mode = 2;
|
||||
*/
|
||||
|
||||
|
||||
if ( (load_flags & FT_LOAD_NO_SCALE) == 0 )
|
||||
{
|
||||
/* scale the outline and the metrics */
|
||||
@ -1331,7 +1331,7 @@
|
||||
T1_Vector* vec = cur->points;
|
||||
T1_Fixed x_scale = glyph->x_scale;
|
||||
T1_Fixed y_scale = glyph->y_scale;
|
||||
|
||||
|
||||
/* First of all, scale the points */
|
||||
for ( n = cur->n_points; n > 0; n--, vec++ )
|
||||
{
|
||||
@ -1340,10 +1340,10 @@
|
||||
}
|
||||
|
||||
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
|
||||
|
||||
|
||||
/* Then scale the metrics */
|
||||
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
|
||||
|
||||
|
||||
metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
|
||||
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
|
||||
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, x_scale );
|
||||
@ -1351,7 +1351,7 @@
|
||||
|
||||
/* compute the other metrics */
|
||||
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
|
||||
|
||||
|
||||
/* grid fit the bounding box if necessary */
|
||||
if (hinting)
|
||||
{
|
||||
|
@ -108,10 +108,10 @@
|
||||
T1_Bool path_begun;
|
||||
T1_Bool load_points;
|
||||
T1_Bool no_recurse;
|
||||
|
||||
|
||||
T1_Error error; /* only used for memory errors */
|
||||
T1_Bool metrics_only;
|
||||
|
||||
|
||||
} T1_Builder;
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1load.h 2.0
|
||||
*
|
||||
* Type1 Loader.
|
||||
* Type1 Loader.
|
||||
*
|
||||
* Copyright 1996-2000 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -32,7 +32,7 @@
|
||||
*
|
||||
* ..... /Field <data> ....
|
||||
*
|
||||
* where <data> can be a number, a boolean, a string, or an
|
||||
* where <data> can be a number, a boolean, a string, or an
|
||||
* array of numbers. There are a few exceptions, namely the
|
||||
* encoding, font name, charstrings and subrs and they are
|
||||
* handled with a special pattern-matching routine.
|
||||
@ -72,17 +72,17 @@
|
||||
|
||||
typedef void (*T1_Parse_Func)( T1_Face face, T1_Loader* loader );
|
||||
|
||||
typedef struct T1_KeyWord_
|
||||
typedef struct T1_KeyWord_
|
||||
{
|
||||
const char* name;
|
||||
T1_Parse_Func parsing;
|
||||
|
||||
|
||||
} T1_KeyWord;
|
||||
|
||||
/* some handy macros used to easily define parsing callback functions */
|
||||
/* each callback is in charge of loading a value and storing it in a */
|
||||
/* given field of the Type 1 face.. */
|
||||
|
||||
|
||||
#define PARSE_(x) static void FT_XCAT(parse_,x) ( T1_Face face, T1_Loader* loader )
|
||||
|
||||
#define FIELD FACE.x
|
||||
@ -98,7 +98,7 @@
|
||||
FACE.x = (t)T1_ToInt(&loader->parser); \
|
||||
FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \
|
||||
}
|
||||
|
||||
|
||||
#define PARSE_INT(s,x) PARSE_(x) \
|
||||
{ \
|
||||
FACE.x = T1_ToInt(&loader->parser); \
|
||||
@ -111,19 +111,19 @@
|
||||
FT_TRACE2(( "type1.parse_%s : \"%s\"\n", \
|
||||
#x, FACE.x ? "true" : "false" )); \
|
||||
}
|
||||
|
||||
|
||||
#define PARSE_FIXED(s,x) PARSE_(x) \
|
||||
{ \
|
||||
FACE.x = T1_ToFixed(&loader->parser,3); \
|
||||
FT_TRACE2(( "type1.parse_%s: \"%f\"\n", #x, FACE.x/65536.0 )); \
|
||||
}
|
||||
|
||||
|
||||
#define PARSE_COORDS(s,c,m,x) PARSE_(x) \
|
||||
{ \
|
||||
FACE.c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.x ); \
|
||||
FT_TRACE2(( "type1.parse_%s\n", #x )); \
|
||||
}
|
||||
|
||||
|
||||
#define PARSE_FIXEDS(s,c,m,x) PARSE_(x) \
|
||||
{ \
|
||||
FACE.c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.x, 3 ); \
|
||||
@ -168,49 +168,49 @@
|
||||
void skip_whitespace( T1_Parser* parser )
|
||||
{
|
||||
T1_Byte* cur = parser->cursor;
|
||||
|
||||
|
||||
while ( cur < parser->limit && is_space(*cur) )
|
||||
cur++;
|
||||
|
||||
|
||||
parser->cursor = cur;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void skip_blackspace( T1_Parser* parser )
|
||||
{
|
||||
T1_Byte* cur = parser->cursor;
|
||||
|
||||
|
||||
while ( cur < parser->limit && !is_space(*cur) )
|
||||
cur++;
|
||||
|
||||
|
||||
parser->cursor = cur;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
int read_binary_data( T1_Parser* parser, T1_Int *size, T1_Byte* *base )
|
||||
{
|
||||
T1_Byte* cur;
|
||||
T1_Byte* limit = parser->limit;
|
||||
|
||||
|
||||
/* the binary data has the following format */
|
||||
/* */
|
||||
/* "size" [white*] RD white ....... ND */
|
||||
/* */
|
||||
|
||||
|
||||
skip_whitespace(parser);
|
||||
cur = parser->cursor;
|
||||
|
||||
|
||||
if ( cur < limit && (T1_Byte)(*cur-'0') < 10 )
|
||||
{
|
||||
*size = T1_ToInt(parser);
|
||||
|
||||
|
||||
skip_whitespace(parser);
|
||||
skip_blackspace(parser); /* "RD" or "-|" or something else */
|
||||
|
||||
|
||||
/* there is only one whitespace char after the */
|
||||
/* "RD" or "-|" token */
|
||||
*base = parser->cursor + 1;
|
||||
|
||||
|
||||
parser->cursor += *size+1;
|
||||
return 1;
|
||||
}
|
||||
@ -235,12 +235,12 @@
|
||||
T1_Byte* cur;
|
||||
T1_Byte* cur2;
|
||||
T1_Byte* limit;
|
||||
|
||||
|
||||
skip_whitespace(parser);
|
||||
cur = parser->cursor;
|
||||
limit = parser->limit;
|
||||
if ( cur >= limit-1 || *cur != '/' ) return;
|
||||
|
||||
|
||||
cur++;
|
||||
cur2 = cur;
|
||||
while (cur2 < limit && is_alpha(*cur2)) cur2++;
|
||||
@ -252,7 +252,7 @@
|
||||
parser->error = error;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
MEM_Copy( face->type1.font_name, cur, len );
|
||||
face->type1.font_name[len] = '\0';
|
||||
}
|
||||
@ -265,7 +265,7 @@
|
||||
T1_Parser* parser = &loader->parser;
|
||||
T1_Short temp[4];
|
||||
T1_BBox* bbox = &face->type1.font_bbox;
|
||||
|
||||
|
||||
(void)T1_ToCoordArray( parser, 4, temp );
|
||||
bbox->xMin = temp[0];
|
||||
bbox->yMin = temp[1];
|
||||
@ -279,7 +279,7 @@
|
||||
T1_Parser* parser = &loader->parser;
|
||||
T1_Byte* cur = parser->cursor;
|
||||
T1_Byte* limit = parser->limit;
|
||||
|
||||
|
||||
/* skip whitespace */
|
||||
while (is_space(*cur))
|
||||
{
|
||||
@ -291,7 +291,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* if we have a number, then the encoding is an array, */
|
||||
/* and we must load it now */
|
||||
if ((T1_Byte)(*cur - '0') < 10)
|
||||
@ -301,7 +301,7 @@
|
||||
T1_Table* char_table = &loader->encoding_table;
|
||||
FT_Memory memory = parser->memory;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
/* read the number of entries in the encoding, should be 256 */
|
||||
count = T1_ToInt( parser );
|
||||
if (parser->error) return;
|
||||
@ -315,7 +315,7 @@
|
||||
parser->error = error;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* now, we will need to read a record of the form */
|
||||
/* ... charcode /charname ... for each entry in our table */
|
||||
/* */
|
||||
@ -337,9 +337,9 @@
|
||||
for ( ; cur < limit; )
|
||||
{
|
||||
T1_Byte c;
|
||||
|
||||
|
||||
c = *cur;
|
||||
|
||||
|
||||
/* we stop when we encounter a 'def' */
|
||||
if ( c == 'd' && cur+3 < limit )
|
||||
{
|
||||
@ -352,39 +352,39 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* otherwise, we must find a number before anything else */
|
||||
if ( (T1_Byte)(c-'0') < 10 )
|
||||
{
|
||||
T1_Int charcode;
|
||||
|
||||
|
||||
parser->cursor = cur;
|
||||
charcode = T1_ToInt(parser);
|
||||
cur = parser->cursor;
|
||||
|
||||
|
||||
/* skip whitespace */
|
||||
while (cur < limit && is_space(*cur)) cur++;
|
||||
|
||||
|
||||
if (cur < limit && *cur == '/')
|
||||
{
|
||||
/* bingo, we have an immediate name - it must be a */
|
||||
/* character name */
|
||||
FT_Byte* cur2 = cur+1;
|
||||
T1_Int len;
|
||||
|
||||
|
||||
while (cur2 < limit && is_alpha(*cur2)) cur2++;
|
||||
len = cur2-cur-1;
|
||||
parser->error = T1_Add_Table( char_table, charcode, cur+1, len+1 );
|
||||
char_table->elements[charcode][len] = '\0';
|
||||
if (parser->error) return;
|
||||
|
||||
|
||||
cur = cur2;
|
||||
}
|
||||
}
|
||||
else
|
||||
cur++;
|
||||
}
|
||||
|
||||
|
||||
face->type1.encoding_type = t1_encoding_array;
|
||||
parser->cursor = cur;
|
||||
}
|
||||
@ -395,7 +395,7 @@
|
||||
if ( cur+17 < limit &&
|
||||
strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 )
|
||||
face->type1.encoding_type = t1_encoding_standard;
|
||||
|
||||
|
||||
else if ( cur+15 < limit &&
|
||||
strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 )
|
||||
face->type1.encoding_type = t1_encoding_expert;
|
||||
@ -404,7 +404,7 @@
|
||||
{
|
||||
FT_ERROR(( "type1.parse_encoding: invalid token !!\n" ));
|
||||
parser->error = FT_Err_Invalid_File_Format;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,10 +417,10 @@
|
||||
FT_Memory memory = parser->memory;
|
||||
FT_Error error;
|
||||
T1_Int n;
|
||||
|
||||
loader->num_subrs = T1_ToInt( parser );
|
||||
|
||||
loader->num_subrs = T1_ToInt( parser );
|
||||
if (parser->error) return;
|
||||
|
||||
|
||||
/* initialise subrs array */
|
||||
error = T1_New_Table( table, loader->num_subrs, memory );
|
||||
if (error) goto Fail;
|
||||
@ -429,16 +429,16 @@
|
||||
/* */
|
||||
/* "index" + binary data */
|
||||
/* */
|
||||
|
||||
|
||||
for ( n = 0; n < loader->num_subrs; n++ )
|
||||
{
|
||||
T1_Int index, size;
|
||||
T1_Byte* base;
|
||||
|
||||
|
||||
index = T1_ToInt(parser);
|
||||
if (!read_binary_data(parser,&size,&base)) return;
|
||||
|
||||
T1_Decrypt( base, size, 4330 );
|
||||
|
||||
T1_Decrypt( base, size, 4330 );
|
||||
size -= face->type1.private_dict.lenIV;
|
||||
base += face->type1.private_dict.lenIV;
|
||||
|
||||
@ -466,21 +466,21 @@
|
||||
T1_Byte* cur;
|
||||
T1_Byte* limit = parser->limit;
|
||||
T1_Int n;
|
||||
|
||||
loader->num_glyphs = T1_ToInt( parser );
|
||||
|
||||
loader->num_glyphs = T1_ToInt( parser );
|
||||
if (parser->error) return;
|
||||
|
||||
|
||||
/* initialise tables */
|
||||
error = T1_New_Table( code_table, loader->num_glyphs, memory ) ||
|
||||
T1_New_Table( name_table, loader->num_glyphs, memory );
|
||||
if (error) goto Fail;
|
||||
|
||||
|
||||
n = 0;
|
||||
for ( ;; )
|
||||
{
|
||||
T1_Int size;
|
||||
T1_Byte* base;
|
||||
|
||||
|
||||
/* the format is simple : */
|
||||
/* "/glyphname" + binary data */
|
||||
/* */
|
||||
@ -491,7 +491,7 @@
|
||||
if (cur >= limit) break;
|
||||
|
||||
/* we stop when we find a "def" or "end" keyword */
|
||||
if (*cur == 'd' &&
|
||||
if (*cur == 'd' &&
|
||||
cur+3 < limit &&
|
||||
cur[1] == 'e' &&
|
||||
cur[2] == 'f' )
|
||||
@ -509,26 +509,26 @@
|
||||
{
|
||||
T1_Byte* cur2 = cur+1;
|
||||
T1_Int len;
|
||||
|
||||
|
||||
while (cur2 < limit && is_alpha(*cur2)) cur2++;
|
||||
len = cur2-cur-1;
|
||||
|
||||
|
||||
error = T1_Add_Table( name_table, n, cur+1, len+1 );
|
||||
if (error) goto Fail;
|
||||
|
||||
|
||||
/* add a trailing zero to the name table */
|
||||
name_table->elements[n][len] = '\0';
|
||||
|
||||
parser->cursor = cur2;
|
||||
|
||||
parser->cursor = cur2;
|
||||
if (!read_binary_data(parser,&size,&base)) return;
|
||||
|
||||
T1_Decrypt( base, size, 4330 );
|
||||
T1_Decrypt( base, size, 4330 );
|
||||
size -= face->type1.private_dict.lenIV;
|
||||
base += face->type1.private_dict.lenIV;
|
||||
|
||||
error = T1_Add_Table( code_table, n, base, size );
|
||||
if (error) goto Fail;
|
||||
|
||||
|
||||
n++;
|
||||
if (n >= loader->num_glyphs)
|
||||
break;
|
||||
@ -536,7 +536,7 @@
|
||||
}
|
||||
loader->num_glyphs = n;
|
||||
return;
|
||||
|
||||
|
||||
Fail:
|
||||
parser->error = error;
|
||||
}
|
||||
@ -586,15 +586,15 @@
|
||||
T1_Long size )
|
||||
{
|
||||
T1_Parser* parser = &loader->parser;
|
||||
|
||||
|
||||
parser->cursor = base;
|
||||
parser->limit = base + size;
|
||||
parser->error = 0;
|
||||
|
||||
|
||||
{
|
||||
T1_Byte* cur = base;
|
||||
T1_Byte* limit = cur + size;
|
||||
|
||||
|
||||
for ( ;cur < limit; cur++ )
|
||||
{
|
||||
/* look for immediates */
|
||||
@ -602,21 +602,21 @@
|
||||
{
|
||||
T1_Byte* cur2;
|
||||
T1_Int len;
|
||||
|
||||
|
||||
cur ++;
|
||||
cur2 = cur;
|
||||
while (cur2 < limit && is_alpha(*cur2)) cur2++;
|
||||
len = cur2-cur;
|
||||
|
||||
|
||||
if (len > 0 && len < 20)
|
||||
{
|
||||
/* now, compare the immediate name to the keyword table */
|
||||
T1_KeyWord* keyword = (T1_KeyWord*)t1_keywords;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
T1_Byte* name;
|
||||
|
||||
|
||||
name = (T1_Byte*)keyword->name;
|
||||
if (!name) break;
|
||||
|
||||
@ -627,7 +627,7 @@
|
||||
for ( n = 1; n < len; n++ )
|
||||
if (cur[n] != name[n])
|
||||
break;
|
||||
|
||||
|
||||
if (n >= len)
|
||||
{
|
||||
/* we found it - run the parsing callback !! */
|
||||
@ -654,29 +654,29 @@
|
||||
void t1_init_loader( T1_Loader* loader, T1_Face face )
|
||||
{
|
||||
UNUSED(face);
|
||||
|
||||
|
||||
MEM_Set( loader, 0, sizeof(*loader) );
|
||||
loader->num_glyphs = 0;
|
||||
loader->num_chars = 0;
|
||||
|
||||
/* initialize the tables - simply set their 'init' field to 0 */
|
||||
/* initialize the tables - simply set their 'init' field to 0 */
|
||||
loader->encoding_table.init = 0;
|
||||
loader->charstrings.init = 0;
|
||||
loader->glyph_names.init = 0;
|
||||
loader->subrs.init = 0;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void t1_done_loader( T1_Loader* loader )
|
||||
{
|
||||
T1_Parser* parser = &loader->parser;
|
||||
|
||||
|
||||
/* finalize tables */
|
||||
T1_Release_Table( &loader->encoding_table );
|
||||
T1_Release_Table( &loader->charstrings );
|
||||
T1_Release_Table( &loader->glyph_names );
|
||||
T1_Release_Table( &loader->subrs );
|
||||
|
||||
|
||||
/* finalize parser */
|
||||
T1_Done_Parser( parser );
|
||||
}
|
||||
@ -693,47 +693,47 @@
|
||||
|
||||
/* default lenIV */
|
||||
type1->private_dict.lenIV = 4;
|
||||
|
||||
|
||||
parser = &loader.parser;
|
||||
error = T1_New_Parser( parser, face->root.stream, face->root.memory );
|
||||
if (error) goto Exit;
|
||||
|
||||
error = parse_dict( face, &loader, parser->base_dict, parser->base_len );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
error = T1_Get_Private_Dict( parser );
|
||||
if (error) goto Exit;
|
||||
|
||||
|
||||
error = parse_dict( face, &loader, parser->private_dict, parser->private_len );
|
||||
if (error) goto Exit;
|
||||
if (error) goto Exit;
|
||||
|
||||
/* now, propagate the subrs, charstrings and glyphnames tables */
|
||||
/* to the Type1 data */
|
||||
type1->num_glyphs = loader.num_glyphs;
|
||||
|
||||
|
||||
if ( !loader.subrs.init )
|
||||
{
|
||||
FT_ERROR(( "T1.Open_Face: no subrs array in face !!\n" ));
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
}
|
||||
|
||||
|
||||
if ( !loader.charstrings.init )
|
||||
{
|
||||
FT_ERROR(( "T1.Open_Face: no charstrings array in face !!\n" ));
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
}
|
||||
|
||||
|
||||
loader.subrs.init = 0;
|
||||
type1->num_subrs = loader.num_subrs;
|
||||
type1->subrs_block = loader.subrs.block;
|
||||
type1->subrs = loader.subrs.elements;
|
||||
type1->subrs_len = loader.subrs.lengths;
|
||||
|
||||
|
||||
loader.charstrings.init = 0;
|
||||
type1->charstrings_block = loader.charstrings.block;
|
||||
type1->charstrings = loader.charstrings.elements;
|
||||
type1->charstrings_len = loader.charstrings.lengths;
|
||||
|
||||
|
||||
/* we copy the glyph names "block" and "elements" fields */
|
||||
/* but the "lengths" field must be released later.. */
|
||||
type1->glyph_names_block = loader.glyph_names.block;
|
||||
@ -753,16 +753,16 @@
|
||||
/* table, lookup the index of the glyph having the same name */
|
||||
/* the index is then stored in type1.encoding.char_index, and */
|
||||
/* a the name to type1.encoding.char_name */
|
||||
|
||||
|
||||
min_char = +32000;
|
||||
max_char = -32000;
|
||||
|
||||
|
||||
charcode = 0;
|
||||
for ( ; charcode < loader.encoding_table.num_elems; charcode++ )
|
||||
{
|
||||
type1->encoding.char_index[charcode] = 0;
|
||||
type1->encoding.char_name [charcode] = ".notdef";
|
||||
|
||||
|
||||
char_name = loader.encoding_table.elements[charcode];
|
||||
if (char_name)
|
||||
for ( index = 0; index < type1->num_glyphs; index++ )
|
||||
@ -773,7 +773,7 @@
|
||||
{
|
||||
type1->encoding.char_index[charcode] = index;
|
||||
type1->encoding.char_name [charcode] = (char*)glyph_name;
|
||||
|
||||
|
||||
if (charcode < min_char) min_char = charcode;
|
||||
if (charcode > max_char) max_char = charcode;
|
||||
break;
|
||||
@ -784,8 +784,8 @@
|
||||
type1->encoding.code_last = max_char;
|
||||
type1->encoding.num_chars = loader.num_chars;
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
t1_done_loader( &loader );
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1load.h 2.0
|
||||
*
|
||||
* Type1 Loader.
|
||||
* Type1 Loader.
|
||||
*
|
||||
* Copyright 1996-2000 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -32,14 +32,14 @@
|
||||
T1_Int num_chars; /* number of characters in encoding */
|
||||
T1_Table encoding_table; /* T1_Table used to store the */
|
||||
/* encoding character names */
|
||||
|
||||
T1_Int num_glyphs;
|
||||
|
||||
T1_Int num_glyphs;
|
||||
T1_Table glyph_names;
|
||||
T1_Table charstrings;
|
||||
|
||||
|
||||
T1_Int num_subrs;
|
||||
T1_Table subrs;
|
||||
|
||||
|
||||
} T1_Loader;
|
||||
|
||||
LOCAL_DEF
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1objs.c 1.0
|
||||
*
|
||||
* Type1 Objects manager.
|
||||
* Type1 Objects manager.
|
||||
*
|
||||
* Copyright 1996-1998 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -97,7 +97,7 @@
|
||||
* Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
T1_Error T1_Reset_Size( T1_Size size )
|
||||
{
|
||||
@ -124,7 +124,7 @@
|
||||
* face :: typeless pointer to the face object to destroy
|
||||
*
|
||||
* <Return>
|
||||
* Error code.
|
||||
* Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
@ -138,10 +138,10 @@
|
||||
{
|
||||
memory = face->root.memory;
|
||||
|
||||
/* release font info strings */
|
||||
/* release font info strings */
|
||||
{
|
||||
T1_FontInfo* info = &type1->font_info;
|
||||
|
||||
|
||||
FREE( info->version );
|
||||
FREE( info->notice );
|
||||
FREE( info->full_name );
|
||||
@ -149,21 +149,21 @@
|
||||
FREE( info->weight );
|
||||
}
|
||||
|
||||
/* release top dictionary */
|
||||
/* release top dictionary */
|
||||
FREE( type1->charstrings_len );
|
||||
FREE( type1->charstrings );
|
||||
FREE( type1->glyph_names );
|
||||
|
||||
FREE( type1->subrs );
|
||||
FREE( type1->subrs_len );
|
||||
|
||||
|
||||
FREE( type1->subrs_block );
|
||||
FREE( type1->charstrings_block );
|
||||
FREE( type1->glyph_names_block );
|
||||
|
||||
FREE( type1->encoding.char_index );
|
||||
FREE( type1->font_name );
|
||||
|
||||
|
||||
#ifndef T1_CONFIG_OPTION_NO_AFM
|
||||
/* release afm data if present */
|
||||
if ( face->afm_data)
|
||||
@ -217,7 +217,7 @@
|
||||
{
|
||||
/* look-up the PSNames driver */
|
||||
FT_Driver psnames_driver;
|
||||
|
||||
|
||||
psnames_driver = FT_Get_Driver( face->root.driver->library, "psnames" );
|
||||
if (psnames_driver)
|
||||
face->psnames = (PSNames_Interface*)
|
||||
@ -246,15 +246,15 @@
|
||||
/* Now set up root face fields */
|
||||
{
|
||||
FT_Face root = (FT_Face)&face->root;
|
||||
|
||||
|
||||
root->num_glyphs = face->type1.num_glyphs;
|
||||
root->num_charmaps = 1;
|
||||
|
||||
|
||||
root->face_index = face_index;
|
||||
root->face_flags = FT_FACE_FLAG_SCALABLE;
|
||||
|
||||
|
||||
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
|
||||
|
||||
|
||||
if ( face->type1.font_info.is_fixed_pitch )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
@ -267,13 +267,13 @@
|
||||
{
|
||||
char* full = face->type1.font_info.full_name;
|
||||
char* family = root->family_name;
|
||||
|
||||
|
||||
while ( *family && *full == *family )
|
||||
{
|
||||
family++;
|
||||
full++;
|
||||
}
|
||||
|
||||
|
||||
root->style_name = ( *full == ' ' ? full+1 : "Regular" );
|
||||
}
|
||||
else
|
||||
@ -285,17 +285,17 @@
|
||||
root->style_name = "Regular";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* no embedded bitmap support */
|
||||
root->num_fixed_sizes = 0;
|
||||
root->available_sizes = 0;
|
||||
|
||||
|
||||
root->bbox = face->type1.font_bbox;
|
||||
root->units_per_EM = 1000;
|
||||
root->ascender = (T1_Short)face->type1.font_bbox.yMax;
|
||||
root->descender = -(T1_Short)face->type1.font_bbox.yMin;
|
||||
root->height = ((root->ascender + root->descender)*12)/10;
|
||||
|
||||
|
||||
/* now compute the maximum advance width */
|
||||
|
||||
root->max_advance_width = face->type1.private_dict.standard_width;
|
||||
@ -315,10 +315,10 @@
|
||||
}
|
||||
|
||||
root->max_advance_height = root->height;
|
||||
|
||||
|
||||
root->underline_position = face->type1.font_info.underline_position;
|
||||
root->underline_thickness = face->type1.font_info.underline_thickness;
|
||||
|
||||
|
||||
root->max_points = 0;
|
||||
root->max_contours = 0;
|
||||
}
|
||||
@ -349,7 +349,7 @@
|
||||
charmap->encoding_id = 1;
|
||||
charmap++;
|
||||
}
|
||||
|
||||
|
||||
/* simply clear the error in case of failure (which really) */
|
||||
/* means that out of memory or no unicode glyph names */
|
||||
error = 0;
|
||||
@ -359,25 +359,25 @@
|
||||
/* now, support either the standard, expert, or custom encodings */
|
||||
charmap->face = (FT_Face)face;
|
||||
charmap->platform_id = 7; /* a new platform id for Adobe fonts ?? */
|
||||
|
||||
|
||||
switch (face->type1.encoding_type)
|
||||
{
|
||||
case t1_encoding_standard:
|
||||
charmap->encoding = ft_encoding_adobe_standard;
|
||||
charmap->encoding_id = 0;
|
||||
break;
|
||||
|
||||
|
||||
case t1_encoding_expert:
|
||||
charmap->encoding = ft_encoding_adobe_expert;
|
||||
charmap->encoding_id = 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
charmap->encoding = ft_encoding_adobe_custom;
|
||||
charmap->encoding_id = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
root->charmaps = face->charmaps;
|
||||
root->num_charmaps = charmap - face->charmaprecs + 1;
|
||||
face->charmaps[0] = &face->charmaprecs[0];
|
||||
@ -396,7 +396,7 @@
|
||||
*
|
||||
* Input : _glyph typeless pointer to the glyph record to destroy
|
||||
*
|
||||
* Output : Error code.
|
||||
* Output : Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
@ -420,7 +420,7 @@
|
||||
* Description : The glyph object constructor.
|
||||
*
|
||||
* Input : glyph glyph record to build.
|
||||
* face the glyph's parent face.
|
||||
* face the glyph's parent face.
|
||||
*
|
||||
* Output : Error code.
|
||||
*
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* t1objs.h 1.0
|
||||
*
|
||||
* Type1 objects definition.
|
||||
* Type1 objects definition.
|
||||
*
|
||||
* Copyright 1996-1999 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
@ -82,7 +82,7 @@
|
||||
/* NOW BEGINS THE TYPE1 SPECIFIC STUFF .............................. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
|
||||
/***************************************************/
|
||||
/* */
|
||||
@ -90,7 +90,7 @@
|
||||
/* */
|
||||
/* Type 1 size record.. */
|
||||
/* */
|
||||
|
||||
|
||||
typedef struct T1_SizeRec_
|
||||
{
|
||||
FT_SizeRec root;
|
||||
@ -109,14 +109,14 @@
|
||||
/* */
|
||||
/* TrueDoc glyph record.. */
|
||||
/* */
|
||||
|
||||
|
||||
typedef struct T1_GlyphSlotRec_
|
||||
{
|
||||
FT_GlyphSlotRec root;
|
||||
|
||||
T1_Bool hint;
|
||||
T1_Bool scaled;
|
||||
|
||||
|
||||
T1_Int max_points;
|
||||
T1_Int max_contours;
|
||||
|
||||
@ -250,7 +250,7 @@
|
||||
*
|
||||
* <Input> glyph :: handle to glyph slot object
|
||||
*
|
||||
* <Output> Error code.
|
||||
* <Output> Error code.
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
* See "t1load.c" to see how data is loaded from the font file
|
||||
*
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#include <freetype/internal/ftdebug.h>
|
||||
#include <freetype/internal/ftcalc.h>
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
Exit:
|
||||
if (error) FREE(table->elements);
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
T1_Long delta = table->block - old_base;
|
||||
T1_Byte** offset = table->elements;
|
||||
T1_Byte** limit = offset + table->max_elems;
|
||||
|
||||
|
||||
if (delta)
|
||||
for ( ; offset < limit; offset++ )
|
||||
{
|
||||
@ -113,7 +113,7 @@
|
||||
offset[0] += delta;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
T1_Error reallocate_t1_table( T1_Table* table,
|
||||
T1_Int new_size )
|
||||
@ -121,17 +121,17 @@
|
||||
FT_Memory memory = table->memory;
|
||||
T1_Byte* old_base = table->block;
|
||||
T1_Error error;
|
||||
|
||||
|
||||
/* realloc the base block */
|
||||
if ( REALLOC( table->block, table->capacity, new_size ) )
|
||||
return error;
|
||||
|
||||
|
||||
table->capacity = new_size;
|
||||
|
||||
|
||||
/* shift all offsets when needed */
|
||||
if (old_base)
|
||||
shift_elements( table, old_base );
|
||||
|
||||
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
@ -198,10 +198,10 @@
|
||||
old_base = table->block;
|
||||
if (!old_base)
|
||||
return;
|
||||
|
||||
|
||||
(void)REALLOC( table->block, table->capacity, table->cursor );
|
||||
table->capacity = table->cursor;
|
||||
|
||||
|
||||
if (old_base != table->block)
|
||||
shift_elements( table, old_base );
|
||||
}
|
||||
@ -211,7 +211,7 @@
|
||||
void T1_Release_Table( T1_Table* table )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
|
||||
|
||||
if (table->init == (FT_Long)0xdeadbeef)
|
||||
{
|
||||
FREE( table->block );
|
||||
@ -228,20 +228,20 @@
|
||||
T1_Long result = 0;
|
||||
T1_Byte* cur = *cursor;
|
||||
T1_Byte c, d;
|
||||
|
||||
|
||||
for (; cur < limit; cur++)
|
||||
{
|
||||
c = *cur;
|
||||
d = (T1_Byte)(c - '0');
|
||||
if (d < 10) break;
|
||||
|
||||
|
||||
if ( c=='-' )
|
||||
{
|
||||
cur++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (cur < limit)
|
||||
{
|
||||
do
|
||||
@ -249,16 +249,16 @@
|
||||
d = (T1_Byte)(cur[0] - '0');
|
||||
if (d >= 10)
|
||||
break;
|
||||
|
||||
|
||||
result = result*10 + d;
|
||||
cur++;
|
||||
|
||||
|
||||
} while (cur < limit);
|
||||
|
||||
|
||||
if (c == '-')
|
||||
result = -result;
|
||||
}
|
||||
|
||||
|
||||
*cursor = cur;
|
||||
return result;
|
||||
}
|
||||
@ -273,26 +273,26 @@
|
||||
T1_Long num, divider, result;
|
||||
T1_Int sign = 0;
|
||||
T1_Byte d;
|
||||
|
||||
|
||||
if (cur >= limit) return 0;
|
||||
|
||||
|
||||
/* first of all, read the integer part */
|
||||
result = t1_toint( &cur, limit ) << 16;
|
||||
num = 0;
|
||||
divider = 1;
|
||||
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
sign = 1;
|
||||
result = -result;
|
||||
}
|
||||
if (cur >= limit) goto Exit;
|
||||
|
||||
|
||||
/* read decimal part, if any */
|
||||
if (*cur == '.' && cur+1 < limit)
|
||||
{
|
||||
cur++;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
d = (T1_Byte)(*cur - '0');
|
||||
@ -307,14 +307,14 @@
|
||||
if (cur >= limit) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* read exponent, if any */
|
||||
if ( cur+1 < limit && (*cur == 'e' || *cur == 'E'))
|
||||
{
|
||||
cur++;
|
||||
power_ten += t1_toint( &cur, limit );
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
/* raise to power of ten if needed */
|
||||
while (power_ten > 0)
|
||||
@ -323,7 +323,7 @@
|
||||
num = num*10;
|
||||
power_ten--;
|
||||
}
|
||||
|
||||
|
||||
while (power_ten < 0)
|
||||
{
|
||||
result = result/10;
|
||||
@ -336,7 +336,7 @@
|
||||
|
||||
if (sign)
|
||||
result = -result;
|
||||
|
||||
|
||||
*cursor = cur;
|
||||
return result;
|
||||
}
|
||||
@ -351,19 +351,19 @@
|
||||
T1_Byte* cur = *cursor;
|
||||
T1_Int count = 0;
|
||||
T1_Byte c, ender;
|
||||
|
||||
|
||||
if (cur >= limit) goto Exit;
|
||||
|
||||
|
||||
/* check for the beginning of an array. If not, only one number will be read */
|
||||
c = *cur;
|
||||
ender = 0;
|
||||
|
||||
|
||||
if (c == '[')
|
||||
ender = ']';
|
||||
|
||||
|
||||
if (c == '{')
|
||||
ender = '}';
|
||||
|
||||
|
||||
if (ender)
|
||||
cur++;
|
||||
|
||||
@ -375,21 +375,21 @@
|
||||
{
|
||||
c = *cur;
|
||||
if ( c != ' ' && c != '\t' ) break;
|
||||
|
||||
|
||||
cur++;
|
||||
if (cur >= limit) goto Exit;
|
||||
}
|
||||
|
||||
|
||||
if (count >= max_coords || c == ender)
|
||||
break;
|
||||
|
||||
|
||||
coords[count] = (T1_Short)(t1_tofixed(&cur,limit,0) >> 16);
|
||||
count++;
|
||||
|
||||
|
||||
if (!ender)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
*cursor = cur;
|
||||
return count;
|
||||
@ -399,7 +399,7 @@
|
||||
|
||||
static
|
||||
T1_Int t1_tofixedarray( T1_Byte* *cursor,
|
||||
T1_Byte* limit,
|
||||
T1_Byte* limit,
|
||||
T1_Int max_values,
|
||||
T1_Fixed* values,
|
||||
T1_Int power_ten )
|
||||
@ -407,19 +407,19 @@
|
||||
T1_Byte* cur = *cursor;
|
||||
T1_Int count = 0;
|
||||
T1_Byte c, ender;
|
||||
|
||||
|
||||
if (cur >= limit) goto Exit;
|
||||
|
||||
|
||||
/* check for the beginning of an array. If not, only one number will be read */
|
||||
c = *cur;
|
||||
ender = 0;
|
||||
|
||||
|
||||
if (c == '[')
|
||||
ender = ']';
|
||||
|
||||
|
||||
if (c == '{')
|
||||
ender = '}';
|
||||
|
||||
|
||||
if (ender)
|
||||
cur++;
|
||||
|
||||
@ -431,21 +431,21 @@
|
||||
{
|
||||
c = *cur;
|
||||
if ( c != ' ' && c != '\t' ) break;
|
||||
|
||||
|
||||
cur++;
|
||||
if (cur >= limit) goto Exit;
|
||||
}
|
||||
|
||||
if (count >= max_values || c == ender)
|
||||
break;
|
||||
|
||||
|
||||
values[count] = t1_tofixed(&cur,limit,power_ten);
|
||||
count++;
|
||||
|
||||
|
||||
if (!ender)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
*cursor = cur;
|
||||
return count;
|
||||
@ -472,18 +472,18 @@
|
||||
|
||||
while ( cur < limit && (*cur == ' ' || *cur == '\t')) cur++;
|
||||
if (cur+1 >= limit) return 0;
|
||||
|
||||
|
||||
if (*cur == '(') cur++; /* skip the opening parenthesis, if there is one */
|
||||
|
||||
|
||||
*cursor = cur;
|
||||
count = 0;
|
||||
|
||||
|
||||
/* then, count its length */
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
if (*cur == '(')
|
||||
count++;
|
||||
|
||||
|
||||
else if (*cur == ')')
|
||||
{
|
||||
count--;
|
||||
@ -492,14 +492,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
len = cur - *cursor;
|
||||
len = cur - *cursor;
|
||||
if (cur >= limit || ALLOC(result,len+1)) return 0;
|
||||
|
||||
|
||||
/* now copy the string */
|
||||
MEM_Copy( result, *cursor, len );
|
||||
result[len] = '\0';
|
||||
*cursor = cur;
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
@ -507,7 +507,7 @@
|
||||
{
|
||||
T1_Byte* cur = *cursor;
|
||||
T1_Bool result = 0;
|
||||
|
||||
|
||||
/* return 1 if we find a "true", 0 otherwise */
|
||||
if ( cur+3 < limit &&
|
||||
cur[0] == 't' &&
|
||||
@ -583,21 +583,21 @@
|
||||
FT_Error read_pfb_tag( FT_Stream stream, T1_UShort *tag, T1_Long* size )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
|
||||
if (READ_UShort(*tag)) goto Exit;
|
||||
if (*tag == 0x8001 || *tag == 0x8002)
|
||||
{
|
||||
FT_Long asize;
|
||||
|
||||
|
||||
if (READ_ULong(asize)) goto Exit;
|
||||
|
||||
|
||||
/* swap between big and little endianness */
|
||||
*size = ((asize & 0xFF000000) >> 24) |
|
||||
((asize & 0x00FF0000) >> 8 ) |
|
||||
((asize & 0x0000FF00) << 8 ) |
|
||||
((asize & 0x000000FF) << 24);
|
||||
}
|
||||
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
@ -612,7 +612,7 @@
|
||||
FT_Error error;
|
||||
T1_UShort tag;
|
||||
T1_Long size;
|
||||
|
||||
|
||||
parser->stream = stream;
|
||||
parser->memory = memory;
|
||||
parser->base_len = 0;
|
||||
@ -622,10 +622,10 @@
|
||||
parser->in_pfb = 0;
|
||||
parser->in_memory = 0;
|
||||
parser->single_block = 0;
|
||||
|
||||
|
||||
parser->cursor = 0;
|
||||
parser->limit = 0;
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* */
|
||||
/* Here's a short summary of what is going on : */
|
||||
@ -641,12 +641,12 @@
|
||||
/* parser->in_pfb is set when we are in a binary (".pfb") font */
|
||||
/* parser->in_memory is set when we have a memory stream. */
|
||||
/* */
|
||||
|
||||
|
||||
/* try to compute the size of the base dictionary */
|
||||
/* look for a Postscript binary file tag, i.e 0x8001 */
|
||||
if ( FILE_Seek(0L) )
|
||||
goto Exit;
|
||||
|
||||
|
||||
error = read_pfb_tag( stream, &tag, &size );
|
||||
if (error) goto Exit;
|
||||
|
||||
@ -662,14 +662,14 @@
|
||||
|
||||
/* now, try to load the "size" bytes of the "base" dictionary we */
|
||||
/* found previously */
|
||||
|
||||
|
||||
/* if it's a memory-based resource, set up pointers */
|
||||
if ( !stream->read )
|
||||
{
|
||||
parser->base_dict = (T1_Byte*)stream->base + stream->pos;
|
||||
parser->base_len = size;
|
||||
parser->in_memory = 1;
|
||||
|
||||
|
||||
/* check that the "size" field is valid */
|
||||
if ( FILE_Skip(size) ) goto Exit;
|
||||
}
|
||||
@ -681,7 +681,7 @@
|
||||
goto Exit;
|
||||
parser->base_len = size;
|
||||
}
|
||||
|
||||
|
||||
/* Now check font format, we must see a '%!PS-AdobeFont-1' */
|
||||
/* or a '%!FontType' */
|
||||
{
|
||||
@ -764,7 +764,7 @@
|
||||
FT_Memory memory = parser->memory;
|
||||
FT_Error error = 0;
|
||||
T1_Long size;
|
||||
|
||||
|
||||
if (parser->in_pfb)
|
||||
{
|
||||
/* in the case of the PFB format, the private dictionary can be */
|
||||
@ -775,15 +775,15 @@
|
||||
T1_UShort tag;
|
||||
T1_Long size;
|
||||
|
||||
parser->private_len = 0;
|
||||
parser->private_len = 0;
|
||||
for (;;)
|
||||
{
|
||||
error = read_pfb_tag(stream, &tag, &size);
|
||||
if (error) goto Fail;
|
||||
|
||||
|
||||
if (tag != 0x8002)
|
||||
break;
|
||||
|
||||
|
||||
parser->private_len += size;
|
||||
|
||||
if ( FILE_Skip(size) )
|
||||
@ -824,9 +824,9 @@
|
||||
|
||||
/* first of all, look at the "eexec" keyword */
|
||||
FT_Byte* cur = parser->base_dict;
|
||||
FT_Byte* limit = cur + parser->base_len;
|
||||
FT_Byte* limit = cur + parser->base_len;
|
||||
FT_Byte c;
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = cur[0];
|
||||
@ -836,12 +836,12 @@
|
||||
cur[3] == 'e' && cur[4] == 'c' )
|
||||
{
|
||||
cur += 6; /* we skip the newling after the "eexec" */
|
||||
|
||||
|
||||
/* XXX: Some fonts use DOS-linefeeds, i.e. \r\n, we need to skip */
|
||||
/* the extra \n when we find it.. */
|
||||
if (cur[0] == '\n')
|
||||
cur++;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -853,13 +853,13 @@
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now determine wether where to write the _encrypted_ binary private */
|
||||
/* dictionary. We overwrite the base dictionary for disk-based resources */
|
||||
/* and allocate a new block otherwise */
|
||||
|
||||
size = parser->base_len - (cur-parser->base_dict);
|
||||
|
||||
|
||||
size = parser->base_len - (cur-parser->base_dict);
|
||||
|
||||
if ( parser->in_memory )
|
||||
{
|
||||
/* note that we allocate one more byte to put a terminating '0' */
|
||||
@ -868,13 +868,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->single_block = 1;
|
||||
parser->single_block = 1;
|
||||
parser->private_dict = parser->base_dict;
|
||||
parser->private_len = size;
|
||||
parser->base_dict = 0;
|
||||
parser->base_len = 0;
|
||||
}
|
||||
|
||||
|
||||
/* now determine wether the private dictionary is encoded in binary */
|
||||
/* or hexadecimal ASCII format.. */
|
||||
/* and decode it accordingly */
|
||||
@ -890,40 +890,40 @@
|
||||
MEM_Copy( parser->private_dict, cur, size );
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
/* ASCII hexadecimal encoding.. This blows goats !!.. */
|
||||
|
||||
|
||||
T1_Byte* write;
|
||||
T1_Int count;
|
||||
|
||||
write = parser->private_dict;
|
||||
count = 0;
|
||||
|
||||
|
||||
for ( ;cur < limit; cur++)
|
||||
{
|
||||
int hex1;
|
||||
|
||||
|
||||
/* check for newline */
|
||||
if (cur[0] == '\r' || cur[0] == '\n')
|
||||
continue;
|
||||
|
||||
|
||||
/* exit if we have a non-hexadecimal digit that isn't a newline */
|
||||
hex1 = hexa_value(cur[0]);
|
||||
if (hex1 < 0 || cur+1 >= limit)
|
||||
break;
|
||||
|
||||
|
||||
/* otherwise, store byte */
|
||||
*write++ = (hex1 << 4) | hexa_value(cur[1]);
|
||||
count++;
|
||||
cur++;
|
||||
}
|
||||
|
||||
|
||||
/* put a safeguard */
|
||||
parser->private_len = write - parser->private_dict;
|
||||
*write++ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* we now decrypt the encoded binary private dictionary */
|
||||
T1_Decrypt( parser->private_dict, parser->private_len, 55665 );
|
||||
parser->cursor = parser->private_dict;
|
||||
@ -933,4 +933,4 @@
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user