pub fn families() -> Vec<String> {
        use winapi::um::wingdi::{LOGFONTW, TEXTMETRICW, DEFAULT_CHARSET, EnumFontFamiliesExW};
        use winapi::um::winuser::GetDC;
        use winapi::shared::minwindef::{DWORD, LPARAM};
        use std::mem;
        
        let mut families = Vec::with_capacity(16);

        unsafe extern "system" fn callback(font_ptr: *const LOGFONTW, _txt: *const TEXTMETRICW, _font_type: DWORD, lparam: LPARAM) -> i32 {
            let families_ptr = lparam as *mut Vec<String>;
            let families = &mut *families_ptr;

            let font = &*font_ptr;
            let family_text = from_utf16(&font.lfFaceName);
            if !families.iter().any(|f| f == &family_text) {
                families.push(family_text);
            }

            1
        }

        unsafe {
            let hdc = GetDC(ptr::null_mut());
            let mut font: LOGFONTW = mem::zeroed();
            font.lfCharSet = DEFAULT_CHARSET as u8;

            EnumFontFamiliesExW(hdc, &mut font, Some(callback), (&mut families as *mut Vec<String>) as _, 0);
        }

        families.shrink_to_fit();
        families
    }
/// Returns all the font families loaded on the OS. 
/// Probably pretty slow, so cache the value if possible
Returns all the font families loaded on the OS.
Probably pretty slow, so cache the value if possible
Returns all the font families loaded on the OS . Probably pretty slow so cache the value if possible
pub fn families() -> Vec<String> {
        use winapi::um::wingdi::{LOGFONTW, TEXTMETRICW, DEFAULT_CHARSET, EnumFontFamiliesExW};
        use winapi::um::winuser::GetDC;
        use winapi::shared::minwindef::{DWORD, LPARAM};
        use std::mem;
        let mut families = Vec::with_capacity(16);
        unsafe extern "system" fn callback(font_ptr: *const LOGFONTW, _txt: *const TEXTMETRICW, _font_type: DWORD, lparam: LPARAM) -> i32 {
            let families_ptr = lparam as *mut Vec<String>;
            let families = &mut *families_ptr;
            let font = &*font_ptr;
            let family_text = from_utf16(&font.lfFaceName);
            if !families.iter().any(|f| f == &family_text) {
                families.push(family_text);
            }
            1
        }
        unsafe {
            let hdc = GetDC(ptr::null_mut());
            let mut font: LOGFONTW = mem::zeroed();
            font.lfCharSet = DEFAULT_CHARSET as u8;
            EnumFontFamiliesExW(hdc, &mut font, Some(callback), (&mut families as *mut Vec<String>) as _, 0);
        }
        families.shrink_to_fit();
        families
    }
pub fn families ( ) -> Vec < String > { use winapi :: um :: wingdi :: { LOGFONTW , TEXTMETRICW , DEFAULT_CHARSET , EnumFontFamiliesExW } ; use winapi :: um :: winuser :: GetDC ; use winapi :: shared :: minwindef :: { DWORD , LPARAM } ; use std :: mem ; let mut families = Vec :: with_capacity ( 16 ) ; unsafe extern " " fn callback ( font_ptr : * const LOGFONTW , _txt : * const TEXTMETRICW , _font_type : DWORD , lparam : LPARAM ) -> i32 { let families_ptr = lparam as * mut Vec < String > ; let families = & mut * families_ptr ; let font = & * font_ptr ; let family_text = from_utf16 ( & font . lfFaceName ) ; if ! families . iter ( ) . any ( | f | f == & family_text ) { families . push ( family_text ) ; } 1 } unsafe { let hdc = GetDC ( ptr :: null_mut ( ) ) ; let mut font : LOGFONTW = mem :: zeroed ( ) ; font . lfCharSet = DEFAULT_CHARSET as u8 ; EnumFontFamiliesExW ( hdc , & mut font , Some ( callback ) , ( & mut families as * mut Vec < String > ) as _ , 0 ) ; } families . shrink_to_fit ( ) ; families }
Returns all the font families loaded on the OS.
Returns all the font families loaded on the OS .