simple renaming of directories:

"type1z"  -> "type1"
  "raster1" -> "raster"

note that I didn't rename all files. We'll have to endure
the "z1..." crazyness unless we perform a _big_ sed on
the sources :-)
This commit is contained in:
David Turner 2000-10-26 00:30:33 +00:00
parent 782cadcacb
commit ab88a56eed
25 changed files with 3780 additions and 88 deletions

3293
src/raster/ftraster.c Normal file

File diff suppressed because it is too large Load Diff

50
src/raster/ftraster.h Normal file
View File

@ -0,0 +1,50 @@
/***************************************************************************/
/* */
/* ftraster.h */
/* */
/* The FreeType glyph rasterizer (specification). */
/* */
/* Copyright 1996-2000 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. */
/* */
/***************************************************************************/
#ifndef FTRASTER_H
#define FTRASTER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <freetype/ftimage.h>
/*************************************************************************/
/* */
/* Uncomment the following line if you are using ftraster.c as a */
/* standalone module, fully independent of FreeType. */
/* */
/* #define _STANDALONE_ */
#ifndef FT_EXPORT_VAR
#define FT_EXPORT_VAR( x ) extern x
#endif
FT_EXPORT_VAR( const FT_Raster_Funcs ) ft_standard_raster;
#ifdef __cplusplus
}
#endif
#endif /* FTRASTER_H */
/* END */

276
src/raster/ftrend1.c Normal file
View File

