[librsvg: 35/53] Move all the unsafe stuff to a submodule
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 35/53] Move all the unsafe stuff to a submodule
- Date: Fri, 23 Oct 2020 02:19:07 +0000 (UTC)
commit 895a1c83136d57de3f646db7d1523162af6af466
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Oct 21 19:05:05 2020 -0500
Move all the unsafe stuff to a submodule
tests/src/utils.rs | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/tests/src/utils.rs b/tests/src/utils.rs
index 7d8b613f..aa87be00 100644
--- a/tests/src/utils.rs
+++ b/tests/src/utils.rs
@@ -25,12 +25,23 @@ pub fn fixture_path(filename_from_test_resources: &str) -> PathBuf {
}
#[cfg(have_pangoft2)]
-pub fn setup_font_map() {
+mod pango_ft2 {
use fontconfig_sys::fontconfig;
use glib::prelude::*;
use pangocairo::FontMap;
+ use super::*;
+
+ extern "C" {
+ // pango_fc_font_map_set_config (PangoFcFontMap *fcfontmap,
+ // FcConfig *fcconfig);
+ // This is not bound in gtk-rs, and PangoFcFontMap is not even exposed, so we'll bind it by hand.
+ fn pango_fc_font_map_set_config(
+ font_map: *mut libc::c_void,
+ config: *mut fontconfig::FcConfig,
+ );
+ }
- unsafe {
+ pub unsafe fn load_test_fonts() {
let font_paths = [
"tests/resources/Roboto-Regular.ttf",
"tests/resources/Roboto-Italic.ttf",
@@ -52,16 +63,6 @@ pub fn setup_font_map() {
let font_map = FontMap::new_for_font_type(cairo::FontType::FontTypeFt).unwrap();
let raw_font_map: *mut pango_sys::PangoFontMap = font_map.to_glib_none().0;
- extern "C" {
- // pango_fc_font_map_set_config (PangoFcFontMap *fcfontmap,
- // FcConfig *fcconfig);
- // This is not bound in gtk-rs, and PangoFcFontMap is not even exposed, so we'll bind it by hand.
- fn pango_fc_font_map_set_config(
- font_map: *mut libc::c_void,
- config: *mut fontconfig::FcConfig,
- );
- }
-
pango_fc_font_map_set_config (raw_font_map as *mut _, config);
fontconfig::FcConfigDestroy(config);
@@ -69,5 +70,10 @@ pub fn setup_font_map() {
}
}
+#[cfg(have_pangoft2)]
+pub fn setup_font_map() {
+ unsafe { self::pango_ft2::load_test_fonts(); }
+}
+
#[cfg(not(have_pangoft2))]
pub fn setup_font_map() {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]