From 64cdee73480587352fb45402b771077be05c1715 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Wed, 15 Feb 2017 08:06:35 +0100 Subject: [PATCH] Add new function `FT_Face_Properties'. This commit provides the framework, to be filled with something useful in the next commits. * include/freetype/freetype.h (FT_Face_Properties): Declare. * src/base/ftobjs.c (FT_Face_Properties): New function. --- ChangeLog | 12 ++++++++++++ include/freetype/freetype.h | 39 ++++++++++++++++++++++++++++++++++++- src/base/ftobjs.c | 32 ++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5fa1201ad..9008b6b53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2017-02-14 Nikolaus Waxweiler + Werner Lemberg + + Add new function `FT_Face_Properties'. + + This commit provides the framework, to be filled with something + useful in the next commits. + + * include/freetype/freetype.h (FT_Face_Properties): Declare. + + * src/base/ftobjs.c (FT_Face_Properties): New function. + 2017-02-13 Werner Lemberg [autofit] Prevent overlapping blue zones. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 568a588f2..fd7d445ca 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -175,6 +175,7 @@ FT_BEGIN_HEADER /* FT_Done_Face */ /* FT_Reference_Face */ /* FT_New_Memory_Face */ + /* FT_Face_Properties */ /* FT_Open_Face */ /* FT_Open_Args */ /* FT_Parameter */ @@ -1925,7 +1926,7 @@ FT_BEGIN_HEADER /* */ /* */ /* A simple structure to pass more or less generic parameters to */ - /* @FT_Open_Face. */ + /* @FT_Open_Face and @FT_Face_Properties. */ /* */ /* */ /* tag :: A four-byte identification tag. */ @@ -3612,6 +3613,42 @@ FT_BEGIN_HEADER FT_UInt *agindex ); + /************************************************************************* + * + * @function: + * FT_Face_Properties + * + * @description: + * Set or override certain (library or module-wide) properties on a + * face-by-face basis. Useful for finer-grained control and avoiding + * locks on shared structures (threads can modify their own faces as + * they see fit). + * + * Contrary to @FT_Property_Set, this function uses @FT_Parameter so + * that you can pass multiple properties to the target face in one call. + * Note that only a subset of the available properties can be + * controlled. + * + * @input: + * face :: + * A handle to the source face object. + * + * num_properties :: + * The number of properties that follow. + * + * properties :: + * A handle to an @FT_Parameter array with `num_properties' elements. + * + * @return: + * FreeType error code. 0~means success. + * + */ + FT_EXPORT( FT_Error ) + FT_Face_Properties( FT_Face face, + FT_UInt num_properties, + FT_Parameter* properties ); + + /*************************************************************************/ /* */ /* */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 59d65e2a6..c2ab2d1a7 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -3589,6 +3589,38 @@ } + /* documentation is in freetype.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Face_Properties( FT_Face face, + FT_UInt num_properties, + FT_Parameter* properties ) + { + FT_Error error = FT_Err_Ok; + + + if ( num_properties > 0 && !properties ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + + for ( ; num_properties > 0; num_properties-- ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + + if ( error ) + break; + + properties++; + } + + Exit: + return error; + } + + /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_UInt )