mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-22 02:15:24 +01:00
Preserve typed composer adapter and pin validation
This commit is contained in:
1 parent
f6984a456c
commit
00e58c6deb
3 files changed
+29
-3
No files matched your search
Generated
+1
-1
@@ -1108,7 +1108,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-text"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=935dc0084680a3045b935ba303ab3ea08c38e1e7#935dc0084680a3045b935ba303ab3ea08c38e1e7"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=54485a66ceb7a7b6eaa584deee5bb76a85ea310f#54485a66ceb7a7b6eaa584deee5bb76a85ea310f"
|
||||
dependencies = [
|
||||
"kurbo 0.13.1",
|
||||
]
|
||||
|
||||
@@ -9,7 +9,7 @@ description = "VectorCraft text: font database, shaping, layout, glyph outlines"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
craft-text = { git = "https://github.com/storytold/craft-libs", rev = "935dc0084680a3045b935ba303ab3ea08c38e1e7", default-features = false, features = ["positioned"] }
|
||||
craft-text = { git = "https://github.com/storytold/craft-libs", rev = "54485a66ceb7a7b6eaa584deee5bb76a85ea310f", default-features = false, features = ["positioned"] }
|
||||
vectorcraft-geom = { workspace = true }
|
||||
vectorcraft-doc = { workspace = true }
|
||||
kurbo = { workspace = true }
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
//! Adapters from VectorCraft's shaped glyphs to the shared paragraph composer.
|
||||
|
||||
pub(crate) use craft_text::composer::{Breakpoint, Exhausted, Measure, Params, compose, compose_with};
|
||||
use crate::justify::Flex;
|
||||
use crate::shape::SGlyph;
|
||||
pub(crate) use craft_text::composer::{Breakpoint, Exhausted, Measure, Params};
|
||||
|
||||
pub(crate) fn compose(
|
||||
g: &[SGlyph],
|
||||
width: &dyn Fn(usize) -> f64,
|
||||
start: &dyn Fn(usize) -> f64,
|
||||
end: &dyn Fn(usize) -> f64,
|
||||
cands: &[Breakpoint],
|
||||
flex: &[Flex],
|
||||
params: &Params,
|
||||
) -> Option<Vec<(usize, bool)>> {
|
||||
craft_text::composer::compose(g, width, start, end, cands, flex, params)
|
||||
}
|
||||
|
||||
pub(crate) fn compose_with<M: Measure>(
|
||||
g: &[SGlyph],
|
||||
measure: &mut M,
|
||||
start: &dyn Fn(usize) -> f64,
|
||||
end: &dyn Fn(usize) -> f64,
|
||||
cands: &[Breakpoint],
|
||||
flex: &[Flex],
|
||||
params: &Params,
|
||||
) -> Option<Vec<(usize, bool)>> {
|
||||
craft_text::composer::compose_with(g, measure, start, end, cands, flex, params)
|
||||
}
|
||||
|
||||
impl craft_text::composer::Glyph for crate::shape::SGlyph {
|
||||
fn advance(&self) -> f64 {
|
||||
|
||||
Reference in new issue
Block a user