@ -0,0 +1,276 @@
/***************************************************************************/
/* */
/* ftrend1.c */
/* */
/* The FreeType glyph rasterizer interface (body). */
/* */
/* Copyright 1996-2000 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/internal/ftobjs.h>
#include <freetype/ftoutln.h>
#ifdef FT_FLAT_COMPILE
#include "ftrend1.h"
#include "ftraster.h"
#else
#include <raster/ftrend1.h>
#include <raster/ftraster.h>
#endif
/* initialize renderer -- init its raster */
static
FT_Error ft_raster1_init( FT_Renderer render )
{
FT_Library library = FT_MODULE_LIBRARY( render );
render->clazz->raster_class->raster_reset( render->raster,
library->raster_pool,
library->raster_pool_size );
return FT_Err_Ok;
}
/* set render-specific mode */
static
FT_Error ft_raster1_set_mode( FT_Renderer render,
FT_ULong mode_tag,
FT_Pointer data )
{
/* we simply pass it to the raster */
return render->clazz->raster_class->raster_set_mode( render->raster,
mode_tag,
data );
}
/* transform a given glyph image */
static
FT_Error ft_raster1_transform( FT_Renderer render,
FT_GlyphSlot slot,
FT_Matrix* matrix,
FT_Vector* delta )
{
FT_Error error = FT_Err_Ok;
if ( slot->format != render->glyph_format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
if ( matrix )
FT_Outline_Transform( &slot->outline, matrix );
if ( delta )
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
Exit:
return error;
}
/* return the glyph's control box */
static
void ft_raster1_get_cbox( FT_Renderer render,
FT_GlyphSlot slot,
FT_BBox* cbox )
{
MEM_Set( cbox, 0, sizeof ( *cbox ) );
if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox );
}
/* convert a slot's glyph image into a bitmap */
static
FT_Error ft_raster1_render( FT_Renderer render,
FT_GlyphSlot slot,
FT_UInt mode,
FT_Vector* origin )
{
FT_Error error;
FT_Outline* outline;
FT_BBox cbox;
FT_UInt width, height, pitch;
FT_Bitmap* bitmap;
FT_Memory memory;
FT_Raster_Params params;
/* check glyph image format */
if ( slot->format != render->glyph_format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
/* check rendering mode */
if ( mode != ft_render_mode_mono )
{
/* raster1 is only capable of producing monochrome bitmaps */
if ( render->clazz == &ft_raster1_renderer_class )
return FT_Err_Cannot_Render_Glyph;
}
else
{
/* raster5 is only capable of producing 5-gray-levels bitmaps */
if ( render->clazz == &ft_raster5_renderer_class )
return FT_Err_Cannot_Render_Glyph;
}
outline = &slot->outline;
/* translate the outline to the new origin if needed */
if ( origin )
FT_Outline_Translate( outline, origin->x, origin->y );
/* compute the control box, and grid fit it */
FT_Outline_Get_CBox( 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;
bitmap = &slot->bitmap;
memory = render->root.memory;
/* release old bitmap buffer */
if ( slot->flags & ft_glyph_own_bitmap )
{
FREE( bitmap->buffer );
slot->flags &= ~ft_glyph_own_bitmap;
}
/* allocate new one, depends on pixel format */
if ( !( mode & ft_render_mode_mono ) )
{
/* we pad to 32 bits, only for backwards compatibility with FT 1.x */
pitch = ( width + 3 ) & -4;
bitmap->pixel_mode = ft_pixel_mode_grays;
bitmap->num_grays = 256;
}
else
{
pitch = ( width + 7 ) >> 3;
bitmap->pixel_mode = ft_pixel_mode_mono;
}
bitmap->width = width;
bitmap->rows = height;
bitmap->pitch = pitch;
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit;
slot->flags |= ft_glyph_own_bitmap;
/* translate outline to render it into the bitmap */
FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );
/* set up parameters */
params.target = bitmap;
params.source = outline;
params.flags = 0;
if ( bitmap->pixel_mode == ft_pixel_mode_grays )
params.flags |= ft_raster_flag_aa;
/* render outline into the bitmap */
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
slot->format = ft_glyph_format_bitmap;
slot->bitmap_left = cbox.xMin >> 6;
slot->bitmap_top = cbox.yMax >> 6;
Exit:
return error;
}
FT_CPLUSPLUS( const FT_Renderer_Class ) ft_raster1_renderer_class =
{
{
ft_module_renderer,
sizeof( FT_RendererRec ),
"raster1",
0x10000L,
0x20000L,
0, /* module specific interface */
(FT_Module_Constructor)ft_raster1_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
},
ft_glyph_format_outline,
(FTRenderer_render) ft_raster1_render,
(FTRenderer_transform)ft_raster1_transform,
(FTRenderer_getCBox) ft_raster1_get_cbox,
(FTRenderer_setMode) ft_raster1_set_mode,
(FT_Raster_Funcs*) &ft_standard_raster
};
/* This renderer is _NOT_ part of the default modules; you will need */
/* to register it by hand in your application. It should only be */
/* used for backwards-compatibility with FT 1.x anyway. */
/* */
FT_CPLUSPLUS( const FT_Renderer_Class ) ft_raster5_renderer_class =
{
{
ft_module_renderer,
sizeof( FT_RendererRec ),
"raster5",
0x10000L,
0x20000L,
0, /* module specific interface */
(FT_Module_Constructor)ft_raster1_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
},
ft_glyph_format_outline,
(FTRenderer_render) ft_raster1_render,
(FTRenderer_transform)ft_raster1_transform,
(FTRenderer_getCBox) ft_raster1_get_cbox,
(FTRenderer_setMode) ft_raster1_set_mode,
(FT_Raster_Funcs*) &ft_standard_raster
};
/* END */

48
src/raster/ftrend1.h Normal file
View File

@ -0,0 +1,48 @@
/***************************************************************************/
/* */
/* ftrend1.h */
/* */
/* The FreeType glyph rasterizer interface (specification). */
/* */
/* Copyright 1996-2000 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. */
/* */
/***************************************************************************/
#ifndef FTREND1_H
#define FTREND1_H
#include <freetype/ftrender.h>
#ifdef __cplusplus
extern "C" {
#endif
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster1_renderer_class;
/* this renderer is _NOT_ part of the default modules, you'll need */
/* to register it by hand in your application. It should only be */
/* used for backwards-compatibility with FT 1.x anyway. */
/* */
FT_EXPORT_VAR( const FT_Renderer_Class ) ft_raster5_renderer_class;
#ifdef __cplusplus
}
#endif
#endif /* FTREND1_H */
/* END */

View File

@ -13,10 +13,10 @@
# fully.
make_module_list: add_raster1_module
make_module_list: add_raster_module
add_raster1_module:
add_raster_module:
$(OPEN_DRIVER)ft_raster1_renderer_class$(CLOSE_DRIVER)
$(ECHO_DRIVER)raster1 $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)
$(ECHO_DRIVER)raster $(ECHO_DRIVER_DESC)monochrome bitmap renderer$(ECHO_DRIVER_DONE)
# EOF

35
src/raster/raster.c Normal file
View File

@ -0,0 +1,35 @@
/***************************************************************************/
/* */
/* raster1.c */
/* */
/* FreeType monochrome rasterer module component (body only). */
/* */
/* Copyright 1996-2000 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. */
/* */
/***************************************************************************/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE
#include "ftraster.c"
#include "ftrend1.c"
#else
#include <raster/ftraster.c>
#include <raster/ftrend1.c>
#endif
/* END */

View File

@ -15,7 +15,7 @@
# raster1 driver directory
#
RAS1_DIR := $(SRC_)raster1
RAS1_DIR := $(SRC_)raster
RAS1_DIR_ := $(RAS1_DIR)$(SEP)
# compilation flags for the driver
@ -40,11 +40,11 @@ RAS1_DRV_H := $(RAS1_DRV_SRC:%.c=%.h)
# RAS1_DRV_OBJ_S is used during `single' builds.
#
RAS1_DRV_OBJ_M := $(RAS1_DRV_SRC:$(RAS1_DIR_)%.c=$(OBJ_)%.$O)
RAS1_DRV_OBJ_S := $(OBJ_)raster1.$O
RAS1_DRV_OBJ_S := $(OBJ_)raster.$O
# raster1 driver source file for single build
#
RAS1_DRV_SRC_S := $(RAS1_DIR_)raster1.c
RAS1_DRV_SRC_S := $(RAS1_DIR_)raster.c
# raster1 driver - single object

