diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2022-03-01 23:24:00 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2022-03-01 23:46:08 +0100 |
commit | 6693ff05696d71a9ca556760a1597b48a95c5298 (patch) | |
tree | 60ecba671d0eb7cea04c1b20cf35151b614a161d /gnu/packages | |
parent | 3854558c76ac51787f0fdb4cac226b678a9ad621 (diff) |
gnu: tectonic: Update to 0.8.1.
* gnu/packages/rust-apps.scm (tectonic): Update to 0.8.1.
[inputs]: Add FREETYPE, GRAPHITE2, ICU4C, LIBPNG.
* gnu/packages/crates-io.scm (rust-pinot-0.1)[origin]<patches>: Add patch
necessary for Tectonic.
(rust-tectonic-docmodel-0.1): Update to 0.1.2.
(rust-tectonic-engine-spx2html-0.1): New variable.
(rust-tectonic-engine-xetex-0.2): New variable.
(rust-tectonic-engine-xetex-0.1): Remove variable.
(rust-tectonic-io-base-0.4): New variable.
(rust-tectonic-io-base-0.3): Inherit from above.
(rust-tectonic-xdv-0.2): New variable.
(rust-tectonic-xdv-0.1): Remove variable.
* gnu/packages/patches/rust-pinot-0.1-implement-math-table.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register new file.
Diffstat (limited to 'gnu/packages')
-rw-r--r-- | gnu/packages/crates-io.scm | 87 | ||||
-rw-r--r-- | gnu/packages/patches/rust-pinot-0.1-implement-math-table.patch | 223 | ||||
-rw-r--r-- | gnu/packages/rust-apps.scm | 23 |
3 files changed, 309 insertions, 24 deletions
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index e5a48be473..37aeb9f82a 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -42442,7 +42442,9 @@ written with declarative macros.") (uri (crate-uri "pinot" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "153di76kx7xb4mp2i14zg1wkz3mclivv4c77mbhh7af553yqnsnh")))) + (base32 "153di76kx7xb4mp2i14zg1wkz3mclivv4c77mbhh7af553yqnsnh")) + ;; XXX: This patch is needed by Tectonic. + (patches (search-patches "rust-pinot-0.1-implement-math-table.patch")))) (build-system cargo-build-system) (arguments `(#:skip-build? #t)) (home-page "https://github.com/dfrg/pinot") @@ -60925,14 +60927,14 @@ process.") (define-public rust-tectonic-docmodel-0.1 (package (name "rust-tectonic-docmodel") - (version "0.1.0") + (version "0.1.2") (source (origin (method url-fetch) (uri (crate-uri "tectonic_docmodel" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "041hbp5rjrnnf6pbi7b9039jx5vn5f0d9fwhk0vshwjn69jmknkm")))) + (base32 "1b5vdqcnjbbda6am0mb7qyxyc6pn8v0pqz0w10xia87ycyyfflxw")))) (build-system cargo-build-system) (arguments `(#:skip-build? #t @@ -60974,25 +60976,55 @@ document model, including the @file{Tectonic.toml} file.") @code{bibtex} program as a reusable crate.") (license license:expat))) -(define-public rust-tectonic-engine-xetex-0.1 +(define-public rust-tectonic-engine-spx2html-0.1 + (package + (name "rust-tectonic-engine-spx2html") + (version "0.1.0") + (source + (origin + (method url-fetch) + (uri (crate-uri "tectonic_engine_spx2html" version)) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "0ydn2j4359fzd9dik4lpw68jwngcbgvlpwig9np50cb40dssvy09")))) + (build-system cargo-build-system) + (arguments + `(#:skip-build? #t + #:cargo-inputs + (("rust-byteorder" ,rust-byteorder-1) + ("rust-percent-encoding" ,rust-percent-encoding-2) + ("rust-pinot" ,rust-pinot-0.1) + ("rust-tectonic-bridge-core" ,rust-tectonic-bridge-core-0.3) + ("rust-tectonic-errors" ,rust-tectonic-errors-0.2) + ("rust-tectonic-io-base" ,rust-tectonic-io-base-0.4) + ("rust-tectonic-status-base" ,rust-tectonic-status-base-0.2) + ("rust-tectonic-xdv" ,rust-tectonic-xdv-0.2) + ("rust-tempfile" ,rust-tempfile-3) + ("rust-tera" ,rust-tera-1)))) + (home-page "https://tectonic-typesetting.github.io/") + (synopsis "Tectonic engine that converts SPX output to HTML") + (description "This crate implements the Tectonic engine that converts SPX +output to HTML.") + (license license:expat))) + +(define-public rust-tectonic-engine-xetex-0.2 (package (name "rust-tectonic-engine-xetex") - (version "0.1.1") + (version "0.2.0") (source (origin (method url-fetch) (uri (crate-uri "tectonic_engine_xetex" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "0ki06fsqx7rb683gz4d5xz248gwvpzf137zqrg8whsrazaqgzmfq")))) + (base32 "1kn9gxkgf3jbwif14n1kmp869s4b69khhc7iwm78qqpmy79lrhkw")))) (build-system cargo-build-system) (arguments `(#:skip-build? #t #:cargo-inputs - (("rust-cbindgen" ,rust-cbindgen-0.16) - ("rust-cc" ,rust-cc-1) + (("rust-cc" ,rust-cc-1) ("rust-libc" ,rust-libc-0.2) - ("rust-tectonic-bridge-core" ,rust-tectonic-bridge-core-0.1) + ("rust-tectonic-bridge-core" ,rust-tectonic-bridge-core-0.3) ("rust-tectonic-bridge-flate" ,rust-tectonic-bridge-flate-0.1) ("rust-tectonic-bridge-graphite2" ,rust-tectonic-bridge-graphite2-0.2) ("rust-tectonic-bridge-harfbuzz" ,rust-tectonic-bridge-harfbuzz-0.2) @@ -61104,17 +61136,17 @@ error type and utilities.") interface for fetching URLs using one of several HTTP backends.") (license license:expat))) -(define-public rust-tectonic-io-base-0.3 +(define-public rust-tectonic-io-base-0.4 (package (name "rust-tectonic-io-base") - (version "0.3.0") + (version "0.4.0") (source (origin (method url-fetch) (uri (crate-uri "tectonic_io_base" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "0xpcavx3chld8d5qa24ikf5v4l5slzkakqr4ylibx0f91ssy3bsm")))) + (base32 "0x1r4m5bkqqvz24sql9q8ycnjczlqjlhzfyaylzhxi2xx4flqdfn")))) (build-system cargo-build-system) (arguments `(#:skip-build? #t @@ -61124,7 +61156,7 @@ interface for fetching URLs using one of several HTTP backends.") ("rust-libc" ,rust-libc-0.2) ("rust-sha2" ,rust-sha2-0.9) ("rust-tectonic-errors" ,rust-tectonic-errors-0.2) - ("rust-tectonic-status-base" ,rust-tectonic-status-base-0.1) + ("rust-tectonic-status-base" ,rust-tectonic-status-base-0.2) ("rust-thiserror" ,rust-thiserror-1)))) (home-page "https://tectonic-typesetting.github.io/") (synopsis "Basic types for Tectonic's pluggable I/O backend system") @@ -61135,6 +61167,29 @@ implementations for @code{std} I/O types as well as @code{flate2} gzip streams.") (license license:expat))) +(define-public rust-tectonic-io-base-0.3 + (package + (inherit rust-tectonic-io-base-0.4) + (name "rust-tectonic-io-base") + (version "0.3.0") + (source + (origin + (method url-fetch) + (uri (crate-uri "tectonic_io_base" version)) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "0xpcavx3chld8d5qa24ikf5v4l5slzkakqr4ylibx0f91ssy3bsm")))) + (arguments + `(#:skip-build? #t + #:cargo-inputs + (("rust-app-dirs2" ,rust-app-dirs2-2) + ("rust-flate2" ,rust-flate2-1) + ("rust-libc" ,rust-libc-0.2) + ("rust-sha2" ,rust-sha2-0.9) + ("rust-tectonic-errors" ,rust-tectonic-errors-0.2) + ("rust-tectonic-status-base" ,rust-tectonic-status-base-0.1) + ("rust-thiserror" ,rust-thiserror-1)))))) + (define-public rust-tectonic-io-base-0.2 (package (inherit rust-tectonic-io-base-0.3) @@ -61229,17 +61284,17 @@ types for reporting status messages to a user.") #:cargo-inputs (("rust-tectonic-errors" ,rust-tectonic-errors-0.1)))))) -(define-public rust-tectonic-xdv-0.1 +(define-public rust-tectonic-xdv-0.2 (package (name "rust-tectonic-xdv") - (version "0.1.11") + (version "0.2.0") (source (origin (method url-fetch) (uri (crate-uri "tectonic_xdv" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "1ibxv32i7dla3iw6s01cagzgdgzhm1mmxwqjv841m6m4r7g57gxj")))) + (base32 "1fcys9v5zcdavfkq72h5ajkz2pxjpc6km6wqajk29qc65870xd5k")))) (build-system cargo-build-system) (arguments `(#:skip-build? #t diff --git a/gnu/packages/patches/rust-pinot-0.1-implement-math-table.patch b/gnu/packages/patches/rust-pinot-0.1-implement-math-table.patch new file mode 100644 index 0000000000..d9594f09c9 --- /dev/null +++ b/gnu/packages/patches/rust-pinot-0.1-implement-math-table.patch @@ -0,0 +1,223 @@ +From f93bac061c59a6efab309b43eb893bf041c93ee1 Mon Sep 17 00:00:00 2001 +From: Peter Williams <peter@newton.cx> +Date: Sun, 30 Jan 2022 11:12:58 -0500 +Subject: [PATCH] Start implementing the MATH table + +--- + src/font.rs | 6 ++ + src/lib.rs | 1 + + src/math.rs | 155 ++++++++++++++++++++++++++++++++++++++++++++++ + src/otl/shared.rs | 2 +- + 4 files changed, 163 insertions(+), 1 deletion(-) + create mode 100644 src/math.rs + +diff --git a/src/font.rs b/src/font.rs +index aeb17b5..762ff71 100644 +--- a/src/font.rs ++++ b/src/font.rs +@@ -13,6 +13,7 @@ use super::{ + hhea::*, + hmtx::*, + hvar::*, ++ math::*, + maxp::*, + name::*, + os2::*, +@@ -329,6 +330,11 @@ pub trait TableProvider<'a> { + fn gpos(&self) -> Option<Gpos<'a>> { + Some(Gpos::new(self.table_data(GPOS)?, self.gdef())) + } ++ ++ /// Returns the mathemetical typesetting table. ++ fn math(&self) -> Option<Math<'a>> { ++ Some(Math::new(self.table_data(MATH)?)) ++ } + } + + impl<'a> TableProvider<'a> for FontRef<'a> { +diff --git a/src/lib.rs b/src/lib.rs +index 8203630..d5e473d 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -14,6 +14,7 @@ pub mod head; + pub mod hhea; + pub mod hmtx; + pub mod hvar; ++pub mod math; + pub mod maxp; + pub mod name; + pub mod os2; +diff --git a/src/math.rs b/src/math.rs +new file mode 100644 +index 0000000..10a5ec6 +--- /dev/null ++++ b/src/math.rs +@@ -0,0 +1,155 @@ ++//! Mathematical typesetting table. ++ ++use super::otl::Coverage; ++use super::parse_prelude::*; ++ ++/// Tag for the `math` table. ++pub const MATH: Tag = Tag::new(b"MATH"); ++ ++/// Mathematical typesetting table. ++/// ++/// <https://docs.microsoft.com/en-us/typography/opentype/spec/math> ++/// ++/// The math constants and math glyph information subtables are not (yet) ++/// implemented. ++#[derive(Copy, Clone)] ++pub struct Math<'a>(Buffer<'a>); ++ ++impl<'a> Math<'a> { ++ /// Creates a new math table from a byte slice containing the table data. ++ pub fn new(data: &'a [u8]) -> Self { ++ Self(Buffer::new(data)) ++ } ++ ++ /// Returns the major version. ++ pub fn major_version(&self) -> u16 { ++ self.0.read(0).unwrap_or(0) ++ } ++ ++ /// Returns the minor version. ++ pub fn minor_version(&self) -> u16 { ++ self.0.read(2).unwrap_or(0) ++ } ++ ++ /// Returns the MathVariants subtable. ++ pub fn variants(&self) -> Option<MathVariants> { ++ let offset = self.0.read_offset16(8, 0)?; ++ Some(MathVariants { math: self, offset }) ++ } ++} ++ ++/// Mathematical variants subtable. ++/// ++/// <https://docs.microsoft.com/en-us/typography/opentype/spec/math#mathvariants-table> ++#[derive(Copy, Clone)] ++pub struct MathVariants<'a> { ++ math: &'a Math<'a>, ++ offset: u32, ++} ++ ++impl<'a> MathVariants<'a> { ++ /// Returns the minimum overlap of connecting glyphs during glyph ++ /// construction. ++ pub fn min_connector_overlap(&self) -> UfWord { ++ self.math.0.read(self.offset as usize).unwrap_or(0) ++ } ++ ++ /// Returns the number of glyphs for which information is provided for ++ /// vertically growing variants. ++ pub fn vert_glyph_count(&self) -> u16 { ++ self.math.0.read(self.offset as usize + 6).unwrap_or(0) ++ } ++ ++ /// Returns the number of glyphs for which information is provided for ++ /// horizontally growing variants. ++ pub fn horiz_glyph_count(&self) -> u16 { ++ self.math.0.read(self.offset as usize + 8).unwrap_or(0) ++ } ++ ++ /// Returns the coverage table associated with vertically growing glyphs. ++ pub fn vert_glyph_coverage(&self) -> Option<Coverage> { ++ let offset = self ++ .math ++ .0 ++ .read_offset16(self.offset as usize + 2, self.offset)?; ++ Some(Coverage::new(self.math.0, offset)) ++ } ++ ++ /// Returns the coverage table associated with horizontally growing glyphs. ++ pub fn horiz_glyph_coverage(&self) -> Option<Coverage> { ++ let offset = self ++ .math ++ .0 ++ .read_offset16(self.offset as usize + 4, self.offset)?; ++ Some(Coverage::new(self.math.0, offset)) ++ } ++ ++ /// Returns information about how to a construct vertically growing glyph, ++ /// based on its coverage index. ++ pub fn vert_glyph_construction(&self, coverage_index: u16) -> Option<MathGlyphConstruction> { ++ let offset = self.offset as usize + 10 + 2 * coverage_index as usize; ++ let offset = self.math.0.read_offset16(offset, self.offset)?; ++ Some(MathGlyphConstruction { ++ math: self.math, ++ offset: offset, ++ }) ++ } ++ ++ /// Returns information about how to a construct horizontally growing glyph, ++ /// based on its coverage index. ++ pub fn horiz_glyph_construction(&self, coverage_index: u16) -> Option<MathGlyphConstruction> { ++ let offset = self.offset as usize ++ + 10 ++ + 2 * self.vert_glyph_count() as usize ++ + 2 * coverage_index as usize; ++ let offset = self.math.0.read_offset16(offset, self.offset)?; ++ Some(MathGlyphConstruction { ++ math: self.math, ++ offset: offset, ++ }) ++ } ++} ++ ++/// Mathematical glyph construction subtable. ++/// ++/// <https://docs.microsoft.com/en-us/typography/opentype/spec/math#mathvariants-table> ++/// ++/// The "glyph assembly" subtable is not (yet) implemented. ++#[derive(Copy, Clone)] ++pub struct MathGlyphConstruction<'a> { ++ math: &'a Math<'a>, ++ offset: u32, ++} ++ ++impl<'a> MathGlyphConstruction<'a> { ++ /// Returns the number of growing variants for this glyph. ++ pub fn variant_count(&self) -> u16 { ++ self.math.0.read(self.offset as usize + 2).unwrap_or(0) ++ } ++ ++ /// Return the growing variants associated with this glyph. ++ pub fn variants(&self) -> Option<Slice<'a, MathGlyphVariantRecord>> { ++ self.math ++ .0 ++ .read_slice(self.offset as usize + 4, self.variant_count() as usize) ++ } ++} ++ ++/// Information about a math glyph variant. ++#[derive(Copy, Clone, Debug)] ++pub struct MathGlyphVariantRecord { ++ /// The variant glyph ++ pub variant_glyph: GlyphId, ++ /// The advance width/height of the variant, in the direction of this ++ /// record's associated table. ++ pub advance_measurement: UfWord, ++} ++ ++impl ReadData for MathGlyphVariantRecord { ++ unsafe fn read_data_unchecked(buf: &[u8], offset: usize) -> Self { ++ Self { ++ variant_glyph: GlyphId::read_data_unchecked(buf, offset), ++ advance_measurement: UfWord::read_data_unchecked(buf, offset + 2), ++ } ++ } ++} +diff --git a/src/otl/shared.rs b/src/otl/shared.rs +index 24f0f1d..f1a00fb 100644 +--- a/src/otl/shared.rs ++++ b/src/otl/shared.rs +@@ -13,7 +13,7 @@ pub struct Coverage<'a> { + } + + impl<'a> Coverage<'a> { +- pub(super) fn new(data: Buffer<'a>, offset: u32) -> Self { ++ pub(crate) fn new(data: Buffer<'a>, offset: u32) -> Self { + Self { data, offset } + } + diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm index a73a1e18ef..74d6b9fc85 100644 --- a/gnu/packages/rust-apps.scm +++ b/gnu/packages/rust-apps.scm @@ -53,6 +53,8 @@ #:use-module (gnu packages glib) #:use-module (gnu packages gtk) #:use-module (gnu packages ibus) + #:use-module (gnu packages icu4c) + #:use-module (gnu packages image) #:use-module (gnu packages jemalloc) #:use-module (gnu packages kde) #:use-module (gnu packages linux) @@ -1048,14 +1050,14 @@ of the project is to be runnable on untrusted networks without crashing.") (define-public tectonic (package (name "tectonic") - (version "0.8.0") + (version "0.8.1") (source (origin (method url-fetch) (uri (crate-uri "tectonic" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "0hzyqpjxya6g1ifb3hvjvj0zl2aigx898pz7h5pl46z50jp2pdc8")))) + (base32 "036cgbnw4mykhprfvfh97gcgrlkbjrgv58fwqy8l6s0vwam66sdh")))) (build-system cargo-build-system) (arguments `(#:cargo-build-flags '("--release" "--features" "external-harfbuzz") @@ -1078,13 +1080,14 @@ of the project is to be runnable on untrusted networks without crashing.") ("rust-tectonic-bundles" ,rust-tectonic-bundles-0.2) ("rust-tectonic-docmodel" ,rust-tectonic-docmodel-0.1) ("rust-tectonic-engine-bibtex" ,rust-tectonic-engine-bibtex-0.1) + ("rust-tectonic-engine-spx2html" ,rust-tectonic-engine-spx2html-0.1) ("rust-tectonic-engine-xdvipdfmx" ,rust-tectonic-engine-xdvipdfmx-0.1) - ("rust-tectonic-engine-xetex" ,rust-tectonic-engine-xetex-0.1) + ("rust-tectonic-engine-xetex" ,rust-tectonic-engine-xetex-0.2) ("rust-tectonic-errors" ,rust-tectonic-errors-0.2) ("rust-tectonic-geturl" ,rust-tectonic-geturl-0.3) ("rust-tectonic-io-base" ,rust-tectonic-io-base-0.3) ("rust-tectonic-status-base" ,rust-tectonic-status-base-0.2) - ("rust-tectonic-xdv" ,rust-tectonic-xdv-0.1) + ("rust-tectonic-xdv" ,rust-tectonic-xdv-0.2) ("rust-tectonic-xetex-layout" ,rust-tectonic-xetex-layout-0.1) ("rust-tempfile" ,rust-tempfile-3) ("rust-termcolor" ,rust-termcolor-1) @@ -1109,10 +1112,14 @@ of the project is to be runnable on untrusted networks without crashing.") (native-inputs (list pkg-config)) (inputs - `(("fontconfig" ,fontconfig) - ("harfbuzz" ,harfbuzz) - ("openssl" ,openssl) - ("zlib" ,zlib))) + (list fontconfig + freetype + graphite2 + harfbuzz + icu4c + libpng + openssl + zlib)) (home-page "https://tectonic-typesetting.github.io/") (synopsis "Complete, embeddable TeX/LaTeX engine") (description |