pub struct FontAsset {
pub id: String,
pub path: String,
pub hash: DocumentId,
pub format: FontFormat,
pub size: u64,
pub family: String,
pub weight: FontWeight,
pub style: FontStyle,
pub unicode_range: Option<String>,
pub feature_settings: Option<String>,
pub variation_settings: Option<String>,
pub license: Option<String>,
}Expand description
A font asset embedded in a Codex document.
Fields§
§id: StringUnique identifier for the font.
path: StringPath within the archive (e.g., “assets/fonts/roboto-regular.woff2”).
hash: DocumentIdContent hash for verification.
format: FontFormatFont format.
size: u64File size in bytes.
family: StringFont family name.
weight: FontWeightFont weight.
style: FontStyleFont style.
unicode_range: Option<String>Unicode range covered (CSS unicode-range format).
feature_settings: Option<String>Font feature settings.
variation_settings: Option<String>Font variation settings (for variable fonts).
license: Option<String>License information.
Implementations§
Source§impl FontAsset
impl FontAsset
Sourcepub fn new(
id: impl Into<String>,
family: impl Into<String>,
format: FontFormat,
) -> Self
pub fn new( id: impl Into<String>, family: impl Into<String>, format: FontFormat, ) -> Self
Create a new font asset.
Sourcepub fn with_hash(self, hash: DocumentId) -> Self
pub fn with_hash(self, hash: DocumentId) -> Self
Set the content hash.
Sourcepub const fn with_weight(self, weight: FontWeight) -> Self
pub const fn with_weight(self, weight: FontWeight) -> Self
Set the font weight.
Sourcepub const fn with_style(self, style: FontStyle) -> Self
pub const fn with_style(self, style: FontStyle) -> Self
Set the font style.
Sourcepub fn with_unicode_range(self, range: impl Into<String>) -> Self
pub fn with_unicode_range(self, range: impl Into<String>) -> Self
Set the unicode range.
Sourcepub fn with_license(self, license: impl Into<String>) -> Self
pub fn with_license(self, license: impl Into<String>) -> Self
Set the license.
Trait Implementations§
Source§impl Asset for FontAsset
impl Asset for FontAsset
Source§fn hash(&self) -> &DocumentId
fn hash(&self) -> &DocumentId
Get the content hash of the asset.
Source§impl<'de> Deserialize<'de> for FontAsset
impl<'de> Deserialize<'de> for FontAsset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FontAsset
impl StructuralPartialEq for FontAsset
Auto Trait Implementations§
impl Freeze for FontAsset
impl RefUnwindSafe for FontAsset
impl Send for FontAsset
impl Sync for FontAsset
impl Unpin for FontAsset
impl UnsafeUnpin for FontAsset
impl UnwindSafe for FontAsset
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.