pub fn new(_ttf: &'ttf Ttf, file_name: &str, point: u32, index: Option<usize>) -> Result<Self> {
        let file_name_cstr = CString::new(file_name).expect("file name must not be empty");
        let ptr = unsafe {
            bind::TTF_OpenFontIndex(file_name_cstr.as_ptr(), point as _, index.unwrap_or(0) as _)
        };
        if ptr.is_null() {
            Err(SdlError::Others { msg: Sdl::error() })
        } else {
            Ok(Self {
                ptr: NonNull::new(ptr).unwrap(),
                _phantom: PhantomData,
            })
        }
    }
/// Constructs a font data from file name and point size.
/// The font face in the font file can be selected by an optional index, which will be `0` if `None`.
///
/// # Panics
///
/// Panics if `file_name` is empty.
Constructs a font data from file name and point size.
The font face in the font file can be selected by an optional index, which will be `0` if `None`.
Constructs a font data from file name and point size . The font face in the font file can be selected by an optional index which will be ` 0 ` if ` None ` .
pub fn new(_ttf: &'ttf Ttf, file_name: &str, point: u32, index: Option<usize>) -> Result<Self> {
        let file_name_cstr = CString::new(file_name).expect("file name must not be empty");
        let ptr = unsafe {
            bind::TTF_OpenFontIndex(file_name_cstr.as_ptr(), point as _, index.unwrap_or(0) as _)
        };
        if ptr.is_null() {
            Err(SdlError::Others { msg: Sdl::error() })
        } else {
            Ok(Self {
                ptr: NonNull::new(ptr).unwrap(),
                _phantom: PhantomData,
            })
        }
    }
pub fn new ( _ttf : & ' ttf Ttf , file_name : & str , point : u32 , index : Option < usize > ) -> Result < Self > { let file_name_cstr = CString :: new ( file_name ) . expect ( " " ) ; let ptr = unsafe { bind :: TTF_OpenFontIndex ( file_name_cstr . as_ptr ( ) , point as _ , index . unwrap_or ( 0 ) as _ ) } ; if ptr . is_null ( ) { Err ( SdlError :: Others { msg : Sdl :: error ( ) } ) } else { Ok ( Self { ptr : NonNull :: new ( ptr ) . unwrap ( ) , _phantom : PhantomData , } ) } }
Constructs a font data from file name and point size.
Constructs a font data from file name and point size .
_ttf
&'ttf Ttf
file_name
&str
point
u32
index
Option<usize>
_ttf
&'ttf Ttf
file_name
&str
point
u32
index
Option<usize>
panics
Panics if `file_name` is empty.
Panics if ` file_name ` is empty .