diff --git a/CHANGELOG.md b/CHANGELOG.md index e77dde2..1d8e9ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] - ReleaseDate +### Added + +- Add regular variant of Fontin font + ## [0.2.5] - 2025-10-30 ### Added @@ -93,8 +97,8 @@ - First release -[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.5...HEAD +[Unreleased]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.5...HEAD [0.2.5]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.4...v0.2.5 [0.2.4]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.3...v0.2.4 [0.2.3]: https://github.com/meehl/rusty-path-of-building/compare/v0.2.2...v0.2.3 diff --git a/fonts/fontin-regular.ttf b/fonts/fontin-regular.ttf new file mode 100644 index 0000000..3284fe2 Binary files /dev/null and b/fonts/fontin-regular.ttf differ diff --git a/src/api/rendering.rs b/src/api/rendering.rs index 8d0a764..e93083b 100644 --- a/src/api/rendering.rs +++ b/src/api/rendering.rs @@ -476,6 +476,7 @@ fn build_layout_job<'a>( font_weight = Some(700.0); FontFamily::Named(Cow::Borrowed("Liberation Sans")) } + PoBFontType::Fontin => FontFamily::Named(Cow::Borrowed("Fontin")), PoBFontType::FontinItalic => FontFamily::Named(Cow::Borrowed("Fontin")), PoBFontType::FontinSmallcaps => FontFamily::Named(Cow::Borrowed("Fontin SmallCaps")), PoBFontType::FontinSmallcapsItalic => { @@ -634,6 +635,7 @@ enum PoBFontType { VarBold, FontinSmallcaps, FontinSmallcapsItalic, + Fontin, FontinItalic, } @@ -647,6 +649,7 @@ impl std::str::FromStr for PoBFontType { "VAR BOLD" => Ok(Self::VarBold), "FONTIN SC" => Ok(Self::FontinSmallcaps), "FONTIN SC ITALIC" => Ok(Self::FontinSmallcapsItalic), + "FONTIN" => Ok(Self::Fontin), "FONTIN ITALIC" => Ok(Self::FontinItalic), _ => Err(anyhow::anyhow!( "'{}' is not a valid TextFontType variant", diff --git a/src/app.rs b/src/app.rs index d255b7a..181a325 100644 --- a/src/app.rs +++ b/src/app.rs @@ -299,6 +299,12 @@ fn pob_font_definitions() -> FontDefinitions { "../fonts/LiberationSans-Bold.ttf" ))), ); + definitions.font_data.insert( + "fontin-regular".to_owned(), + Arc::new(FontData::from_static(include_bytes!( + "../fonts/fontin-regular.ttf" + ))), + ); definitions.font_data.insert( "fontin-italic".to_owned(), Arc::new(FontData::from_static(include_bytes!( @@ -327,7 +333,11 @@ fn pob_font_definitions() -> FontDefinitions { definitions.generic_families.insert( parley::GenericFamily::Serif, - vec!["fontin-italic".to_owned(), "fontin-smallcaps".to_owned()], + vec![ + "fontin-regular".to_owned(), + "fontin-italic".to_owned(), + "fontin-smallcaps".to_owned(), + ], ); definitions