diff options
| author | Martin Haug <mhaug@live.de> | 2022-05-11 15:19:03 +0200 |
|---|---|---|
| committer | Martin Haug <mhaug@live.de> | 2022-05-11 16:25:49 +0200 |
| commit | 84bd3454df487500d8a084190b4a10eac2a9f0f1 (patch) | |
| tree | c98b688cc02564a287de43d45abf3d5dad576338 /src/library | |
| parent | a247653cd0f324bf6985c963d958348e29ade334 (diff) | |
Write language and direction for PDFs
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/text/lang.rs | 2 | ||||
| -rw-r--r-- | src/library/text/shaping.rs | 8 |
2 files changed, 8 insertions, 2 deletions
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(); |
