mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
stylo: Add bindings for fetching font metrics from Gecko
This commit is contained in:
parent
80f6160580
commit
1154600dd4
4 changed files with 63 additions and 0 deletions
|
@ -343,6 +343,7 @@ mod bindings {
|
||||||
"FragmentOrURL",
|
"FragmentOrURL",
|
||||||
"FrameRequestCallback",
|
"FrameRequestCallback",
|
||||||
"GeckoParserExtraData",
|
"GeckoParserExtraData",
|
||||||
|
"GeckoFontMetrics",
|
||||||
"gfxAlternateValue",
|
"gfxAlternateValue",
|
||||||
"gfxFontFeature",
|
"gfxFontFeature",
|
||||||
"gfxFontVariation",
|
"gfxFontVariation",
|
||||||
|
@ -626,6 +627,7 @@ mod bindings {
|
||||||
"FontFamilyList",
|
"FontFamilyList",
|
||||||
"FontFamilyType",
|
"FontFamilyType",
|
||||||
"FontSizePrefs",
|
"FontSizePrefs",
|
||||||
|
"GeckoFontMetrics",
|
||||||
"Keyframe",
|
"Keyframe",
|
||||||
"ServoBundledURI",
|
"ServoBundledURI",
|
||||||
"ServoElementSnapshot",
|
"ServoElementSnapshot",
|
||||||
|
|
|
@ -28,6 +28,7 @@ use gecko_bindings::structs::ComputedTimingFunction_BeforeFlag;
|
||||||
use gecko_bindings::structs::FontFamilyList;
|
use gecko_bindings::structs::FontFamilyList;
|
||||||
use gecko_bindings::structs::FontFamilyType;
|
use gecko_bindings::structs::FontFamilyType;
|
||||||
use gecko_bindings::structs::FontSizePrefs;
|
use gecko_bindings::structs::FontSizePrefs;
|
||||||
|
use gecko_bindings::structs::GeckoFontMetrics;
|
||||||
use gecko_bindings::structs::Keyframe;
|
use gecko_bindings::structs::Keyframe;
|
||||||
use gecko_bindings::structs::ServoBundledURI;
|
use gecko_bindings::structs::ServoBundledURI;
|
||||||
use gecko_bindings::structs::ServoElementSnapshot;
|
use gecko_bindings::structs::ServoElementSnapshot;
|
||||||
|
@ -1076,6 +1077,12 @@ extern "C" {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_GetBaseSize(lang: *mut nsIAtom) -> FontSizePrefs;
|
pub fn Gecko_GetBaseSize(lang: *mut nsIAtom) -> FontSizePrefs;
|
||||||
}
|
}
|
||||||
|
extern "C" {
|
||||||
|
pub fn Gecko_GetFontMetrics(pres_context: RawGeckoPresContextBorrowed,
|
||||||
|
is_vertical: bool, font: *const nsStyleFont,
|
||||||
|
font_size: nscoord, use_user_font_set: bool)
|
||||||
|
-> GeckoFontMetrics;
|
||||||
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Gecko_GetMediaFeatures() -> *const nsMediaFeature;
|
pub fn Gecko_GetMediaFeatures() -> *const nsMediaFeature;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27213,6 +27213,33 @@ pub mod root {
|
||||||
fn clone(&self) -> Self { *self }
|
fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Copy)]
|
||||||
|
pub struct GeckoFontMetrics {
|
||||||
|
pub mChSize: root::nscoord,
|
||||||
|
pub mXSize: root::nscoord,
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn bindgen_test_layout_GeckoFontMetrics() {
|
||||||
|
assert_eq!(::std::mem::size_of::<GeckoFontMetrics>() , 8usize , concat
|
||||||
|
! ( "Size of: " , stringify ! ( GeckoFontMetrics ) ));
|
||||||
|
assert_eq! (::std::mem::align_of::<GeckoFontMetrics>() , 4usize ,
|
||||||
|
concat ! (
|
||||||
|
"Alignment of " , stringify ! ( GeckoFontMetrics ) ));
|
||||||
|
assert_eq! (unsafe {
|
||||||
|
& ( * ( 0 as * const GeckoFontMetrics ) ) . mChSize as *
|
||||||
|
const _ as usize } , 0usize , concat ! (
|
||||||
|
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
|
||||||
|
, "::" , stringify ! ( mChSize ) ));
|
||||||
|
assert_eq! (unsafe {
|
||||||
|
& ( * ( 0 as * const GeckoFontMetrics ) ) . mXSize as *
|
||||||
|
const _ as usize } , 4usize , concat ! (
|
||||||
|
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
|
||||||
|
, "::" , stringify ! ( mXSize ) ));
|
||||||
|
}
|
||||||
|
impl Clone for GeckoFontMetrics {
|
||||||
|
fn clone(&self) -> Self { *self }
|
||||||
|
}
|
||||||
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct nsROCSSPrimitiveValue([u8; 0]);
|
pub struct nsROCSSPrimitiveValue([u8; 0]);
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
|
@ -26554,6 +26554,33 @@ pub mod root {
|
||||||
fn clone(&self) -> Self { *self }
|
fn clone(&self) -> Self { *self }
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
#[derive(Debug, Copy)]
|
||||||
|
pub struct GeckoFontMetrics {
|
||||||
|
pub mChSize: root::nscoord,
|
||||||
|
pub mXSize: root::nscoord,
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn bindgen_test_layout_GeckoFontMetrics() {
|
||||||
|
assert_eq!(::std::mem::size_of::<GeckoFontMetrics>() , 8usize , concat
|
||||||
|
! ( "Size of: " , stringify ! ( GeckoFontMetrics ) ));
|
||||||
|
assert_eq! (::std::mem::align_of::<GeckoFontMetrics>() , 4usize ,
|
||||||
|
concat ! (
|
||||||
|
"Alignment of " , stringify ! ( GeckoFontMetrics ) ));
|
||||||
|
assert_eq! (unsafe {
|
||||||
|
& ( * ( 0 as * const GeckoFontMetrics ) ) . mChSize as *
|
||||||
|
const _ as usize } , 0usize , concat ! (
|
||||||
|
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
|
||||||
|
, "::" , stringify ! ( mChSize ) ));
|
||||||
|
assert_eq! (unsafe {
|
||||||
|
& ( * ( 0 as * const GeckoFontMetrics ) ) . mXSize as *
|
||||||
|
const _ as usize } , 4usize , concat ! (
|
||||||
|
"Alignment of field: " , stringify ! ( GeckoFontMetrics )
|
||||||
|
, "::" , stringify ! ( mXSize ) ));
|
||||||
|
}
|
||||||
|
impl Clone for GeckoFontMetrics {
|
||||||
|
fn clone(&self) -> Self { *self }
|
||||||
|
}
|
||||||
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
pub struct nsROCSSPrimitiveValue([u8; 0]);
|
pub struct nsROCSSPrimitiveValue([u8; 0]);
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue