summaryrefslogtreecommitdiff
path: root/test/font-variations.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2017-09-20 14:53:10 -0700
committerBehdad Esfahbod <behdad@behdad.org>2017-12-19 15:17:01 -0500
commit6accf16093b3d3451eca10ee194c00a1107b8861 (patch)
treeeb5c78ecc816a9312949863be199427bb4e73bde /test/font-variations.c
parent7cc07f184bf705891bfb6b7f3b4f4b425370b5cd (diff)
[variations] Towards fixing test
Diffstat (limited to 'test/font-variations.c')
-rw-r--r--test/font-variations.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/font-variations.c b/test/font-variations.c
index 18821726c..47dcd3706 100644
--- a/test/font-variations.c
+++ b/test/font-variations.c
@@ -28,7 +28,9 @@
#include <assert.h>
#if CAIRO_HAS_FC_FONT
-#include <freetype/ftmm.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_MULTIPLE_MASTERS_H
#include <fontconfig/fontconfig.h>
#include "cairo-ft.h"
#endif
@@ -57,9 +59,14 @@ test_variation (cairo_test_context_t *ctx,
#if CAIRO_HAS_FC_FONT
FcPattern *pattern;
+#ifndef FC_FONT_VARIATIONS
+#define FC_FONT_VARIATIONS "fontvariations"
+#endif
+
/* we need a font that has variations */
pattern = FcPatternBuild (NULL,
FC_FAMILY, FcTypeString, (FcChar8*)"Adobe Variable Font Prototype",
+ FC_FONT_VARIATIONS, FcTypeString, input,
NULL);
font_face = cairo_ft_font_face_create_for_pattern (pattern);
status = cairo_font_face_status (font_face);
@@ -120,22 +127,22 @@ test_variation (cairo_test_context_t *ctx,
for (i = 0; i < ft_mm_var->num_axis; i++) {
FT_Var_Axis *axis = &ft_mm_var->axis[i];
- cairo_test_log (ctx, "axis %s, value %ld\n", axis->name, coords[i]);
+ cairo_test_log (ctx, "axis %s, value %g\n", axis->name, coords[i] / 65536.);
}
for (i = 0; i < ft_mm_var->num_axis; i++) {
FT_Var_Axis *axis = &ft_mm_var->axis[i];
if (axis->tag == FT_MAKE_TAG(tag[0], tag[1], tag[2], tag[3])) {
if (def) {
if (coords[i] != axis->def) {
- cairo_test_log (ctx, "Axis %s: not default value (%ld != %ld)",
- axis->name, coords[i], axis->def);
+ cairo_test_log (ctx, "Axis %s: not default value (%g != %g)",
+ axis->name, coords[i] / 65536., axis->def / 65536.);
return CAIRO_TEST_FAILURE;
}
}
else {
if (coords[i] != FloatToFixed(expected_value)) {
- cairo_test_log (ctx, "Axis %s: not expected value (%ld != %ld)",
- axis->name, coords[i], FloatToFixed(expected_value));
+ cairo_test_log (ctx, "Axis %s: not expected value (%g != %g)",
+ axis->name, coords[i] / 65536., expected_value);
return CAIRO_TEST_FAILURE;
}
}