Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependency cycle #720

Merged
merged 2 commits into from
Dec 19, 2024
Merged
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
34 changes: 6 additions & 28 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ gosub_config = { path = "./crates/gosub_config", features = [] }
gosub_html5 = { path = "./crates/gosub_html5", features = [] }
gosub_css3 = { path = "./crates/gosub_css3", features = [] }
gosub_jsapi = { path = "./crates/gosub_jsapi", features = [] }
gosub_testing = { path = "./crates/gosub_testing", features = [] }
gosub_rendering = { path = "crates/gosub_render_utils", features = [] }
gosub_renderer = { path = "./crates/gosub_renderer", features = [] }
gosub_vello = { path = "./crates/gosub_vello", features = [] }
Expand Down
1 change: 0 additions & 1 deletion crates/gosub_cairo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "MIT"

[dependencies]
gosub_shared = { path = "../gosub_shared" }
gosub_typeface = { path = "../gosub_typeface" }
gosub_svg = { path = "../gosub_svg", features = ["resvg"] }
image = "0.25.2"
smallvec = "1.13.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_cairo/src/debug/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::elements::transform::GsTransform;
use crate::Scene;
use gosub_shared::render_backend::{Brush as _, Color as _, Transform as _};
use gosub_shared::types::Point;
use gosub_typeface::ROBOTO_FONT;
use gosub_shared::ROBOTO_FONT;
use peniko::{Blob, Font};
use std::sync::{Arc, LazyLock};

Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_cairo/src/elements/text.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::CairoBackend;
use gosub_shared::font::{Glyph, GlyphID};
use gosub_shared::render_backend::geo::FP;
use gosub_shared::render_backend::layout::{Decoration, TextLayout};
use gosub_shared::render_backend::{RenderText, Text as TText};
use gosub_typeface::font::{Glyph, GlyphID};
use peniko::Font;
use skrifa::instance::NormalizedCoord;
use std::cell::RefCell;
Expand All @@ -12,7 +12,7 @@ use std::rc::Rc;
use crate::elements::brush::GsBrush;
use crate::elements::color::GsColor;
use freetype::{Face, Library};
use gosub_typeface::ROBOTO_FONT;
use gosub_shared::ROBOTO_FONT;
use kurbo::Stroke;
use log::info;
use once_cell::sync::Lazy;
Expand Down
8 changes: 7 additions & 1 deletion crates/gosub_html5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,21 @@ lazy_static = "1.5"
thiserror = "2.0.7"
url = { version = "2.5.4", features = [] }
log = { version = "0.4.22", features = [] }
nom = "7.1.3"
nom_locate = "4.2.0"
regex = "1"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_derive = "1.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
ureq = "2.12.1"

[dev-dependencies]
gosub_testing = { path = "../gosub_testing" }
test-case = "3.3.1"
criterion = { version = "0.5.1", features = ["html_reports"] }


[features]
debug_parser = []
debug_parser_verbose = []
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_html5/benches/tokenizer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::{criterion_group, criterion_main, Criterion};
use gosub_testing::testing::tokenizer::{self, FixtureFile};
use gosub_html5::testing::tokenizer::{self, FixtureFile};

