script::dom::fontface

Struct FontFace

Source
#[repr(C)]
pub struct FontFace { reflector: Reflector, status: Cell<FontFaceLoadStatus>, family_name: DomRefCell<DOMString>, descriptors: DomRefCell<FontFaceDescriptors>, font_face_set: MutNullableDom<FontFaceSet>, template: RefCell<Option<(LowercaseFontFamilyName, FontTemplate)>>, urls: DomRefCell<Option<SourceList>>, font_status_promise: Rc<Promise>, }
Expand description

Fields§

§reflector: Reflector§status: Cell<FontFaceLoadStatus>§family_name: DomRefCell<DOMString>§descriptors: DomRefCell<FontFaceDescriptors>§font_face_set: MutNullableDom<FontFaceSet>

A reference to the FontFaceSet that this FontFace is a member of, if it has been added to one. None otherwise. The spec suggests that a FontFace can be a member of multiple FontFaceSets, but this doesn’t seem to be the case in practice, as the FontFaceSet constructor is not exposed on the global scope.

§template: RefCell<Option<(LowercaseFontFamilyName, FontTemplate)>>

This holds the FontTemplate resulting from loading this FontFace, to be used when the FontFace is added to the global FontFaceSet and thus the [FontContext].

§urls: DomRefCell<Option<SourceList>>§font_status_promise: Rc<Promise>

Implementations§

Source§

impl FontFace

Source§

impl FontFace

Source

fn new_failed_font_face(global: &GlobalScope, can_gc: CanGc) -> Self

Construct a FontFace to be used in the case of failure in parsing the font face descriptors.

Source

fn new_inherited( global: &GlobalScope, family_name: DOMString, source: StringOrArrayBufferViewOrArrayBuffer, descriptors: &FontFaceDescriptors, can_gc: CanGc, ) -> Self

Source

pub(crate) fn new( global: &GlobalScope, proto: Option<HandleObject<'_>>, font_family: DOMString, source: StringOrArrayBufferViewOrArrayBuffer, descriptors: &FontFaceDescriptors, can_gc: CanGc, ) -> DomRoot<Self>

Source

pub(super) fn set_associated_font_face_set(&self, font_face_set: &FontFaceSet)

Source

pub(super) fn loaded(&self) -> bool

Source

pub(super) fn template(&self) -> Option<(LowercaseFontFamilyName, FontTemplate)>

Source

fn validate_and_set_descriptors( &self, new_descriptors: FontFaceDescriptors, ) -> ErrorResult

Implements the body of the setter for the descriptor attributes of the FontFace interface.

https://drafts.csswg.org/css-font-loading/#fontface-interface: On setting, parse the string according to the grammar for the corresponding @font-face descriptor. If it does not match the grammar, throw a SyntaxError; otherwise, set the attribute to the serialization of the parsed value.

Trait Implementations§

Source§

impl DomObject for FontFace

Source§

fn reflector(&self) -> &Reflector

Returns the receiver’s reflector.
Source§

impl DomObjectWrap<DomTypeHolder> for FontFace

Source§

const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::GenericBindings::FontFaceBinding::FontFace_Binding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::fontface::FontFace>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::fontface::FontFace>>}

Function pointer to the general wrap function type
Source§

impl FontFaceMethods<DomTypeHolder> for FontFace

Source§

fn Family(&self) -> DOMString

Source§

fn SetFamily(&self, family_name: DOMString) -> ErrorResult

Source§

fn Style(&self) -> DOMString

Source§

fn SetStyle(&self, value: DOMString) -> ErrorResult

Source§

fn Weight(&self) -> DOMString

Source§

fn SetWeight(&self, value: DOMString) -> ErrorResult

Source§

fn Stretch(&self) -> DOMString

Source§

fn SetStretch(&self, value: DOMString) -> ErrorResult

Source§

fn UnicodeRange(&self) -> DOMString

Source§

fn SetUnicodeRange(&self, value: DOMString) -> ErrorResult

Source§

fn FeatureSettings(&self) -> DOMString

Source§

fn SetFeatureSettings(&self, value: DOMString) -> ErrorResult

Source§

fn VariationSettings(&self) -> DOMString

Source§

fn SetVariationSettings(&self, value: DOMString) -> ErrorResult

Source§

fn Display(&self) -> DOMString

Source§

fn SetDisplay(&self, value: DOMString) -> ErrorResult

Source§

fn AscentOverride(&self) -> DOMString

Source§

fn SetAscentOverride(&self, value: DOMString) -> ErrorResult

Source§

fn DescentOverride(&self) -> DOMString

Source§

fn SetDescentOverride(&self, value: DOMString) -> ErrorResult

Source§

fn LineGapOverride(&self) -> DOMString

Source§

fn SetLineGapOverride(&self, value: DOMString) -> ErrorResult

Source§

fn Status(&self) -> FontFaceLoadStatus

Source§

fn Load(&self) -> Rc<Promise>

The load() method of FontFace forces a url-based font face to request its font data and load. For fonts constructed from a buffer source, or fonts that are already loading or loaded, it does nothing. https://drafts.csswg.org/css-font-loading/#font-face-load

Source§

fn Loaded(&self) -> Rc<Promise>

Source§

fn Constructor( window: &Window, proto: Option<HandleObject<'_>>, can_gc: CanGc, family: DOMString, source: StringOrArrayBufferViewOrArrayBuffer, descriptors: &FontFaceDescriptors, ) -> DomRoot<FontFace>

Source§

impl HasParent for FontFace

Source§

fn as_parent(&self) -> &Reflector

This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is

Source§

type Parent = Reflector

Source§

impl IDLInterface for FontFace

Source§

fn derives(class: &'static DOMClass) -> bool

Returns whether the given DOM class derives that interface.
Source§

impl MallocSizeOf for FontFace

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
Source§

impl MutDomObject for FontFace

Source§

unsafe fn init_reflector(&self, obj: *mut JSObject)

Initializes the Reflector Read more
Source§

impl PartialEq for FontFace

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToJSValConvertible for FontFace

Source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
Source§

impl Traceable for FontFace

Source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.
Source§

impl Eq for FontFace

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ThisReflector for T
where T: DomObject,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T