pub enum Font {
Base14(Base14Font),
Embedded(EmbeddedFontId),
}Expand description
A renderable font – either one of the Adobe Core 14 (no data embedded; outlines from the PDF reader) or a bundled TrueType cut (data embedded, subset per-document).
§Examples
use mos_fonts::{Base14Font, Font};
let font = Font::Base14(Base14Font::Helvetica);
assert_eq!(font.pdf_base_name(), "Helvetica");Variants§
Base14(Base14Font)
A Base14 face. Layout uses AFM metrics; PDF emit uses
WinAnsiEncoding + per-document /Differences.
Embedded(EmbeddedFontId)
A bundled embedded face. Layout uses rustybuzz shaping;
PDF emit produces a Type 0 CID font with /ToUnicode.
Implementations§
Source§impl Font
impl Font
Sourcepub const ALL_BASE14: [Font; 14]
pub const ALL_BASE14: [Font; 14]
All 14 Base14 faces in Mosaic’s PDF-resource order (F1..F14).
Page resource dictionaries always enumerate these – even when unused – so a Base14-only document’s byte output stays stable across runs. Embedded faces are added on top, per-document.
The ordering is decoupled from Base14Font::ALL: the
four pre-existing layout faces keep their historical F1..F4
resource numbers so existing integration goldens don’t shift.
Sourcepub const fn base14(self) -> Option<Base14Font>
pub const fn base14(self) -> Option<Base14Font>
If this is a Base14 face, return the underlying variant.
§Examples
use mos_fonts::{Base14Font, Font};
let font = Font::Base14(Base14Font::Courier);
assert_eq!(font.base14(), Some(Base14Font::Courier));Sourcepub const fn embedded(self) -> Option<EmbeddedFontId>
pub const fn embedded(self) -> Option<EmbeddedFontId>
If this is an embedded face, return its bundled id.
§Examples
use mos_fonts::{EmbeddedFontId, Font};
let font = Font::Embedded(EmbeddedFontId::Bold);
assert_eq!(font.embedded(), Some(EmbeddedFontId::Bold));Sourcepub fn pdf_base_name(self) -> &'static str
pub fn pdf_base_name(self) -> &'static str
PDF /BaseFont name for Base14 (e.g. "Helvetica-BoldOblique")
or the embedded face’s PostScript name. The embedded path also
gets a six-letter subset tag in the actual PDF emission, but that
belongs to the per-document subset, not the bundled cut.
§Examples
use mos_fonts::{Base14Font, Font};
let font = Font::Base14(Base14Font::HelveticaBoldOblique);
assert_eq!(font.pdf_base_name(), "Helvetica-BoldOblique");Sourcepub fn pdf_resource_name(self) -> &'static [u8] ⓘ
pub fn pdf_resource_name(self) -> &'static [u8] ⓘ
Stable per-resource name (F1..F14 for Base14, F15..F20
for embedded). Page font dictionaries map these to indirect
font refs.
§Examples
use mos_fonts::{Base14Font, Font};
let font = Font::Base14(Base14Font::Helvetica);
assert_eq!(font.pdf_resource_name(), b"F1");Trait Implementations§
Source§impl From<Base14Font> for Font
impl From<Base14Font> for Font
Source§fn from(f: Base14Font) -> Font
fn from(f: Base14Font) -> Font
Source§impl From<EmbeddedFontId> for Font
impl From<EmbeddedFontId> for Font
Source§fn from(id: EmbeddedFontId) -> Font
fn from(id: EmbeddedFontId) -> Font
impl Copy for Font
impl Eq for Font
impl StructuralPartialEq for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnsafeUnpin for Font
impl UnwindSafe for Font
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> 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.