fn criterion_benchmark(c: &mut Criterion) {
// Criterion can report inconsistent results from run to run in some cases. We attempt to
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_html5/benches/tree_construction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use gosub_html5::document::builder::DocumentBuilderImpl;
use gosub_html5::document::document_impl::DocumentImpl;
use gosub_html5::document::fragment::DocumentFragmentImpl;
use gosub_html5::parser::Html5Parser;
use gosub_html5::testing::tree_construction;
use gosub_html5::testing::tree_construction::Harness;
use gosub_shared::traits::config::{HasCssSystem, HasDocument, HasHtmlParser};
use gosub_testing::testing::tree_construction;
use gosub_testing::testing::tree_construction::Harness;

#[derive(Clone, Debug, PartialEq)]
struct Config;
Expand Down
1 change: 1 addition & 0 deletions crates/gosub_html5/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub mod dom;
pub mod errors;
pub mod node;
pub mod parser;
pub mod testing;
pub mod tokenizer;
#[allow(dead_code)]
pub mod writer;
Expand Down
5 changes: 3 additions & 2 deletions crates/gosub_html5/src/parser/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ mod tests {
use crate::document::document_impl::DocumentImpl;
use crate::document::fragment::DocumentFragmentImpl;
use crate::parser::Html5Parser;
use crate::testing::tree_construction::fixture::{fixture_root_path, read_fixture_from_path};
use crate::testing::tree_construction::Harness;
use gosub_css3::system::Css3System;
use gosub_shared::traits::config::{HasCssSystem, HasDocument, HasHtmlParser};
use gosub_testing::testing::tree_construction::fixture::{fixture_root_path, read_fixture_from_path};
use gosub_testing::testing::tree_construction::Harness;
use test_case::test_case;

#[derive(Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -119,6 +119,7 @@ mod tests {
#[test_case("webkit01.dat")]
#[test_case("webkit02.dat")]
fn tree_construction(filename: &str) {
dbg!(fixture_root_path().join(filename));
let fixture_file = read_fixture_from_path(fixture_root_path().join(filename)).expect("fixture");
let mut harness = Harness::new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
pub mod tokenizer;
pub mod tree_construction;

pub const FIXTURE_ROOT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../gosub_html5/tests/data/html5lib-tests",);
pub const FIXTURE_ROOT: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/./tests/data/html5lib-tests",);
pub const TREE_CONSTRUCTION_PATH: &str = "tree-construction";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::FIXTURE_ROOT;
use gosub_html5::parser::errors::ErrorLogger;
use gosub_html5::tokenizer::ParserData;
use gosub_html5::tokenizer::{
use crate::parser::errors::ErrorLogger;
use crate::tokenizer::ParserData;
use crate::tokenizer::{
state::State as TokenState,
token::Token,
{Options, Tokenizer},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pub mod fixture;
mod generator;
pub(crate) mod parser;
pub mod parser;
pub mod result;

use crate::node::{HTML_NAMESPACE, MATHML_NAMESPACE, SVG_NAMESPACE};
use generator::TreeOutputGenerator;
use gosub_html5::node::{HTML_NAMESPACE, MATHML_NAMESPACE, SVG_NAMESPACE};
use gosub_shared::byte_stream::{ByteStream, Config, Encoding, Location};
use gosub_shared::document::DocumentHandle;
use gosub_shared::node::NodeId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use gosub_html5::node::HTML_NAMESPACE;
use gosub_html5::node::{MATHML_NAMESPACE, SVG_NAMESPACE, XLINK_NAMESPACE, XMLNS_NAMESPACE};
use crate::node::HTML_NAMESPACE;
use crate::node::{MATHML_NAMESPACE, SVG_NAMESPACE, XLINK_NAMESPACE, XMLNS_NAMESPACE};
use gosub_shared::document::DocumentHandle;
use gosub_shared::traits::config::HasDocument;
use gosub_shared::traits::document::Document;
Expand Down
2 changes: 1 addition & 1 deletion crates/gosub_html5/src/tokenizer/test_cases.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use gosub_testing::testing::tokenizer::{self, FixtureFile};
use crate::testing::tokenizer::{self, FixtureFile};
use lazy_static::lazy_static;
use std::collections::HashSet;
use test_case::test_case;
Expand Down
1 change: 0 additions & 1 deletion crates/gosub_shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ derive_more = {version = "1.0.0", features = ["display"]}
log = "0.4.22"
raw-window-handle = "0.6.2"
smallvec = "1.13.2"
gosub_typeface = { path = "../gosub_typeface"}
image = "0.25.5"


Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions crates/gosub_shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ pub mod async_executor;
pub mod byte_stream;
pub mod document;
pub mod errors;
pub mod font;
pub mod node;
pub mod render_backend;
pub mod timing;
pub mod traits;
pub mod types;

pub const ROBOTO_FONT: &[u8] = include_bytes!("../resources/fonts/Roboto-Regular.ttf");
2 changes: 1 addition & 1 deletion crates/gosub_shared/src/render_backend/layout.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::fmt::Debug;

use super::geo::{Point, Rect, Size, SizeU32};
use crate::font::{Font, Glyph};
use crate::traits::config::HasLayouter;
use crate::types::Result;
use gosub_typeface::font::{Font, Glyph};

pub trait LayoutTree<C: HasLayouter<LayoutTree = Self>>: Sized + Debug + 'static {
type NodeId: Debug + Copy + Clone + From<u64> + Into<u64> + PartialEq;
Expand Down
1 change: 0 additions & 1 deletion crates/gosub_taffy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ license = "MIT"

[dependencies]
gosub_shared = { path = "../gosub_shared" }
gosub_typeface = { path = "../gosub_typeface" }
taffy = "0.6.3"
anyhow = "1.0.94"
regex = "1.11.1"
Expand Down
5 changes: 3 additions & 2 deletions crates/gosub_taffy/src/compute/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ use taffy::{
RunMode, Size,
};

use gosub_shared::font::Glyph;
use gosub_shared::render_backend::geo;
use gosub_shared::render_backend::layout::{Decoration, DecorationStyle, HasTextLayout, LayoutNode, LayoutTree};
use gosub_shared::traits::config::HasLayouter;
use gosub_shared::traits::css3::{CssProperty, CssValue};
use gosub_typeface::font::Glyph;
use gosub_shared::ROBOTO_FONT;

use crate::text::{Font, TextLayout};
use crate::{Display, LayoutDocument, TaffyLayouter};

static FONT_CX: LazyLock<Mutex<FontContext>> = LazyLock::new(|| {
let mut ctx = FontContext::default();

let fonts = ctx.collection.register_fonts(gosub_typeface::ROBOTO_FONT.to_vec());
let fonts = ctx.collection.register_fonts(ROBOTO_FONT.to_vec());

ctx.collection
.append_fallbacks(FallbackKey::new(Script::from("Latn"), None), fonts.iter().map(|f| f.0));
Expand Down
4 changes: 2 additions & 2 deletions crates/gosub_taffy/src/text.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use gosub_shared::font::Font as TFont;
use gosub_shared::font::Glyph;
use gosub_shared::render_backend::layout::{Decoration, TextLayout as TLayout};
use gosub_shared::render_backend::Size;
use gosub_typeface::font::Font as TFont;
use gosub_typeface::font::Glyph;
use parley::Font as PFont;

#[derive(Debug, Clone)]
Expand Down
17 changes: 0 additions & 17 deletions crates/gosub_testing/Cargo.toml

This file was deleted.

6 changes: 0 additions & 6 deletions crates/gosub_testing/src/lib.rs

This file was deleted.

10 changes: 0 additions & 10 deletions crates/gosub_typeface/Cargo.toml

This file was deleted.

Loading
Loading