gecko-dev/servo/components/gfx/platform/mod.rs

60 строки
1.6 KiB
Rust
Исходник Обычный вид История

/* 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"))]
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};
#[cfg(target_os = "macos")]
pub use platform::macos::{font, font_context, font_list, font_template};
2016-11-11 01:55:17 +03:00
#[cfg(any(target_os = "linux", target_os = "android"))]
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()
}
pub mod font;
pub mod font_context;
servo: Merge #17141 - Ged rid of libfontconfig in Android (from MortimerGoro:android_fonts); r=mbrubeck Libfontconfig dependency is causing huge startup times in Android (20 seconds on each page load!). On other platforms fontconfig caches are already available or can be prebuilt on installation scripts, but this can't be done on Android. Updating libfontconfig dependency doesn't fix the problem either. This PR gets rid of libfontconfig in Android. It queries available fonts and variations from Android System font configuration files. Android doesn't provide an API to query system fonts until Android O (which is very far from the minimum API right now...) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #16195 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: f388c0ab1e4df8cbd94d58eb7657f36baaf813fe --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 402786ba71fef37e4d7c35c71256685885efd34e
2017-06-06 23:29:05 +03:00
#[cfg(target_os = "linux")]
pub mod font_list;
servo: Merge #17141 - Ged rid of libfontconfig in Android (from MortimerGoro:android_fonts); r=mbrubeck Libfontconfig dependency is causing huge startup times in Android (20 seconds on each page load!). On other platforms fontconfig caches are already available or can be prebuilt on installation scripts, but this can't be done on Android. Updating libfontconfig dependency doesn't fix the problem either. This PR gets rid of libfontconfig in Android. It queries available fonts and variations from Android System font configuration files. Android doesn't provide an API to query system fonts until Android O (which is very far from the minimum API right now...) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #16195 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: f388c0ab1e4df8cbd94d58eb7657f36baaf813fe --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 402786ba71fef37e4d7c35c71256685885efd34e
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;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod font_template;
}
#[cfg(target_os = "macos")]
mod macos {
pub mod font;
pub mod font_context;
pub mod font_list;
pub mod font_template;
}
#[cfg(target_os = "windows")]
mod windows {
2016-11-11 01:55:17 +03:00
pub mod font;
pub mod font_context;
pub mod font_list;
pub mod font_template;
}