From 84bd3454df487500d8a084190b4a10eac2a9f0f1 Mon Sep 17 00:00:00 2001 From: Martin Haug Date: Wed, 11 May 2022 15:19:03 +0200 Subject: Write language and direction for PDFs --- src/library/text/lang.rs | 2 +- src/library/text/shaping.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/library') diff --git a/src/library/text/lang.rs b/src/library/text/lang.rs index 360827fa..b75b3cd8 100644 --- a/src/library/text/lang.rs +++ b/src/library/text/lang.rs @@ -28,7 +28,7 @@ impl Lang { } /// The default direction for the language. - pub fn dir(&self) -> Dir { + pub fn dir(self) -> Dir { match self.as_str() { "ar" | "dv" | "fa" | "he" | "ks" | "pa" | "ps" | "sd" | "ug" | "ur" | "yi" => Dir::RTL, diff --git a/src/library/text/shaping.rs b/src/library/text/shaping.rs index 80f1b17d..66a9f7c2 100644 --- a/src/library/text/shaping.rs +++ b/src/library/text/shaping.rs @@ -104,7 +104,13 @@ impl<'a> ShapedText<'a> { }) .collect(); - let text = Text { face_id, size: self.size, fill, glyphs }; + let text = Text { + face_id, + size: self.size, + lang: self.styles.get(TextNode::LANG), + fill, + glyphs, + }; let text_layer = frame.layer(); let width = text.width(); -- cgit v1.2.3