Skip to content

Commit

Permalink
Fix typos, add CI check (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Dec 24, 2024
1 parent ee3f030 commit bda7db0
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 21 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,12 @@ jobs:
run: |
qmake
nmake
# If this fails, consider changing your text or adding something to .typos.toml.
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: check typos
uses: crate-ci/[email protected]
28 changes: 28 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See the configuration reference at
# https://github.com/crate-ci/typos/blob/master/docs/reference.md

# Corrections take the form of a key/value pair. The key is the incorrect word
# and the value is the correct word. If the key and value are the same, the
# word is treated as always correct. If the value is an empty string, the word
# is treated as always incorrect.

# Match Identifier - Case Sensitive
[default.extend-identifiers]
ba = "ba"
flate2 = "flate2"
Hel = "Hel"
PNGs = "PNGs"
SVGinOT = "SVGinOT"

# Match Inside a Word - Case Insensitive
[default.extend-words]

[files]
# Include .github, .cargo, etc.
ignore-hidden = false
extend-exclude = [
# /.git isn't in .gitignore, because git never tracks it.
# Typos doesn't know that, though.
"/.git",
"*.svg",
]
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ This changelog also contains important changes in dependencies.
- `letter-spacing` on cursive scripts (like Arabic).
- (rctree) Prevent stack overflow on a huge, deeply nested SVG.
- (c-api) `resvg_is_image_empty` was always returning `false`.
- (resvg) Panic when `filter` with `objectBoudningBox` was set on an empty group.
- (resvg) Panic when `filter` with `objectBoundingBox` was set on an empty group.
- (usvg) `mask` with `objectBoundingBox` resolving.
- (usvg) `pattern`'s `viewBox` attribute resolving via `href`.
- (roxmltree) Namespace resolving.
Expand Down Expand Up @@ -1126,7 +1126,7 @@ This changelog also contains important changes in dependencies.
### Fixed
- Object bounding box calculation.
- Pattern scaling.
- Nested `objectBoundigBox` support.
- Nested `objectBoundingBox` support.
- (usvg) `color` on `use` resolving.
- (usvg) `offset` attribute resolving inside the `stop` element.
- (usvg) Ungrouping of groups with non-inheritable attributes.
Expand Down
2 changes: 1 addition & 1 deletion crates/resvg/src/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod turbulence;
///
/// Image pixels should be stored in RGBA order.
///
/// Some filters will require premultipled channels, some not.
/// Some filters will require premultiplied channels, some not.
/// See specific filter documentation for details.
#[derive(Clone, Copy)]
pub struct ImageRef<'a> {
Expand Down
2 changes: 1 addition & 1 deletion crates/resvg/tests/integration/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ use crate::render;
#[test] fn filters_filter_functions_color_adjust_functions_negative() { assert_eq!(render("tests/filters/filter-functions/color-adjust-functions-negative"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_color_as_attribute() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-color-as-attribute"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_color_last() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-color-last"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_comma_spearated() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-comma-spearated"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_comma_separated() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-comma-separated"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_currentColor() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-currentColor"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_em_values() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-em-values"), 0); }
#[test] fn filters_filter_functions_drop_shadow_function_extra_value() { assert_eq!(render("tests/filters/filter-functions/drop-shadow-function-extra-value"), 0); }
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion crates/usvg/src/text/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ fn apply_length_adjust(chunk: &TextChunk, clusters: &mut [GlyphCluster]) {
cluster_indexes.push(index);
}
}
// Complex scripts can have mutli-codepoint clusters therefore we have to remove duplicates.
// Complex scripts can have multi-codepoint clusters therefore we have to remove duplicates.
cluster_indexes.sort();
cluster_indexes.dedup();

Expand Down
2 changes: 1 addition & 1 deletion crates/usvg/tests/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn stylesheet_injection_with_important() {
unreachable!()
};

