| 1 | //! This crate provide parsing fontconfig file but not yet complete all features |
| 2 | //! |
| 3 | //! see <https://www.freedesktop.org/software/fontconfig/fontconfig-user.html> for more detail infomation of fontconfig file |
| 4 | //! |
| 5 | //! # Example |
| 6 | //! |
| 7 | //! ```no_run |
| 8 | //! use fontconfig_parser::FontConfig; |
| 9 | //! |
| 10 | //! let mut config = FontConfig::default(); |
| 11 | //! |
| 12 | //! config.merge_config("/etc/fonts/fonts.conf" ).unwrap(); |
| 13 | //! ``` |
| 14 | |
| 15 | #[macro_use ] |
| 16 | mod util; |
| 17 | |
| 18 | mod error; |
| 19 | mod parser; |
| 20 | mod types; |
| 21 | |
| 22 | pub type Result<T> = core::result::Result<T, Error>; |
| 23 | |
| 24 | pub use crate::error::Error; |
| 25 | pub use crate::types::*; |
| 26 | |
| 27 | /// Parse as raw config parts use this when you want custom handling config file |
| 28 | /// |
| 29 | /// Otherwise, you may want [`FontConfig::merge_config`] |
| 30 | pub fn parse_config_parts(s: &str) -> Result<Vec<ConfigPart>> { |
| 31 | crateimpl Iterator- >
::parser::parse_config(&roxmltree::Document::parse_with_options( |
| 32 | text:s, |
| 33 | opt:roxmltree::ParsingOptions { |
| 34 | allow_dtd: true, |
| 35 | ..Default::default() |
| 36 | }, |
| 37 | )?)? |
| 38 | .collect() |
| 39 | } |
| 40 | |
| 41 | #[cfg (test)] |
| 42 | mod tests {} |
| 43 | |