summaryrefslogtreecommitdiff
path: root/src/style.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-08-01 17:42:08 +0200
committerGitHub <noreply@github.com>2020-08-01 17:42:08 +0200
commit4ac3aa6ebc7c80945fd6c4a97a531d520e965879 (patch)
treebb3c75230098bf71d1ac23bbe7184e4ae7a6cef2 /src/style.rs
parent064954cf9edbb0201b6184e69978f86e93741008 (diff)
parent06dbac6efd98be5a015023c88ed3dbd9a35a4594 (diff)
Merge pull request #9 from typst/port-fontdock
Port font handling to fontdock and ttf-parser 🛳
Diffstat (limited to 'src/style.rs')
-rw-r--r--src/style.rs10
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,