pub enum EmbeddedFontId {
Regular,
Bold,
Italic,
BoldItalic,
Mono,
Math,
}Expand description
Stable identifier for each bundled embedded cut. Used as the enum
payload of Font::Embedded so Font stays Copy/Hash/Eq
without resorting to pointer identity.
The crate ships three bundled families today: Noto Sans (four style
cuts – Regular/Bold/Italic/BoldItalic) for proportional
body text, Noto Sans Mono (one cut – Mono) for `raw` runs,
and Noto Sans Math (one cut – Math) as the per-glyph fallback for
math operators when the primary face doesn’t cover them. The
flat-enum shape is deliberate at this scale – when a fourth family
lands the right move is restructuring to { family, cut } rather
than expanding this enum variant-by-variant further.
§Examples
use mos_fonts::EmbeddedFontId;
let id = EmbeddedFontId::Regular;
assert_eq!(id.pdf_resource_index(), 15);Variants§
Regular
Noto Sans Regular.
Bold
Noto Sans Bold.
Italic
Noto Sans Italic.
BoldItalic
Noto Sans Bold Italic.
Mono
Noto Sans Mono Regular. The crate’s monospace face for raw runs.
Math
Noto Sans Math Regular. The crate’s math face – covers
<= >= != sqrt partial sum delta diamond minus and broader
Unicode math. Used as the default fallback target on
crate::FontFamily::noto_sans so math codepoints route through
it when shaping yields .notdef against the primary face.
Implementations§
Source§impl EmbeddedFontId
impl EmbeddedFontId
Sourcepub const ALL: [EmbeddedFontId; 6]
pub const ALL: [EmbeddedFontId; 6]
All bundled embedded cuts in a stable order. Used by the PDF
backend to enumerate /Font resource entries deterministically.
Sourcepub fn data(self) -> &'static EmbeddedFont
pub fn data(self) -> &'static EmbeddedFont
Resolve to the bundled EmbeddedFont data. Initialised on
first use; subsequent calls return the same &'static reference.
§Examples
use mos_fonts::EmbeddedFontId;
let data = EmbeddedFontId::Regular.data();
assert_eq!(data.postscript_name, "NotoSans");Sourcepub const fn pdf_resource_index(self) -> u8
pub const fn pdf_resource_index(self) -> u8
PDF resource-name index n for Fn. F1..F14 are reserved for
the 14 Base14 fonts (see mos-pdf’s Base14 resource layout);
embedded cuts use F15..=F255. The number is stable per
variant forever – never re-number for byte-stability.
Adding a new bundled cut is one match arm here plus a
RESOURCE_NAMES-table lookup; the 256-entry table in
$OUT_DIR/resource_names.rs is generated by build.rs and
already accommodates F20..=F255 with no per-variant churn.
§Examples
use mos_fonts::EmbeddedFontId;
assert_eq!(EmbeddedFontId::Math.pdf_resource_index(), 20);Sourcepub fn pdf_resource_name(self) -> &'static [u8] ⓘ
pub fn pdf_resource_name(self) -> &'static [u8] ⓘ
PDF resource name (b"F<n>") for this cut. Backed by a baked
[&[u8]; 256] LUT generated at build time so future variants
only need to pick an unused index above and the name resolves
automatically.
§Examples
use mos_fonts::EmbeddedFontId;
assert_eq!(EmbeddedFontId::Regular.pdf_resource_name(), b"F15");Trait Implementations§
Source§impl Clone for EmbeddedFontId
impl Clone for EmbeddedFontId
Source§fn clone(&self) -> EmbeddedFontId
fn clone(&self) -> EmbeddedFontId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EmbeddedFontId
impl Debug for EmbeddedFontId
Source§impl From<EmbeddedFontId> for Font
impl From<EmbeddedFontId> for Font
Source§fn from(id: EmbeddedFontId) -> Font
fn from(id: EmbeddedFontId) -> Font
Source§impl Hash for EmbeddedFontId
impl Hash for EmbeddedFontId
Source§impl Ord for EmbeddedFontId
impl Ord for EmbeddedFontId
Source§fn cmp(&self, other: &EmbeddedFontId) -> Ordering
fn cmp(&self, other: &EmbeddedFontId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EmbeddedFontId
impl PartialEq for EmbeddedFontId
Source§impl PartialOrd for EmbeddedFontId
impl PartialOrd for EmbeddedFontId
impl Copy for EmbeddedFontId
impl Eq for EmbeddedFontId
impl StructuralPartialEq for EmbeddedFontId
Auto Trait Implementations§
impl Freeze for EmbeddedFontId
impl RefUnwindSafe for EmbeddedFontId
impl Send for EmbeddedFontId
impl Sync for EmbeddedFontId
impl Unpin for EmbeddedFontId
impl UnsafeUnpin for EmbeddedFontId
impl UnwindSafe for EmbeddedFontId
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.