[Fontconfig] fontconfig: Branch 'master'
Akira TAGOH
tagoh at kemper.freedesktop.org
Fri Jul 7 06:47:57 UTC 2017
doc/fcpattern.fncs | 17 +++++++++++++++++
fontconfig/fontconfig.h | 12 +++++++++++-
src/fcint.h | 9 +++------
src/fcpat.c | 18 ++++++++++++++++--
4 files changed, 47 insertions(+), 9 deletions(-)
New commits:
commit ee2000494c4c8367fe20593709a979d158687855
Author: Akira TAGOH <akira at tagoh.org>
Date: Tue Jul 28 12:48:40 2015 +0900
Add FcPatternGetWithBinding() to obtain the binding type of the value in FcPattern.
https://bugs.freedesktop.org/show_bug.cgi?id=19375
diff --git a/doc/fcpattern.fncs b/doc/fcpattern.fncs
index 1049d77..e1987ff 100644
--- a/doc/fcpattern.fncs
+++ b/doc/fcpattern.fncs
@@ -199,6 +199,23 @@ any existing list of values.
@@
@RET@ FcResult
+ at FUNC@ FcPatternGetWithBinding
+ at TYPE1@ FcPattern * @ARG1@ p
+ at TYPE2@ const char * @ARG2@ object
+ at TYPE3@ int% @ARG3@ id
+ at TYPE4@ FcValue * @ARG4@ v
+ at TYPE5@ FcValueBinding * @ARG5@ b
+ at PURPOSE@ Return a value with binding from a pattern
+ at DESC@
+Returns in <parameter>v</parameter> the <parameter>id</parameter>'th value
+and <parameter>b</parameter> binding for that associated with the property
+<parameter>object</parameter>.
+The Value returned is not a copy, but rather refers to the data stored
+within the pattern directly. Applications must not free this value.
+ at SINCE@ 2.13.0
+@@
+
+ at RET@ FcResult
@FUNC@ FcPatternGet
@TYPE1@ FcPattern * @ARG1@ p
@TYPE2@ const char * @ARG2@ object
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index 2e35b6b..9535c56 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
+#include <limits.h>
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define FC_ATTRIBUTE_SENTINEL(x) __attribute__((__sentinel__(0)))
@@ -236,6 +237,12 @@ typedef enum _FcResult {
FcResultOutOfMemory
} FcResult;
+typedef enum _FcValueBinding {
+ FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
+ /* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
+ FcValueBindingEnd = INT_MAX
+} FcValueBinding;
+
typedef struct _FcPattern FcPattern;
typedef struct _FcLangSet FcLangSet;
@@ -837,7 +844,10 @@ FcPatternAddWeak (FcPattern *p, const char *object, FcValue value, FcBool append
FcPublic FcResult
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v);
-
+
+FcPublic FcResult
+FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b);
+
FcPublic FcBool
FcPatternDel (FcPattern *p, const char *object);
diff --git a/src/fcint.h b/src/fcint.h
index dad34c5..360d80d 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -116,12 +116,6 @@ extern pfnSHGetFolderPathA pSHGetFolderPathA;
FC_ASSERT_STATIC (sizeof (FcRef) == sizeof (int));
-typedef enum _FcValueBinding {
- FcValueBindingWeak, FcValueBindingStrong, FcValueBindingSame,
- /* to make sure sizeof (FcValueBinding) == 4 even with -fshort-enums */
- FcValueBindingEnd = INT_MAX
-} FcValueBinding;
-
#define FcStrdup(s) ((FcChar8 *) strdup ((const char *) (s)))
#define FcFree(s) (free ((FcChar8 *) (s)))
@@ -1000,6 +994,9 @@ FcPrivate FcBool
FcPatternObjectAddWeak (FcPattern *p, FcObject object, FcValue value, FcBool append);
FcPrivate FcResult
+FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b);
+
+FcPrivate FcResult
FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v);
FcPrivate FcBool
diff --git a/src/fcpat.c b/src/fcpat.c
index 3ef1ed2..cc303c6 100644
--- a/src/fcpat.c
+++ b/src/fcpat.c
@@ -883,7 +883,7 @@ FcPatternAddRange (FcPattern *p, const char *object, const FcRange *r)
}
FcResult
-FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
+FcPatternObjectGetWithBinding (const FcPattern *p, FcObject object, int id, FcValue *v, FcValueBinding *b)
{
FcPatternElt *e;
FcValueListPtr l;
@@ -898,6 +898,8 @@ FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
if (!id)
{
*v = FcValueCanonicalize(&l->value);
+ if (b)
+ *b = l->binding;
return FcResultMatch;
}
id--;
@@ -906,9 +908,21 @@ FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
}
FcResult
+FcPatternObjectGet (const FcPattern *p, FcObject object, int id, FcValue *v)
+{
+ return FcPatternObjectGetWithBinding (p, object, id, v, NULL);
+}
+
+FcResult
+FcPatternGetWithBinding (const FcPattern *p, const char *object, int id, FcValue *v, FcValueBinding *b)
+{
+ return FcPatternObjectGetWithBinding (p, FcObjectFromName (object), id, v, b);
+}
+
+FcResult
FcPatternGet (const FcPattern *p, const char *object, int id, FcValue *v)
{
- return FcPatternObjectGet (p, FcObjectFromName (object), id, v);
+ return FcPatternObjectGetWithBinding (p, FcObjectFromName (object), id, v, NULL);
}
FcResult
More information about the Fontconfig
mailing list