diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-01 00:01:17 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-01 00:10:54 +0200 |
| commit | 06dbac6efd98be5a015023c88ed3dbd9a35a4594 (patch) | |
| tree | bb3c75230098bf71d1ac23bbe7184e4ae7a6cef2 /src/style.rs | |
| parent | 064954cf9edbb0201b6184e69978f86e93741008 (diff) | |
Port font handling to fontdock and ttf-parser 🛳
- Use fontdock for indexing fonts and querying
- Typst binary now automatically indexes and uses system fonts in addition to a fixed font folder!
- Removes subsetting support for now (was half-finished anyways, plan is to use harfbuzz for subsetting in the future)
- Adds font width configuration support
Diffstat (limited to 'src/style.rs')
| -rw-r--r-- | src/style.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/style.rs b/src/style.rs index 2c74adde..ca05d68f 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,7 +1,6 @@ //! Styles for text and pages. -use toddle::fallback; -use toddle::query::{FallbackTree, FontVariant, FontStyle, FontWeight}; +use fontdock::{fallback, FallbackTree, FontVariant, FontStyle, FontWeight, FontWidth}; use crate::length::{Length, Size, Margins, Value4, ScaleLength}; use crate::paper::{Paper, PaperClass, PAPER_A4}; @@ -17,13 +16,16 @@ pub struct LayoutStyle { /// Defines which fonts to use and how to space text. #[derive(Debug, Clone, PartialEq)] pub struct TextStyle { - /// A tree of font names and generic family names. + /// A tree of font family names and generic class names. pub fallback: FallbackTree, /// The selected font variant. pub variant: FontVariant, /// Whether the bolder toggle is active or inactive. This determines /// whether the next `*` adds or removes font weight. pub bolder: bool, + /// Whether the italic toggle is active or inactive. This determines + /// whether the next `_` makes italic or non-italic. + pub italic: bool, /// The base font size. pub base_font_size: Length, /// The font scale to apply on the base font size. @@ -75,8 +77,10 @@ impl Default for TextStyle { variant: FontVariant { style: FontStyle::Normal, weight: FontWeight(400), + width: FontWidth::Medium, }, bolder: false, + italic: false, base_font_size: Length::pt(11.0), font_scale: 1.0, word_spacing_scale: 0.25, |
