mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-26 12:59:00 +00:00
fonts: Use ImFontConfig_DefaultConstructor to initialize sys::ImFontConfig
This commit is contained in:
parent
e4668f0221
commit
0e1ec3cb6a
@ -15,7 +15,6 @@ extern crate glium;
|
|||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::os::raw::{c_char, c_float, c_int, c_short, c_uchar, c_uint, c_ushort, c_void};
|
use std::os::raw::{c_char, c_float, c_int, c_short, c_uchar, c_uint, c_ushort, c_void};
|
||||||
use std::ptr;
|
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
#[cfg(feature = "gfx")]
|
#[cfg(feature = "gfx")]
|
||||||
@ -911,31 +910,6 @@ pub struct ImFontConfig {
|
|||||||
name: [c_char; 32],
|
name: [c_char; 32],
|
||||||
dst_font: *mut ImFont,
|
dst_font: *mut ImFont,
|
||||||
}
|
}
|
||||||
impl ImFontConfig {
|
|
||||||
// This function only exists because cimgui does not provide a wrapper around
|
|
||||||
// `ImGuiConfig::ImGuiConfig()`. This code is based off that constructor.
|
|
||||||
pub fn new() -> ImFontConfig {
|
|
||||||
ImFontConfig {
|
|
||||||
font_data: ptr::null_mut(),
|
|
||||||
font_data_size: 0,
|
|
||||||
font_data_owned_by_atlas: true,
|
|
||||||
font_no: 0,
|
|
||||||
size_pixels: 0.0,
|
|
||||||
oversample_h: 3,
|
|
||||||
oversample_v: 1,
|
|
||||||
pixel_snap_h: false,
|
|
||||||
glyph_extra_spacing: ImVec2::zero(),
|
|
||||||
glyph_offset: ImVec2::zero(),
|
|
||||||
glyph_ranges: ptr::null(),
|
|
||||||
merge_mode: false,
|
|
||||||
rasterizer_flags: 0,
|
|
||||||
rasterizer_multiply: 1.0,
|
|
||||||
|
|
||||||
name: [0; 32],
|
|
||||||
dst_font: ptr::null_mut(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, Default)]
|
#[derive(Copy, Clone, Debug, Default)]
|
||||||
|
|||||||
@ -156,7 +156,11 @@ impl ImFontConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make_config(self) -> sys::ImFontConfig {
|
fn make_config(self) -> sys::ImFontConfig {
|
||||||
let mut config = sys::ImFontConfig::new();
|
let mut config = unsafe {
|
||||||
|
let mut config = mem::uninitialized();
|
||||||
|
sys::ImFontConfig_DefaultConstructor(&mut config);
|
||||||
|
config
|
||||||
|
};
|
||||||
config.size_pixels = self.size_pixels;
|
config.size_pixels = self.size_pixels;
|
||||||
config.oversample_h = self.oversample_h as c_int;
|
config.oversample_h = self.oversample_h as c_int;
|
||||||
config.oversample_v = self.oversample_v as c_int;
|
config.oversample_v = self.oversample_v as c_int;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user