2000-10-26 02:30:33 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftrend1.c */
|
|
|
|
/* */
|
|
|
|
/* The FreeType glyph rasterizer interface (body). */
|
|
|
|
/* */
|
2017-01-04 20:16:34 +01:00
|
|
|
/* Copyright 1996-2017 by */
|
2000-10-26 02:30:33 +02:00
|
|
|
/* 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
2013-03-14 10:27:35 +01:00
|
|
|
#include FT_INTERNAL_DEBUG_H
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
|
|
|
#include FT_OUTLINE_H
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ftrend1.h"
|
|
|
|
#include "ftraster.h"
|
2009-04-05 17:16:13 +02:00
|
|
|
#include "rastpic.h"
|
2000-10-26 02:30:33 +02:00
|
|
|
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "rasterrs.h"
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-10-26 02:30:33 +02:00
|
|
|
/* initialize renderer -- init its raster */
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
|
|
|
ft_raster1_init( FT_Renderer render )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
|
|
|
FT_Library library = FT_MODULE_LIBRARY( render );
|
|
|
|
|
|
|
|
|
|
|
|
render->clazz->raster_class->raster_reset( render->raster,
|
|
|
|
library->raster_pool,
|
|
|
|
library->raster_pool_size );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-10-26 02:30:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* set render-specific mode */
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
|
|
|
ft_raster1_set_mode( FT_Renderer render,
|
|
|
|
FT_ULong mode_tag,
|
|
|
|
FT_Pointer data )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
|
|
|
/* 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 */
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
* include/freetype/ftimage.h (FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_Render_Func, FT_Renderer_TransformFunc),
src/base/ftglyph.c (ft_outline_glyph_transform),
src/raster/ftrend1.c (ft_raster1_transform, ft_raster1_render),
src/smooth/ftgrays.c (FT_Outline_Decompose, gray_raster_render),
src/smooth/ftsmooth.c (ft_smooth_transform,
ft_smooth_render_generic, ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Decorate parameters with `const' where
appropriate.
* src/raster/ftraster.c (RASTER_RENDER_POOL): Removed. Obsolete.
(ft_black_render): Decorate parameters with `const' where
appropriate.
* src/sfnt/ttcmap.c (tt_cmap4_set_range): Fix typo (FT_PEEK_SHORT ->
FT_PEEK_USHORT) which caused crashes. Reported by Ismail Donmez
<ismail@kde.org.tr>.
2005-05-11 22:04:35 +02:00
|
|
|
ft_raster1_transform( FT_Renderer render,
|
|
|
|
FT_GlyphSlot slot,
|
|
|
|
const FT_Matrix* matrix,
|
|
|
|
const FT_Vector* delta )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( slot->format != render->glyph_format )
|
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Argument );
|
2000-10-26 02:30:33 +02:00
|
|
|
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 */
|
2001-06-28 01:25:46 +02:00
|
|
|
static void
|
|
|
|
ft_raster1_get_cbox( FT_Renderer render,
|
|
|
|
FT_GlyphSlot slot,
|
|
|
|
FT_BBox* cbox )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
2016-09-28 19:10:52 +02:00
|
|
|
FT_ZERO( cbox );
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
if ( slot->format == render->glyph_format )
|
|
|
|
FT_Outline_Get_CBox( &slot->outline, cbox );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* convert a slot's glyph image into a bitmap */
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
* include/freetype/ftimage.h (FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_Render_Func, FT_Renderer_TransformFunc),
src/base/ftglyph.c (ft_outline_glyph_transform),
src/raster/ftrend1.c (ft_raster1_transform, ft_raster1_render),
src/smooth/ftgrays.c (FT_Outline_Decompose, gray_raster_render),
src/smooth/ftsmooth.c (ft_smooth_transform,
ft_smooth_render_generic, ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Decorate parameters with `const' where
appropriate.
* src/raster/ftraster.c (RASTER_RENDER_POOL): Removed. Obsolete.
(ft_black_render): Decorate parameters with `const' where
appropriate.
* src/sfnt/ttcmap.c (tt_cmap4_set_range): Fix typo (FT_PEEK_SHORT ->
FT_PEEK_USHORT) which caused crashes. Reported by Ismail Donmez
<ismail@kde.org.tr>.
2005-05-11 22:04:35 +02:00
|
|
|
ft_raster1_render( FT_Renderer render,
|
|
|
|
FT_GlyphSlot slot,
|
|
|
|
FT_Render_Mode mode,
|
|
|
|
const FT_Vector* origin )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_Outline* outline;
|
2015-01-18 07:29:48 +01:00
|
|
|
FT_BBox cbox, cbox0;
|
2000-10-26 02:30:33 +02:00
|
|
|
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 )
|
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Argument );
|
2000-10-26 02:30:33 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check rendering mode */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
if ( mode != FT_RENDER_MODE_MONO )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
|
|
|
/* raster1 is only capable of producing monochrome bitmaps */
|
2015-01-14 18:06:22 +01:00
|
|
|
return FT_THROW( Cannot_Render_Glyph );
|
2000-10-26 02:30:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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 */
|
2015-01-18 07:29:48 +01:00
|
|
|
FT_Outline_Get_CBox( outline, &cbox0 );
|
2000-10-26 02:30:33 +02:00
|
|
|
|
2011-01-15 09:46:13 +01:00
|
|
|
/* undocumented but confirmed: bbox values get rounded */
|
|
|
|
#if 1
|
2015-01-18 07:29:48 +01:00
|
|
|
cbox.xMin = FT_PIX_ROUND( cbox0.xMin );
|
|
|
|
cbox.yMin = FT_PIX_ROUND( cbox0.yMin );
|
|
|
|
cbox.xMax = FT_PIX_ROUND( cbox0.xMax );
|
|
|
|
cbox.yMax = FT_PIX_ROUND( cbox0.yMax );
|
2011-01-15 09:46:13 +01:00
|
|
|
#else
|
2003-12-24 02:10:46 +01:00
|
|
|
cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
|
|
|
|
cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
|
|
|
|
cbox.xMax = FT_PIX_CEIL( cbox.xMax );
|
|
|
|
cbox.yMax = FT_PIX_CEIL( cbox.yMax );
|
2011-01-15 09:46:13 +01:00
|
|
|
#endif
|
2000-10-26 02:30:33 +02:00
|
|
|
|
2015-01-18 07:29:48 +01:00
|
|
|
/* If either `width' or `height' round to 0, try */
|
|
|
|
/* explicitly rounding up/down. In the case of */
|
|
|
|
/* glyphs containing only one very narrow feature, */
|
|
|
|
/* this gives the drop-out compensation in the scan */
|
|
|
|
/* conversion code a chance to do its stuff. */
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
|
2015-01-18 07:29:48 +01:00
|
|
|
if ( width == 0 )
|
|
|
|
{
|
|
|
|
cbox.xMin = FT_PIX_FLOOR( cbox0.xMin );
|
|
|
|
cbox.xMax = FT_PIX_CEIL( cbox0.xMax );
|
|
|
|
|
|
|
|
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
|
|
|
|
}
|
|
|
|
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
|
2015-01-18 07:29:48 +01:00
|
|
|
if ( height == 0 )
|
|
|
|
{
|
|
|
|
cbox.yMin = FT_PIX_FLOOR( cbox0.yMin );
|
|
|
|
cbox.yMax = FT_PIX_CEIL( cbox0.yMax );
|
|
|
|
|
|
|
|
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
|
|
|
|
}
|
2011-10-01 09:25:55 +02:00
|
|
|
|
|
|
|
if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX )
|
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Argument );
|
2011-10-01 09:25:55 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2000-10-26 02:30:33 +02:00
|
|
|
bitmap = &slot->bitmap;
|
|
|
|
memory = render->root.memory;
|
|
|
|
|
|
|
|
/* release old bitmap buffer */
|
2003-06-18 08:59:57 +02:00
|
|
|
if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
|
2000-10-26 02:30:33 +02:00
|
|
|
{
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( bitmap->buffer );
|
2003-06-18 08:59:57 +02:00
|
|
|
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
|
2000-10-26 02:30:33 +02:00
|
|
|
}
|
|
|
|
|
2015-01-23 21:23:55 +01:00
|
|
|
pitch = ( ( width + 15 ) >> 4 ) << 1;
|
|
|
|
bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
bitmap->width = width;
|
|
|
|
bitmap->rows = height;
|
2015-02-22 20:05:04 +01:00
|
|
|
bitmap->pitch = (int)pitch;
|
2000-10-26 02:30:33 +02:00
|
|
|
|
2006-05-02 11:00:29 +02:00
|
|
|
if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) )
|
2000-10-26 02:30:33 +02:00
|
|
|
goto Exit;
|
|
|
|
|
2003-06-18 08:59:57 +02:00
|
|
|
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
|
|
|
/* render outline into the bitmap */
|
|
|
|
error = render->raster_render( render->raster, ¶ms );
|
2003-12-24 02:10:46 +01:00
|
|
|
|
2001-12-19 15:47:28 +01:00
|
|
|
FT_Outline_Translate( outline, cbox.xMin, cbox.yMin );
|
2003-12-24 02:10:46 +01:00
|
|
|
|
2000-10-26 02:30:33 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
slot->format = FT_GLYPH_FORMAT_BITMAP;
|
2002-09-28 18:40:57 +02:00
|
|
|
slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 );
|
|
|
|
slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 );
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
FT_DEFINE_RENDERER(
|
|
|
|
ft_raster1_renderer_class,
|
2011-11-30 10:46:53 +01:00
|
|
|
|
* include/freetype/ftglyph.h (ft_glyph_bbox_unscaled,
ft_glyph_bbox_subpixels, ft_glyph_bbox_gridfit,
ft_glyph_bbox_truncate, ft_glyph_bbox_pixels): Replaced with
FT_GLYPH_BBOX_UNSCALED, FT_GLYPH_BBOX_SUBPIXELS,
FT_GLYPH_BBIX_GRIDFIT, FT_GLYPH_BBOX_TRUNCATE, FT_GLYPH_BBOX_PIXELS.
The lowercase variants are now (deprecated aliases) to the uppercase
versions.
Updated all other files.
* include/freetype/ftmodule.h (ft_module_font_driver,
ft_module_renderer, ft_module_hinter, ft_module_styler,
ft_module_driver_scalable, ft_module_driver_no_outlines,
ft_module_driver_has_hinter): Replaced with FT_MODULE_FONT_DRIVER,
FT_MODULE_RENDERER, FT_MODULE_HINTER, FT_MODULE_STYLER,
FT_MODULE_DRIVER_SCALABLE, FT_MODULE_DRIVER_NO_OUTLINES,
FT_MODULE_DRIVER_HAS_HINTER.
The lowercase variants are now (deprecated aliases) to the uppercase
versions.
Updated all other files.
* src/base/ftglyph.c (FT_Glyph_Get_CBox): Handle bbox_mode better
as enumeration.
* src/pcf/pcfdrivr.c (pcf_driver_class), src/winfonts/winfnt.c
(winfnt_driver_class), src/bdf/bdfdrivr.c (bdf_driver_class): Add
the FT_MODULE_DRIVER_NO_OUTLINES flag.
2003-06-17 12:42:27 +02:00
|
|
|
FT_MODULE_RENDERER,
|
2011-11-30 10:46:53 +01:00
|
|
|
sizeof ( FT_RendererRec ),
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
"raster1",
|
|
|
|
0x10000L,
|
|
|
|
0x20000L,
|
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
NULL, /* module specific interface */
|
2000-10-26 02:30:33 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_Module_Constructor)ft_raster1_init, /* module_init */
|
|
|
|
(FT_Module_Destructor) NULL, /* module_done */
|
|
|
|
(FT_Module_Requester) NULL, /* get_interface */
|
2000-10-26 02:30:33 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
FT_GLYPH_FORMAT_OUTLINE,
|
2000-10-26 02:30:33 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_Renderer_RenderFunc) ft_raster1_render, /* render_glyph */
|
|
|
|
(FT_Renderer_TransformFunc)ft_raster1_transform, /* transform_glyph */
|
|
|
|
(FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, /* get_glyph_cbox */
|
|
|
|
(FT_Renderer_SetModeFunc) ft_raster1_set_mode, /* set_mode */
|
2000-10-26 02:30:33 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_Raster_Funcs*)&FT_STANDARD_RASTER_GET /* raster_class */
|
2009-04-05 17:16:13 +02:00
|
|
|
)
|
2000-10-26 02:30:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|