summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-01-04 05:46:28 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-01-04 05:46:28 +0000
commita92bd036e33c8ace7a980fbf0698b23396345bd8 (patch)
treec7a02e26aadce9a1f6a21bc91c77ce4c38a59f11
parent749d7af9a9757fda86eb90480efbea110904ab04 (diff)
parentc210059e5488ef0faa74d2a70b275677687ee7c9 (diff)
downloadpango-a92bd036e33c8ace7a980fbf0698b23396345bd8.tar.gz
Merge branch 'macos-tests' into 'master'
ci: Run tests on MacOS Closes #524 See merge request GNOME/pango!268
-rw-r--r--.gitlab-ci.yml3
-rw-r--r--pango/pangocoretext-fontmap.c51
-rw-r--r--pango/pangocoretext-private.h3
-rw-r--r--pango/pangocoretext.c2
4 files changed, 58 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9b64061a..20ecadc1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -96,10 +96,13 @@ macos:
-Dpixman:tests=disabled
_build
- ninja -C _build
+ - .gitlab-ci/run-tests.sh _build
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
+ - "${CI_PROJECT_DIR}/_build/hello.png"
+ - "${CI_PROJECT_DIR}/_build/fontlist.txt"
reference:
image: $FEDORA_IMAGE
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 5a81e388..78003e6c 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -1859,3 +1859,54 @@ pango_core_text_fontset_foreach (PangoFontset *fontset,
}
}
+PangoCoreTextFace *
+pango_core_text_font_map_find_face (PangoCoreTextFontMap *map,
+ const PangoCoreTextFontKey *key)
+{
+ CTFontDescriptorRef desc;
+ gboolean synthetic_italic;
+ char *family;
+ char *family_name;
+ char *style_name;
+ PangoWeight weight;
+ CTFontSymbolicTraits traits;
+ PangoCoreTextFamily *font_family;
+ PangoCoreTextFace *result = NULL;
+
+ desc = pango_core_text_font_key_get_ctfontdescriptor (key);
+ synthetic_italic = pango_core_text_font_key_get_synthetic_italic (key);
+
+ family_name = ct_font_descriptor_get_family_name (desc, FALSE);
+ style_name = ct_font_descriptor_get_style_name (desc);
+ weight = ct_font_descriptor_get_weight (desc);
+ traits = ct_font_descriptor_get_traits (desc);
+
+ family = g_utf8_casefold (family_name, -1);
+
+ font_family = g_hash_table_lookup (map->families, family);
+
+ if (font_family)
+ {
+ pango_font_family_list_faces ((PangoFontFamily *)font_family, NULL, NULL);
+
+ for (int i = 0; i < font_family->n_faces; i++)
+ {
+ PangoCoreTextFace *face = (PangoCoreTextFace *)font_family->faces[i];
+
+ if (face->weight == weight &&
+ face->traits == traits &&
+ face->synthetic_italic == synthetic_italic &&
+ strcmp (face->style_name, style_name) == 0)
+ {
+ result = face;
+ break;
+ }
+ }
+ }
+
+ g_free (family);
+ g_free (family_name);
+ g_free (style_name);
+
+ return result;
+}
diff --git a/pango/pangocoretext-private.h b/pango/pangocoretext-private.h
index 9cade31a..d95ec642 100644
--- a/pango/pangocoretext-private.h
+++ b/pango/pangocoretext-private.h
@@ -152,6 +152,9 @@ PangoGravity pango_core_text_font_key_get_gravity (const Pango
_PANGO_EXTERN
CTFontDescriptorRef pango_core_text_font_key_get_ctfontdescriptor (const PangoCoreTextFontKey *key);
+PangoCoreTextFace * pango_core_text_font_map_find_face (PangoCoreTextFontMap *map,
+ const PangoCoreTextFontKey *key);
+
G_END_DECLS
#endif /* __PANGOCORETEXT_PRIVATE_H__ */
diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
index 44d2805a..e14ab16c 100644
--- a/pango/pangocoretext.c
+++ b/pango/pangocoretext.c
@@ -238,7 +238,7 @@ _pango_core_text_font_get_face (PangoCoreTextFont *font)
{
PangoCoreTextFontPrivate *priv = font->priv;
- return priv->face;
+ return pango_core_text_font_map_find_face (PANGO_CORE_TEXT_FONT_MAP (priv->fontmap), priv->key);
}
gpointer