< prev index next >
src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c
Print this page
@@ -2,11 +2,11 @@
*
* ftgloadr.c
*
* The FreeType glyph loader (body).
*
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2020 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
@@ -144,13 +144,13 @@
{
FT_Outline* base = &loader->base.outline;
FT_Outline* current = &loader->current.outline;
- current->points = base->points + base->n_points;
- current->tags = base->tags + base->n_points;
- current->contours = base->contours + base->n_contours;
+ current->points = FT_OFFSET( base->points, base->n_points );
+ current->tags = FT_OFFSET( base->tags, base->n_points );
+ current->contours = FT_OFFSET( base->contours, base->n_contours );
/* handle extra points table - if any */
if ( loader->use_extra )
{
loader->current.extra_points = loader->base.extra_points +
@@ -167,10 +167,14 @@
{
FT_Error error;
FT_Memory memory = loader->memory;
+ if ( loader->max_points == 0 ||
+ loader->base.extra_points != NULL )
+ return FT_Err_Ok;
+
if ( !FT_NEW_ARRAY( loader->base.extra_points, 2 * loader->max_points ) )
{
loader->use_extra = 1;
loader->base.extra_points2 = loader->base.extra_points +
loader->max_points;
@@ -187,11 +191,11 @@
{
FT_GlyphLoad base = &loader->base;
FT_GlyphLoad current = &loader->current;
- current->subglyphs = base->subglyphs + base->num_subglyphs;
+ current->subglyphs = FT_OFFSET( base->subglyphs, base->num_subglyphs );
}
/* Ensure that we can add `n_points' and `n_contours' to our glyph. */
/* This function reallocates its outline tables if necessary. Note that */
@@ -209,10 +213,14 @@
FT_Bool adjust = 0;
FT_UInt new_max, old_max;
+ error = FT_GlyphLoader_CreateExtra( loader );
+ if ( error )
+ return error;
+
/* check points & tags */
new_max = (FT_UInt)base->n_points + (FT_UInt)current->n_points +
n_points;
old_max = loader->max_points;
@@ -242,10 +250,14 @@
adjust = 1;
loader->max_points = new_max;
}
+ error = FT_GlyphLoader_CreateExtra( loader );
+ if ( error )
+ return error;
+
/* check contours */
old_max = loader->max_contours;
new_max = (FT_UInt)base->n_contours + (FT_UInt)current->n_contours +
n_contours;
if ( new_max > old_max )
< prev index next >