Skip to content

Commit

Permalink
fix: typos (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin authored Dec 28, 2024
1 parent 533347d commit 1ba2627
Show file tree
Hide file tree
Showing 32 changed files with 182 additions and 143 deletions.
4 changes: 2 additions & 2 deletions crates/conversion/typst2vec/src/pass/typst2vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ impl<const ENABLE_REF_CNT: bool> Typst2VecPassImpl<ENABLE_REF_CNT> {
format!("@{}", fingerprint.as_svg_id("p")).into()
}
Paint::Gradient(g) => {
let fingerprint = self.graident(g, mk_transform(g.relative(), true));
let fingerprint = self.gradient(g, mk_transform(g.relative(), true));
format!("@{}", fingerprint.as_svg_id("g")).into()
}
}
Expand Down Expand Up @@ -961,7 +961,7 @@ impl<const ENABLE_REF_CNT: bool> Typst2VecPassImpl<ENABLE_REF_CNT> {
}
}

fn graident(&self, g: &Gradient, transform: ir::Transform) -> Fingerprint {
fn gradient(&self, g: &Gradient, transform: ir::Transform) -> Fingerprint {
let mut stops = Vec::with_capacity(g.stops_ref().len());
for (c, step) in g.stops_ref() {
let [r, g, b, a] = c.to_rgb().to_vec4_u8();
Expand Down
4 changes: 2 additions & 2 deletions crates/conversion/vec2dom/src/incr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl IncrDomDocClient {
}
STAGE_PREPARE_CANVAS => {
if let Some(elem) = page.prepare_canvas(&mut ctx)? {
// explicit drop ctx to avoid async promise cature these variables
// explicit drop ctx to avoid async promise capture these variables
drop(ctx);
#[cfg(feature = "debug_repaint_canvas")]
web_sys::console::log_1(&format!("canvas state prepare: {page_num}").into());
Expand All @@ -183,7 +183,7 @@ impl IncrDomDocClient {
}
}
STAGE_CANVAS => {
// explicit drop ctx to avoid async promise cature these variables
// explicit drop ctx to avoid async promise capture these variables
drop(ctx);
let ppp = self.canvas_backend.pixel_per_pt;
let page = &mut self.doc_view[page_num as usize];
Expand Down
4 changes: 2 additions & 2 deletions crates/conversion/vec2dom/src/svg_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ pub static FETCH_BBOX_TIMES: std::sync::atomic::AtomicUsize =
static BBOX_SANITIZER: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);

impl TypstElem {
/// Repaint svg API will retrun a new viewport if it is updated.
/// Repaint svg API will return a new viewport if it is updated.
///
/// The idea is that: the element visible before will be overrided by the
/// The idea is that: the element visible before will be overridden by the
/// latter ones, so we should update the viewport to the union of all
/// previous ones and repaint the latter elements accordingly.
fn repaint_svg(
Expand Down
2 changes: 1 addition & 1 deletion crates/conversion/vec2svg/src/backend/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<E: Escapes> fmt::Display for Escaped<'_, E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut total_remaining = self.to_escape;

// find the next occurence
// find the next occurrence
while let Some(n) = total_remaining.bytes().position(E::byte_needs_escaping) {
let (start, remaining) = total_remaining.split_at(n);

Expand Down
2 changes: 1 addition & 1 deletion crates/conversion/vec2svg/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl SvgTextBuilder {
upem: Scalar,
) {
// upem is the unit per em defined in the font.
// ppem is calcuated by the font size.
// ppem is calculated by the font size.
// > ppem = text_size / upem
let upem = upem.0;

Expand Down
4 changes: 2 additions & 2 deletions crates/conversion/vec2svg/src/backend/text.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// #[cfg(feature = "aggresive-browser-optimization")]
// #[cfg(feature = "aggressive-browser-optimization")]
// fn f() {}
// #[cfg(not(feature = "aggresive-browser-optimization"))]
// #[cfg(not(feature = "aggressive-browser-optimization"))]
// fn f() {}
2 changes: 1 addition & 1 deletion crates/conversion/vec2svg/src/frontend/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct RenderContext<'m, 't, Feat: ExportFeature> {

/// Stores the style definitions used in the document.
pub(crate) _style_defs: &'t mut StyleDefMap,
/// Stores the graidents used in the document.
/// Stores the gradients used in the document.
pub(crate) gradients: &'t mut PaintFillMap,
/// Stores the patterns used in the document.
pub(crate) patterns: &'t mut PaintFillMap,
Expand Down
8 changes: 4 additions & 4 deletions crates/reflexo-typst/src/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub mod text;
pub type DynExporter<Input, Output = ()> = Box<dyn Exporter<Input, Output> + Send + Sync>;

pub trait Transformer<Input, Output = ()> {
/// Export the given input with given world. the writable world is hiden by
/// Export the given input with given world. the writable world is hidden by
/// trait itself.
fn export(&self, world: &dyn World, output: Input) -> SourceResult<Output>;
}
Expand All @@ -34,7 +34,7 @@ where
}

pub trait Exporter<Input, Output = ()> {
/// Export the given input with given world. the writable world is hiden by
/// Export the given input with given world. the writable world is hidden by
/// trait itself.
fn export(&self, world: &dyn World, output: Arc<Input>) -> SourceResult<Output>;
}
Expand Down Expand Up @@ -68,15 +68,15 @@ pub type DynGenericExporter<X, Input, Output = ()> =
pub trait GenericTransformer<Input, Output = ()> {
type W;

/// Export the given input with given world. the writable world is hiden by
/// Export the given input with given world. the writable world is hidden by
/// trait itself.
fn export(&self, world: &Self::W, output: Input) -> SourceResult<Output>;
}

pub trait GenericExporter<Input, Output = ()> {
type W;

/// Export the given input with given world. the writable world is hiden by
/// Export the given input with given world. the writable world is hidden by
/// trait itself.
fn export(&self, world: &Self::W, output: Arc<Input>) -> SourceResult<Output>;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/reflexo-vfs/src/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl FileSnapshot {
}
}

/// Convenent function to create a [`FileSnapshot`] from tuple
/// Convenient function to create a [`FileSnapshot`] from tuple
impl From<FileResult<(crate::Time, Bytes)>> for FileSnapshot {
fn from(result: FileResult<(crate::Time, Bytes)>) -> Self {
Self(
Expand Down
2 changes: 1 addition & 1 deletion crates/reflexo-world/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub trait EntryManager: EntryReader {

#[derive(Debug, Clone, Hash, PartialEq, Eq, Default)]
pub struct EntryState {
/// The differents is that: if the entry is rooted, the workspace root is
/// The differences is that: if the entry is rooted, the workspace root is
/// the parent of the entry file and cannot be used by workspace functions
/// like [`EntryState::try_select_path_in_workspace`].
rooted: bool,
Expand Down
6 changes: 3 additions & 3 deletions crates/reflexo-world/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ impl<T> Default for SharedState<T> {

impl<T: Revised> SharedState<T> {
fn gc(&mut self) {
let commited = self.committed_revision.unwrap_or(0);
let committed = self.committed_revision.unwrap_or(0);
self.cache_entries
.retain(|_, v| commited.saturating_sub(v.last_accessed_rev().get()) <= 30);
.retain(|_, v| committed.saturating_sub(v.last_accessed_rev().get()) <= 30);
}
}

Expand Down Expand Up @@ -86,7 +86,7 @@ impl SourceState {
// todo: utilize the committed revision is not zero
if state
.committed_revision
.map_or(false, |commited| commited >= self.revision.get())
.map_or(false, |committed| committed >= self.revision.get())
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/reflexo/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<E: Escapes> fmt::Display for Escaped<'_, E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut total_remaining = self.to_escape;

// find the next occurence
// find the next occurrence
while let Some(n) = total_remaining.bytes().position(E::byte_needs_escaping) {
let (start, remaining) = total_remaining.split_at(n);

Expand Down
8 changes: 4 additions & 4 deletions crates/reflexo/src/vector/incr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct IncrDocClient {
/// Optional source mapping data.
pub source_mapping_data: Vec<SourceMappingNode>,
/// Optional page source mapping references.
pub page_source_mappping: LayoutSourceMapping,
pub page_source_mapping: LayoutSourceMapping,
}

impl IncrDocClient {
Expand All @@ -33,7 +33,7 @@ impl IncrDocClient {
self.source_mapping_data = data;
}
ModuleMetadata::PageSourceMapping(data) => {
self.page_source_mappping = data.take();
self.page_source_mapping = data.take();
}
_ => {}
}
Expand Down Expand Up @@ -101,14 +101,14 @@ impl<'a> IncrDocClientKern<'a> {
const SOURCE_MAPPING_TYPE_SHAPE: u32 = 3;
const SOURCE_MAPPING_TYPE_PAGE: u32 = 4;

if self.0.page_source_mappping.is_empty() {
if self.0.page_source_mapping.is_empty() {
return Ok(None);
}

let mut index_item: Option<&SourceMappingNode> = None;

let source_mapping = self.0.source_mapping_data.as_slice();
let page_sources = self.0.page_source_mappping[0]
let page_sources = self.0.page_source_mapping[0]
.source_mapping(&self.0.doc.module)
.unwrap();
let page_sources = page_sources.source_mapping();
Expand Down
2 changes: 1 addition & 1 deletion crates/reflexo/src/vector/ir/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub struct GradientItem {
pub styles: Vec<GradientStyle>,
}

/// Kind of graidents for [`GradientItem`].
/// Kind of gradients for [`GradientItem`].
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
#[cfg_attr(feature = "rkyv", derive(Archive, rDeser, rSer))]
#[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
Expand Down
6 changes: 3 additions & 3 deletions crates/reflexo/src/vector/ir/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ pub struct TextShape {
}

impl TextShape {
/// ppem is calcuated by the font size.
/// ppem is calculated by the font size.
pub fn ppem(&self, upem: f32) -> Scalar {
Scalar(self.size.0 / upem)
}

/// inv_ppem is calcuated by the font size.
/// inv_ppem is calculated by the font size.
pub fn inv_ppem(&self, upem: f32) -> Scalar {
Scalar(upem / self.size.0)
}
Expand Down Expand Up @@ -171,7 +171,7 @@ impl TextItem {
#[cfg_attr(feature = "rkyv-validation", archive(check_bytes))]
pub struct TextItemContent {
/// The plain utf-8 content of the text item.
/// Note: witout XML escaping.
/// Note: without XML escaping.
pub content: ImmutStr,
/// The glyphs in the text.
/// (offset, advance, glyph): ([`Abs`], [`Abs`], [`FlatGlyphItem`])
Expand Down
6 changes: 3 additions & 3 deletions docs/cookery/direction/responsive.typ
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ in social media. Though it is not implemented, HTML elements is considered for r

== Prepare Artifacts: Precompiler Part

As an example, #link("https://github.com/Myriad-Dreamin/typst.ts/blob/main/projects/hexo-renderer-typst/lib/compiler.cjs")[hexo-renderer-typst] utilizes #cross-link("/guide/all-in-one-node.typ")[All-in-one Library for Node.js] to build its functions. First, it creates a dyn layout compiler for precompiling docuemnts:
As an example, #link("https://github.com/Myriad-Dreamin/typst.ts/blob/main/projects/hexo-renderer-typst/lib/compiler.cjs")[hexo-renderer-typst] utilizes #cross-link("/guide/all-in-one-node.typ")[All-in-one Library for Node.js] to build its functions. First, it creates a dyn layout compiler for precompiling documents:

```js
this.dyn = DynLayoutCompiler.fromBoxed(NodeCompiler.create(compileArgs).intoBoxed());
Expand All @@ -41,7 +41,7 @@ return this.dyn.vector({ mainFilePath: path });

=== `x-page-width` (stable)

Retreiving the sys arguments specified by the dynamic layout compiler:
Retrieving the sys arguments specified by the dynamic layout compiler:

```typ
/// It is in default A4 paper size (21cm)
Expand All @@ -63,7 +63,7 @@ Templating Example:

*Note: Official typst may introduce their owned method to specify target, therefore this feature may move to the native approach in future.*

Retreiving the sys arguments specified by SSG Tools:
Retrieving the sys arguments specified by SSG Tools:

```typ
/// The default target is _pdf_.
Expand Down
8 changes: 4 additions & 4 deletions docs/cookery/guide/all-in-one.typ
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ console.log((await $typst.svg({
// :-> 7317
```

However, it is less flexible and stable than the underlying interfaces, the `TypstCompiler` and `TypstRenderer`. If you've become more familar with typst.ts, we recommend you rewrite your library with underlying interfaces according to example usage shown by the #snippet-lib library.
However, it is less flexible and stable than the underlying interfaces, the `TypstCompiler` and `TypstRenderer`. If you've become more familiar with typst.ts, we recommend you rewrite your library with underlying interfaces according to example usage shown by the #snippet-lib library.

Note: If your script targets to *CommonJS*, you should import it in *CommonJS* path instead of In *ES Module* path:

Expand Down Expand Up @@ -90,7 +90,7 @@ Ideally, you don't have to specify any options. But if necessary, the extra init

```ts
// Example: cache default fonts to file system
$typst.setCompilerInitOptions(await cachedFontInitOptoins());
$typst.setCompilerInitOptions(await cachedFontInitOptions());
// specify init options to renderer
$typst.setRendererInitOptions(rendererInitOptions);
Expand Down Expand Up @@ -126,7 +126,7 @@ $typst.use(
Fetch package from remote registry:

```js
const acessModel = cm.FetchAccessModel() or
const accessModel = cm.FetchAccessModel() or
cm.MemoryAccessModel() or others;
$typst.use(
TypstSnippet.fetchPackageRegistry(fetchBackend),
Expand All @@ -141,7 +141,7 @@ See #link(snippet-source)[comments on source] for more details.

See #link("https://github.com/Myriad-Dreamin/typst.ts/blob/main/packages/typst.ts/examples/all-in-one.html")[Preview by all-in-one Library] by a single included file (`all-in-one.bundle.js`).

See #link("https://github.com/Myriad-Dreamin/typst.ts/blob/main/packages/typst.ts/examples/all-in-one-lite.html")[Preview by all-in-one-lite Library] by the more pratical single included file (`all-in-one-lite.bundle.js`), which needs configure your frontend to have access to wasm module files:
See #link("https://github.com/Myriad-Dreamin/typst.ts/blob/main/packages/typst.ts/examples/all-in-one-lite.html")[Preview by all-in-one-lite Library] by the more practical single included file (`all-in-one-lite.bundle.js`), which needs configure your frontend to have access to wasm module files:

```js
$typst.setCompilerInitOptions({
Expand Down
2 changes: 1 addition & 1 deletion docs/cookery/guide/compiler/service.typ
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ std::marker::PhantomData.compile(
Note: The ```rs struct CompileExporter``` derives #compiler-trait. #linebreak()
]

Retrieve an exporter instance that is executed on each sucessful compilation (more useful for incremental compilation).
Retrieve an exporter instance that is executed on each successful compilation (more useful for incremental compilation).

```ts
let driver = CompileExporter::default()
Expand Down
2 changes: 1 addition & 1 deletion docs/cookery/guide/compiler/ts-cli.typ
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ typst-ts-cli compile ... -o dist

=== `--trace` option

Comma seperated options to trace execution of typst compiler when compiling documents:
Comma separated options to trace execution of typst compiler when compiling documents:

```bash
# trace events at warning level
Expand Down
2 changes: 1 addition & 1 deletion docs/cookery/guide/renderer/angular.typ
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Render the document with artifact from precompiler.

=== Set renderer initialization option for `typst-document`

Retrieve a #term.init-option for initializating the renderer for `typst-document`
Retrieve a #term.init-option for initializing the renderer for `typst-document`

```ts
typst-document.setWasmModuleInitOptions({
Expand Down
2 changes: 1 addition & 1 deletion docs/cookery/guide/renderer/ts-lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ See the sample application #link("https://github.com/Myriad-Dreamin/typst.ts/blo

== Use `RenderSession` APIs

Full exmaple: #link("https://github.com/Enter-tainer/typst-preview/tree/110c031d21e74f747f78fbf78934140d23fec267/addons/frontend")[typst-preview-frontend]
Full example: #link("https://github.com/Enter-tainer/typst-preview/tree/110c031d21e74f747f78fbf78934140d23fec267/addons/frontend")[typst-preview-frontend]

See #renderer-lib for more details.
Loading

0 comments on commit 1ba2627

Please sign in to comment.