summaryrefslogtreecommitdiff
path: root/crates/typst-pdf
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-05-13 17:25:43 +0200
committerGitHub <noreply@github.com>2024-05-13 15:25:43 +0000
commit95cd6adf24cb14ede8896fbb0c610432960f4f3a (patch)
treebade59888a5268987eb4fae2dc30ddeaf28ad193 /crates/typst-pdf
parent7b656b3deb5f05e6e56d666622643a5cde8c435a (diff)
Factor out `typst-utils` crate (#4125)
Diffstat (limited to 'crates/typst-pdf')
-rw-r--r--crates/typst-pdf/src/font.rs4
-rw-r--r--crates/typst-pdf/src/gradient.rs2
-rw-r--r--crates/typst-pdf/src/image.rs2
-rw-r--r--crates/typst-pdf/src/lib.rs4
-rw-r--r--crates/typst-pdf/src/page.rs2
-rw-r--r--crates/typst-pdf/src/pattern.rs2
6 files changed, 8 insertions, 8 deletions
diff --git a/crates/typst-pdf/src/font.rs b/crates/typst-pdf/src/font.rs
index 15d1a50e..5d32e5d9 100644
--- a/crates/typst-pdf/src/font.rs
+++ b/crates/typst-pdf/src/font.rs
@@ -9,7 +9,7 @@ use pdf_writer::{Filter, Finish, Name, Rect, Str};
use ttf_parser::{name_id, GlyphId, Tag};
use typst::layout::{Abs, Em, Ratio, Transform};
use typst::text::Font;
-use typst::util::SliceExt;
+use typst::utils::SliceExt;
use unicode_properties::{GeneralCategory, UnicodeGeneralCategory};
use crate::page::{write_frame, PageContext};
@@ -320,7 +320,7 @@ fn subset_font(font: &Font, glyphs: &[u16]) -> Arc<Vec<u8>> {
fn subset_tag<T: Hash>(glyphs: &T) -> EcoString {
const LEN: usize = 6;
const BASE: u128 = 26;
- let mut hash = typst::util::hash128(&glyphs);
+ let mut hash = typst::utils::hash128(&glyphs);
let mut letter = [b'A'; LEN];
for l in letter.iter_mut() {
*l = b'A' + (hash % BASE) as u8;
diff --git a/crates/typst-pdf/src/gradient.rs b/crates/typst-pdf/src/gradient.rs
index 7dd289a9..576c254e 100644
--- a/crates/typst-pdf/src/gradient.rs
+++ b/crates/typst-pdf/src/gradient.rs
@@ -6,7 +6,7 @@ use pdf_writer::types::{ColorSpaceOperand, FunctionShadingType};
use pdf_writer::writers::StreamShadingType;
use pdf_writer::{Filter, Finish, Name, Ref};
use typst::layout::{Abs, Angle, Point, Quadrant, Ratio, Transform};
-use typst::util::Numeric;
+use typst::utils::Numeric;
use typst::visualize::{
Color, ColorSpace, Gradient, RatioOrAngle, RelativeTo, WeightedColor,
};
diff --git a/crates/typst-pdf/src/image.rs b/crates/typst-pdf/src/image.rs
index 312c2abb..7d108d6d 100644
--- a/crates/typst-pdf/src/image.rs
+++ b/crates/typst-pdf/src/image.rs
@@ -3,7 +3,7 @@ use std::io::Cursor;
use image::{DynamicImage, GenericImageView, Rgba};
use pdf_writer::{Chunk, Filter, Finish, Ref};
-use typst::util::Deferred;
+use typst::utils::Deferred;
use typst::visualize::{
ColorSpace, Image, ImageKind, RasterFormat, RasterImage, SvgImage,
};
diff --git a/crates/typst-pdf/src/lib.rs b/crates/typst-pdf/src/lib.rs
index e618f572..61906b1f 100644
--- a/crates/typst-pdf/src/lib.rs
+++ b/crates/typst-pdf/src/lib.rs
@@ -25,7 +25,7 @@ use typst::layout::{Abs, Dir, Em, Frame, PageRanges, Transform};
use typst::model::{Document, HeadingElem};
use typst::text::color::frame_for_glyph;
use typst::text::{Font, Lang};
-use typst::util::Deferred;
+use typst::utils::Deferred;
use typst::visualize::Image;
use xmp_writer::{DateTime, LangId, RenditionClass, Timezone, XmpWriter};
@@ -394,7 +394,7 @@ fn deflate_deferred(content: Vec<u8>) -> Deferred<Vec<u8>> {
/// Create a base64-encoded hash of the value.
fn hash_base64<T: Hash>(value: &T) -> String {
base64::engine::general_purpose::STANDARD
- .encode(typst::util::hash128(value).to_be_bytes())
+ .encode(typst::utils::hash128(value).to_be_bytes())
}
/// Converts a datetime to a pdf-writer date.
diff --git a/crates/typst-pdf/src/page.rs b/crates/typst-pdf/src/page.rs
index 1785e98e..557daa80 100644
--- a/crates/typst-pdf/src/page.rs
+++ b/crates/typst-pdf/src/page.rs
@@ -19,7 +19,7 @@ use typst::layout::{
use typst::model::{Destination, Numbering};
use typst::text::color::is_color_glyph;
use typst::text::{Case, Font, TextItem, TextItemView};
-use typst::util::{Deferred, Numeric, SliceExt};
+use typst::utils::{Deferred, Numeric, SliceExt};
use typst::visualize::{
FixedStroke, Geometry, Image, LineCap, LineJoin, Paint, Path, PathItem, Shape,
};
diff --git a/crates/typst-pdf/src/pattern.rs b/crates/typst-pdf/src/pattern.rs
index 211c056c..7fb3d6e8 100644
--- a/crates/typst-pdf/src/pattern.rs
+++ b/crates/typst-pdf/src/pattern.rs
@@ -2,7 +2,7 @@ use ecow::eco_format;
use pdf_writer::types::{ColorSpaceOperand, PaintType, TilingType};
use pdf_writer::{Filter, Finish, Name, Rect};
use typst::layout::{Abs, Ratio, Transform};
-use typst::util::Numeric;
+use typst::utils::Numeric;
use typst::visualize::{Pattern, RelativeTo};
use crate::color::PaintEncode;