2013-04-18 23:53:41 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-11-11 01:55:17 +03:00
|
|
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
2016-10-05 04:06:29 +03:00
|
|
|
pub use platform::freetype::{font, font_context};
|
|
|
|
|
|
|
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
|
|
|
pub use platform::freetype::{font_list, font_template};
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
2016-11-11 01:55:17 +03:00
|
|
|
pub use platform::windows::{font, font_context, font_list, font_template};
|
2014-08-08 08:36:06 +04:00
|
|
|
|
2015-09-01 17:33:02 +03:00
|
|
|
#[cfg(target_os = "macos")]
|
2014-08-08 08:36:06 +04:00
|
|
|
pub use platform::macos::{font, font_context, font_list, font_template};
|
2013-04-18 23:53:41 +04:00
|
|
|
|
2016-11-11 01:55:17 +03:00
|
|
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
2016-06-05 14:57:18 +03:00
|
|
|
mod freetype {
|
|
|
|
use libc::c_char;
|
|
|
|
use std::ffi::CStr;
|
|
|
|
use std::str;
|
|
|
|
|
|
|
|
/// Creates a String from the given null-terminated buffer.
|
|
|
|
/// Panics if the buffer does not contain UTF-8.
|
|
|
|
unsafe fn c_str_to_string(s: *const c_char) -> String {
|
|
|
|
str::from_utf8(CStr::from_ptr(s).to_bytes()).unwrap().to_owned()
|
|
|
|
}
|
|
|
|
|
2013-04-18 23:53:41 +04:00
|
|
|
pub mod font;
|
|
|
|
pub mod font_context;
|
2016-10-05 04:06:29 +03:00
|
|
|
|
2017-06-06 23:29:05 +03:00
|
|
|
#[cfg(target_os = "linux")]
|
2013-04-18 23:53:41 +04:00
|
|
|
pub mod font_list;
|
2017-06-06 23:29:05 +03:00
|
|
|
#[cfg(target_os = "android")]
|
|
|
|
mod android {
|
|
|
|
pub mod font_list;
|
|
|
|
}
|
|
|
|
#[cfg(target_os = "android")]
|
|
|
|
pub use self::android::font_list;
|
2016-10-05 04:06:29 +03:00
|
|
|
|
|
|
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
2014-07-09 03:31:07 +04:00
|
|
|
pub mod font_template;
|
2013-04-18 23:53:41 +04:00
|
|
|
}
|
|
|
|
|
2015-09-01 17:33:02 +03:00
|
|
|
#[cfg(target_os = "macos")]
|
2016-06-05 14:57:18 +03:00
|
|
|
mod macos {
|
2013-04-18 23:53:41 +04:00
|
|
|
pub mod font;
|
|
|
|
pub mod font_context;
|
|
|
|
pub mod font_list;
|
2014-07-09 03:31:07 +04:00
|
|
|
pub mod font_template;
|
2013-04-18 23:53:41 +04:00
|
|
|
}
|
2016-08-17 21:22:52 +03:00
|
|
|
|
2016-10-05 04:06:29 +03:00
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
mod windows {
|
2016-11-11 01:55:17 +03:00
|
|
|
pub mod font;
|
|
|
|
pub mod font_context;
|
2016-08-17 21:22:52 +03:00
|
|
|
pub mod font_list;
|
|
|
|
pub mod font_template;
|
|
|
|
}
|