From 9c075dc4cdaeef79bc570ed2219bb757cb325c47 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 15 May 2018 20:21:34 +0200 Subject: Update in-tree freetype2 lib (unused) to 2.9.1 --- modules/freetype2/src/raster/Jamfile | 2 +- modules/freetype2/src/raster/ftmisc.h | 2 +- modules/freetype2/src/raster/ftraster.c | 2 +- modules/freetype2/src/raster/ftraster.h | 2 +- modules/freetype2/src/raster/ftrend1.c | 118 +++++++++----------------------- modules/freetype2/src/raster/ftrend1.h | 2 +- modules/freetype2/src/raster/module.mk | 2 +- modules/freetype2/src/raster/raster.c | 6 +- modules/freetype2/src/raster/rasterrs.h | 2 +- modules/freetype2/src/raster/rastpic.c | 2 +- modules/freetype2/src/raster/rastpic.h | 2 +- modules/freetype2/src/raster/rules.mk | 2 +- 12 files changed, 47 insertions(+), 97 deletions(-) (limited to 'modules/freetype2/src/raster') diff --git a/modules/freetype2/src/raster/Jamfile b/modules/freetype2/src/raster/Jamfile index 2ec88f560..838e7ef57 100644 --- a/modules/freetype2/src/raster/Jamfile +++ b/modules/freetype2/src/raster/Jamfile @@ -1,6 +1,6 @@ # FreeType 2 src/raster Jamfile # -# Copyright 2001-2016 by +# Copyright 2001-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/raster/ftmisc.h b/modules/freetype2/src/raster/ftmisc.h index 981ce3227..7e4011907 100644 --- a/modules/freetype2/src/raster/ftmisc.h +++ b/modules/freetype2/src/raster/ftmisc.h @@ -5,7 +5,7 @@ /* Miscellaneous macros for stand-alone rasterizer (specification */ /* only). */ /* */ -/* Copyright 2005-2016 by */ +/* Copyright 2005-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/modules/freetype2/src/raster/ftraster.c b/modules/freetype2/src/raster/ftraster.c index 429f0d250..4354730d5 100644 --- a/modules/freetype2/src/raster/ftraster.c +++ b/modules/freetype2/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/src/raster/ftraster.h b/modules/freetype2/src/raster/ftraster.h index 65cd5f960..40b5d6d32 100644 --- a/modules/freetype2/src/raster/ftraster.h +++ b/modules/freetype2/src/raster/ftraster.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (specification). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ diff --git a/modules/freetype2/src/raster/ftrend1.c b/modules/freetype2/src/raster/ftrend1.c index 5bd4b30c8..a7ce9731d 100644 --- a/modules/freetype2/src/raster/ftrend1.c +++ b/modules/freetype2/src/raster/ftrend1.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,12 +31,7 @@ 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 ); + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return FT_Err_Ok; } @@ -102,12 +97,12 @@ FT_Render_Mode mode, const FT_Vector* origin ) { - FT_Error error; - FT_Outline* outline; - FT_BBox cbox, cbox0; - FT_UInt width, height, pitch; - FT_Bitmap* bitmap; - FT_Memory memory; + FT_Error error = FT_Err_Ok; + FT_Outline* outline = &slot->outline; + FT_Bitmap* bitmap = &slot->bitmap; + FT_Memory memory = render->root.memory; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; FT_Raster_Params params; @@ -126,60 +121,6 @@ return FT_THROW( 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, &cbox0 ); - - /* undocumented but confirmed: bbox values get rounded */ -#if 1 - 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 ); -#else - 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 ); -#endif - - /* 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. */ - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); - 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 ); - } - - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); - 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 ); - } - - if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - bitmap = &slot->bitmap; - memory = render->root.memory; - /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) { @@ -187,39 +128,48 @@ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; } - pitch = ( ( width + 15 ) >> 4 ) << 1; - bitmap->pixel_mode = FT_PIXEL_MODE_MONO; + ft_glyphslot_preset_bitmap( slot, mode, origin ); - bitmap->width = width; - bitmap->rows = height; - bitmap->pitch = (int)pitch; - - if ( FT_ALLOC_MULT( bitmap->buffer, pitch, height ) ) + /* allocate new one */ + if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) ) goto Exit; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + x_shift = -slot->bitmap_left * 64; + y_shift = ( (FT_Int)bitmap->rows - slot->bitmap_top ) * 64; + + if ( origin ) + { + x_shift += origin->x; + y_shift += origin->y; + } + /* translate outline to render it into the bitmap */ - FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin ); + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, x_shift, y_shift ); /* set up parameters */ params.target = bitmap; params.source = outline; - params.flags = 0; + params.flags = FT_RASTER_FLAG_DEFAULT; /* render outline into the bitmap */ error = render->raster_render( render->raster, ¶ms ); - FT_Outline_Translate( outline, cbox.xMin, cbox.yMin ); - - if ( error ) - goto Exit; + Exit: + if ( !error ) + /* everything is fine; the glyph is now officially a bitmap */ + slot->format = FT_GLYPH_FORMAT_BITMAP; + else if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + { + FT_FREE( bitmap->buffer ); + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } - slot->format = FT_GLYPH_FORMAT_BITMAP; - slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 ); - slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 ); + if ( x_shift || y_shift ) + FT_Outline_Translate( outline, -x_shift, -y_shift ); - Exit: return error; } diff --git a/modules/freetype2/src/raster/ftrend1.h b/modules/freetype2/src/raster/ftrend1.h index a431f185d..2abdf2d70 100644 --- a/modules/freetype2/src/raster/ftrend1.h +++ b/modules/freetype2/src/raster/ftrend1.h @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (specification). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/src/raster/module.mk b/modules/freetype2/src/raster/module.mk index f4a5f8e83..b115f416b 100644 --- a/modules/freetype2/src/raster/module.mk +++ b/modules/freetype2/src/raster/module.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, diff --git a/modules/freetype2/src/raster/raster.c b/modules/freetype2/src/raster/raster.c index 5b21dcbc6..76edd21e1 100644 --- a/modules/freetype2/src/raster/raster.c +++ b/modules/freetype2/src/raster/raster.c @@ -4,7 +4,7 @@ /* */ /* FreeType monochrome rasterer module component (body only). */ /* */ -/* Copyright 1996-2016 by */ +/* Copyright 1996-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,11 +17,11 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT - #include -#include "rastpic.c" + #include "ftraster.c" #include "ftrend1.c" +#include "rastpic.c" /* END */ diff --git a/modules/freetype2/src/raster/rasterrs.h b/modules/freetype2/src/raster/rasterrs.h index 44da7fca5..22a3e1534 100644 --- a/modules/freetype2/src/raster/rasterrs.h +++ b/modules/freetype2/src/raster/rasterrs.h @@ -4,7 +4,7 @@ /* */ /* monochrome renderer error codes (specification only). */ /* */ -/* Copyright 2001-2016 by */ +/* Copyright 2001-2018 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/src/raster/rastpic.c b/modules/freetype2/src/raster/rastpic.c index dcfa92eef..1dc8981b8 100644 --- a/modules/freetype2/src/raster/rastpic.c +++ b/modules/freetype2/src/raster/rastpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2016 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/src/raster/rastpic.h b/modules/freetype2/src/raster/rastpic.h index 781587638..6d0877c42 100644 --- a/modules/freetype2/src/raster/rastpic.h +++ b/modules/freetype2/src/raster/rastpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009-2016 by */ +/* Copyright 2009-2018 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/modules/freetype2/src/raster/rules.mk b/modules/freetype2/src/raster/rules.mk index 929faa3a9..9aef1f0ba 100644 --- a/modules/freetype2/src/raster/rules.mk +++ b/modules/freetype2/src/raster/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2016 by +# Copyright 1996-2018 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, -- cgit v1.2.3