#[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
impl FontFace
fn __assert_parent_type(&self)
Source§impl FontFace
impl FontFace
Sourcefn new_failed_font_face(global: &GlobalScope, can_gc: CanGc) -> Self
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.
Sourcefn new_inherited(
global: &GlobalScope,
family_name: DOMString,
source: StringOrArrayBufferViewOrArrayBuffer,
descriptors: &FontFaceDescriptors,
can_gc: CanGc,
) -> Self
fn new_inherited( global: &GlobalScope, family_name: DOMString, source: StringOrArrayBufferViewOrArrayBuffer, descriptors: &FontFaceDescriptors, can_gc: CanGc, ) -> Self
pub(crate) fn new( global: &GlobalScope, proto: Option<HandleObject<'_>>, font_family: DOMString, source: StringOrArrayBufferViewOrArrayBuffer, descriptors: &FontFaceDescriptors, can_gc: CanGc, ) -> DomRoot<Self>
pub(super) fn set_associated_font_face_set(&self, font_face_set: &FontFaceSet)
pub(super) fn loaded(&self) -> bool
pub(super) fn template(&self) -> Option<(LowercaseFontFamilyName, FontTemplate)>
Sourcefn validate_and_set_descriptors(
&self,
new_descriptors: FontFaceDescriptors,
) -> ErrorResult
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 DomObjectWrap<DomTypeHolder> for FontFace
impl DomObjectWrap<DomTypeHolder> for FontFace
Source§const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::FontFaceBinding::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::css::fontface::FontFace>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::css::fontface::FontFace>>}
const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::FontFaceBinding::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::css::fontface::FontFace>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::css::fontface::FontFace>>}
Source§impl FontFaceMethods<DomTypeHolder> for FontFace
impl FontFaceMethods<DomTypeHolder> for FontFace
Source§fn SetFamily(&self, family_name: DOMString) -> ErrorResult
fn SetFamily(&self, family_name: DOMString) -> ErrorResult
Source§fn SetStyle(&self, value: DOMString) -> ErrorResult
fn SetStyle(&self, value: DOMString) -> ErrorResult
Source§fn SetWeight(&self, value: DOMString) -> ErrorResult
fn SetWeight(&self, value: DOMString) -> ErrorResult
Source§fn SetStretch(&self, value: DOMString) -> ErrorResult
fn SetStretch(&self, value: DOMString) -> ErrorResult
Source§fn UnicodeRange(&self) -> DOMString
fn UnicodeRange(&self) -> DOMString
Source§fn SetUnicodeRange(&self, value: DOMString) -> ErrorResult
fn SetUnicodeRange(&self, value: DOMString) -> ErrorResult
Source§fn FeatureSettings(&self) -> DOMString
fn FeatureSettings(&self) -> DOMString
Source§fn SetFeatureSettings(&self, value: DOMString) -> ErrorResult
fn SetFeatureSettings(&self, value: DOMString) -> ErrorResult
Source§fn VariationSettings(&self) -> DOMString
fn VariationSettings(&self) -> DOMString
Source§fn SetVariationSettings(&self, value: DOMString) -> ErrorResult
fn SetVariationSettings(&self, value: DOMString) -> ErrorResult
Source§fn SetDisplay(&self, value: DOMString) -> ErrorResult
fn SetDisplay(&self, value: DOMString) -> ErrorResult
Source§fn AscentOverride(&self) -> DOMString
fn AscentOverride(&self) -> DOMString
Source§fn SetAscentOverride(&self, value: DOMString) -> ErrorResult
fn SetAscentOverride(&self, value: DOMString) -> ErrorResult
Source§fn DescentOverride(&self) -> DOMString
fn DescentOverride(&self) -> DOMString
Source§fn SetDescentOverride(&self, value: DOMString) -> ErrorResult
fn SetDescentOverride(&self, value: DOMString) -> ErrorResult
Source§fn LineGapOverride(&self) -> DOMString
fn LineGapOverride(&self) -> DOMString
Source§fn SetLineGapOverride(&self, value: DOMString) -> ErrorResult
fn SetLineGapOverride(&self, value: DOMString) -> ErrorResult
Source§fn Status(&self) -> FontFaceLoadStatus
fn Status(&self) -> FontFaceLoadStatus
Source§fn Load(&self) -> Rc<Promise>
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 Constructor(
window: &Window,
proto: Option<HandleObject<'_>>,
can_gc: CanGc,
family: DOMString,
source: StringOrArrayBufferViewOrArrayBuffer,
descriptors: &FontFaceDescriptors,
) -> DomRoot<FontFace>
fn Constructor( window: &Window, proto: Option<HandleObject<'_>>, can_gc: CanGc, family: DOMString, source: StringOrArrayBufferViewOrArrayBuffer, descriptors: &FontFaceDescriptors, ) -> DomRoot<FontFace>
Source§impl IDLInterface for FontFace
impl IDLInterface for FontFace
Source§impl MallocSizeOf for FontFace
impl MallocSizeOf for FontFace
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for FontFace
impl MutDomObject for FontFace
Source§impl ToJSValConvertible for FontFace
impl ToJSValConvertible for FontFace
impl Eq for FontFace
Auto Trait Implementations§
impl !Freeze for FontFace
impl !RefUnwindSafe for FontFace
impl !Send for FontFace
impl !Sync for FontFace
impl Unpin for FontFace
impl !UnwindSafe for FontFace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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