// All rects should be overriden, since we use `important`.
// All rects should be overridden, since we use `important`.
assert_eq!(
first.fill().unwrap().paint(),
&usvg::Paint::Color(Color::new_rgb(255, 0, 0))
Expand Down
2 changes: 1 addition & 1 deletion tools/kde-dolphin-thumbnailer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An SVG thumbnails generator for the KDE's
## Build

```bash
# build and install C-API first in case you don't have resvg intalled already
# build and install C-API first in case you don't have resvg installed already
cargo build --release --manifest-path ../../crates/c-api/Cargo.toml
strip -s ../../target/release/libresvg.so # optional, but recommended
sudo cp ../../target/release/libresvg.so /usr/lib64/
Expand Down
4 changes: 2 additions & 2 deletions tools/kde-dolphin-thumbnailer/resvgthumbnailer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ ResvgThumbnailer::ResvgThumbnailer()
m_opt.loadSystemFonts();
}

bool ResvgThumbnailer::create(const QString& path, int width, int heigth, QImage& img)
bool ResvgThumbnailer::create(const QString& path, int width, int height, QImage& img)
{
ResvgRenderer renderer(path, m_opt);
if (!renderer.isValid() || renderer.isEmpty()) {
return false;
}

img = renderer.renderToImage(QSize(width, heigth) * img.devicePixelRatio());
img = renderer.renderToImage(QSize(width, height) * img.devicePixelRatio());
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions tools/viewsvg/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->cmbBoxBackground->setCurrentIndex(1);

ui->svgView->setFitToView(true);
ui->svgView->setBackgound(SvgView::Backgound::White);
ui->svgView->setBackground(SvgView::Background::White);

connect(ui->svgView, &SvgView::loadError, this, [this](const QString &msg){
QMessageBox::critical(this, "Error", msg);
Expand Down Expand Up @@ -52,7 +52,7 @@ void MainWindow::on_cmbBoxSize_activated(int index)

void MainWindow::on_cmbBoxBackground_activated(int index)
{
ui->svgView->setBackgound(SvgView::Backgound(index));
ui->svgView->setBackground(SvgView::Background(index));
}

void MainWindow::on_chBoxDrawBorder_toggled(bool checked)
Expand Down
12 changes: 6 additions & 6 deletions tools/viewsvg/svgview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ void SvgView::setFitToView(bool flag)
requestUpdate();
}

void SvgView::setBackgound(SvgView::Backgound backgound)
void SvgView::setBackground(SvgView::Background background)
{
m_backgound = backgound;
m_background = background;
update();
}

Expand Down Expand Up @@ -198,12 +198,12 @@ void SvgView::paintEvent(QPaintEvent *e)
const auto r = contentsRect();
p.setClipRect(r);

switch (m_backgound) {
case Backgound::None : break;
case Backgound::White : {
switch (m_background) {
case Background::None : break;
case Background::White : {
p.fillRect(contentsRect(), Qt::white);
} break;
case Backgound::CheckBoard : {
case Background::CheckBoard : {
p.fillRect(contentsRect(), QBrush(m_checkboardImg));
} break;
}
Expand Down
6 changes: 3 additions & 3 deletions tools/viewsvg/svgview.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SvgView : public QWidget
Q_OBJECT

public:
enum class Backgound
enum class Background
{
None,
White,
Expand All @@ -51,7 +51,7 @@ class SvgView : public QWidget
static void init();

void setFitToView(bool flag);
void setBackgound(Backgound backgound);
void setBackground(Background background);
void setDrawImageBorder(bool flag);

void loadData(const QByteArray &data);
Expand Down Expand Up @@ -84,7 +84,7 @@ private slots:
QString m_path;
float m_dpiRatio = 1.0;
bool m_isFitToView = true;
Backgound m_backgound = Backgound::CheckBoard;
Background m_background = Background::CheckBoard;
bool m_isDrawImageBorder = false;
bool m_isHasImage = false;
QImage m_img;
Expand Down

0 comments on commit bda7db0

Please sign in to comment.