Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Allow crate to be used as library #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
[package]
name = "QStroke"
name = "MFEKStroke"
version = "0.0.0"
authors = ["Matthew Blanchard <[email protected]>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "MFEKStrokelib"
path = "src/lib.rs"

[[bin]]
path = "src/bin.rs"
name = "MFEKStroke"

[dependencies]
# parse command line arguments
clap = "2.33.3"
Expand All @@ -19,4 +27,4 @@ skulpin = { version = "0.10.0", default-features = false, features = ["skia_comp
# For reading and writing glifs
xmltree = "0.10.1"
log = "0.4.11"
xmlwriter = "0.1.0"
xmlwriter = "0.1.0"
24 changes: 11 additions & 13 deletions src/main.rs → src/bin.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
mod qmath;
mod pattern_along_path;
mod glifwriter;

use clap::{Arg, App};
use pattern_along_path::*;
use qmath::{Vector};
use clap::{App, Arg};
use std::fs;
use MFEKStrokelib::glifwriter;
use MFEKStrokelib::pattern_along_path::*;
use MFEKStrokelib::qmath::{PointData, Vector};

fn main() {
let matches = App::new("QPaP")
Expand Down Expand Up @@ -75,14 +72,15 @@ fn main() {
let pattern_string = matches.value_of("pattern").unwrap();
let output_string = matches.value_of("output").unwrap();

let path: glifparser::Glif<Option<qmath::PointData>> = glifparser::read_ufo_glif(&fs::read_to_string(path_string)
.expect("Failed to read path file!"));

let pattern: glifparser::Glif<Option<qmath::PointData>> = glifparser::read_ufo_glif(&fs::read_to_string(pattern_string)
.expect("Failed to read pattern file!"));
let path: glifparser::Glif<Option<PointData>> = glifparser::read_ufo_glif(
&fs::read_to_string(path_string).expect("Failed to read path file!"),
);

let pattern: glifparser::Glif<Option<PointData>> = glifparser::read_ufo_glif(
&fs::read_to_string(pattern_string).expect("Failed to read pattern file!"),
);

let mut settings = PatternSettings{
let mut settings = PatternSettings {
copies: PatternCopies::Single,
subdivide: PatternSubdivide::Off,
is_vertical: false,
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub mod glifwriter;
pub mod pattern_along_path;
pub mod qmath;