72
src/type1/rules.mk Normal file
View File

@ -0,0 +1,72 @@
#
# FreeType 2 Type1z driver configuration rules
#
# Copyright 1996-2000 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.
# Type1 driver directory
#
T1_DIR := $(SRC_)type1
T1_DIR_ := $(T1_DIR)$(SEP)
# compilation flags for the driver
#
T1_COMPILE := $(FT_COMPILE)
# Type1 driver sources (i.e., C files)
#
T1_DRV_SRC := $(T1_DIR_)z1parse.c \
$(T1_DIR_)z1load.c \
$(T1_DIR_)z1driver.c \
$(T1_DIR_)z1afm.c \
$(T1_DIR_)z1gload.c \
$(T1_DIR_)z1objs.c
# Type1 driver headers
#
T1_DRV_H := $(T1_DRV_SRC:%.c=%.h) \
$(T1_DIR_)z1tokens.h
# Type1z driver object(s)
#
# T1_DRV_OBJ_M is used during `multi' builds
# T1_DRV_OBJ_S is used during `single' builds
#
T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O)
T1_DRV_OBJ_S := $(OBJ_)type1.$O
# Type1z driver source file for single build
#
T1_DRV_SRC_S := $(T1_DIR_)type1.c
# Type1z driver - single object
#
$(T1_DRV_OBJ_S): $(T1_DRV_SRC_S) $(T1_DRV_SRC) $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $(T1_DRV_SRC_S)
# Type1z driver - multiple objects
#
$(OBJ_)%.$O: $(T1_DIR_)%.c $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $<
# update main driver object lists
#
DRV_OBJS_S += $(T1_DRV_OBJ_S)
DRV_OBJS_M += $(T1_DRV_OBJ_M)
# EOF

View File

@ -1,10 +0,0 @@
This directory contains an experimental Type 1 driver that will ultimately
replace the "official" one in "src/type1".
This driver doesn't provide a mini Postscript interpreter, but uses
pattern matching in order to load data from fonts. It works better and
faster than the official driver, but will replace it only when we finish
the auto-hinting module..
You don't need to compile it to support Type 1 fonts, the driver should
co-exist peacefully with the rest of the engine however..

View File

@ -1,72 +0,0 @@
#
# FreeType 2 Type1z driver configuration rules
#
# Copyright 1996-2000 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.
# Type1z driver directory
#
T1Z_DIR := $(SRC_)type1z
T1Z_DIR_ := $(T1Z_DIR)$(SEP)
# compilation flags for the driver
#
T1Z_COMPILE := $(FT_COMPILE)
# Type1 driver sources (i.e., C files)
#
T1Z_DRV_SRC := $(T1Z_DIR_)z1parse.c \
$(T1Z_DIR_)z1load.c \
$(T1Z_DIR_)z1driver.c \
$(T1Z_DIR_)z1afm.c \
$(T1Z_DIR_)z1gload.c \
$(T1Z_DIR_)z1objs.c
# Type1 driver headers
#
T1Z_DRV_H := $(T1Z_DRV_SRC:%.c=%.h) \
$(T1Z_DIR_)z1tokens.h
# Type1z driver object(s)
#
# T1Z_DRV_OBJ_M is used during `multi' builds
# T1Z_DRV_OBJ_S is used during `single' builds
#
T1Z_DRV_OBJ_M := $(T1Z_DRV_SRC:$(T1Z_DIR_)%.c=$(OBJ_)%.$O)
T1Z_DRV_OBJ_S := $(OBJ_)type1z.$O
# Type1z driver source file for single build
#
T1Z_DRV_SRC_S := $(T1Z_DIR_)type1z.c
# Type1z driver - single object
#
$(T1Z_DRV_OBJ_S): $(T1Z_DRV_SRC_S) $(T1Z_DRV_SRC) $(FREETYPE_H) $(T1Z_DRV_H)
$(T1Z_COMPILE) $T$@ $(T1Z_DRV_SRC_S)
# Type1z driver - multiple objects
#
$(OBJ_)%.$O: $(T1Z_DIR_)%.c $(FREETYPE_H) $(T1Z_DRV_H)
$(T1Z_COMPILE) $T$@ $<
# update main driver object lists
#
DRV_OBJS_S += $(T1Z_DRV_OBJ_S)
DRV_OBJS_M += $(T1Z_DRV_OBJ_M)
# EOF