Use shared EPS embedded font scanner

This commit is contained in:
Dylan M. Taylor
2026-11-13 19:52:19 +00:00
parent 05fc7f2835
commit cb2cd0c5cf
4 changed files with 89 additions and 102 deletions
Generated
+62 -28
View File
@@ -1092,26 +1092,26 @@ dependencies = [
[[package]]
name = "craft-aep"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
[[package]]
name = "craft-audio"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609)",
"thiserror 2.0.21",
]
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
[[package]]
name = "craft-dpx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"thiserror 2.0.21",
]
@@ -1119,7 +1119,7 @@ dependencies = [
[[package]]
name = "craft-ecproj-format"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"serde",
"serde_json",
@@ -1129,12 +1129,12 @@ dependencies = [
[[package]]
name = "craft-eps"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
[[package]]
name = "craft-exr"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"serde_json",
]
@@ -1142,17 +1142,17 @@ dependencies = [
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
[[package]]
name = "craft-gif"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"fixed_decimal",
"icu_decimal",
@@ -1175,8 +1175,9 @@ dependencies = [
[[package]]
name = "craft-lottie"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"craft-zip",
"serde_json",
"thiserror 2.0.21",
]
@@ -1184,7 +1185,7 @@ dependencies = [
[[package]]
name = "craft-media"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"thiserror 2.0.21",
]
@@ -1200,7 +1201,7 @@ dependencies = [
[[package]]
name = "craft-mesh"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"miniz_oxide 0.9.1",
"serde_json",
@@ -1209,7 +1210,7 @@ dependencies = [
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"hayro-syntax",
"thiserror 2.0.21",
@@ -1218,7 +1219,7 @@ dependencies = [
[[package]]
name = "craft-psd"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"encoding_rs",
"flate2",
@@ -1229,7 +1230,7 @@ dependencies = [
[[package]]
name = "craft-quit"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"dispatch2",
"egui",
@@ -1240,19 +1241,21 @@ dependencies = [
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"craft-xml",
"flate2",
"kurbo",
"roxmltree",
"thiserror 2.0.21",
"vectorcraft-geom",
"vectorcraft-pathops",
]
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"craft-fonts-build",
"craft-i18n",
@@ -1273,7 +1276,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"chrono",
"dunce",
@@ -1300,9 +1303,9 @@ dependencies = [
[[package]]
name = "craft-video"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609)",
"rayon",
"thiserror 2.0.21",
]
@@ -1310,7 +1313,7 @@ dependencies = [
[[package]]
name = "craft-webp"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"thiserror 2.0.21",
]
@@ -1318,12 +1321,22 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"quick-xml 0.41.0",
"thiserror 2.0.21",
]
[[package]]
name = "craft-zip"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"flate2",
"thiserror 2.0.21",
"zip 9.1.3",
]
[[package]]
name = "crc32fast"
version = "1.5.2"
@@ -1683,7 +1696,7 @@ name = "effectcraft-export"
version = "0.24.1"
dependencies = [
"craft-audio",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609)",
"craft-video",
"effectcraft-color",
"effectcraft-effects",
@@ -1852,7 +1865,7 @@ dependencies = [
"craft-dpx",
"craft-exr",
"craft-gif",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9)",
"craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609)",
"craft-webp",
"effectcraft-color",
"effectcraft-effects",
@@ -3422,7 +3435,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"hayro-ccitt",
]
@@ -3436,7 +3449,7 @@ checksum = "c75ab947623ef4ccaa7acf0579edf7cbb5a73838e3839a7be73335e522f433a1"
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=47107f660191de2f0b425569506f4daa4faadac9#47107f660191de2f0b425569506f4daa4faadac9"
source = "git+https://github.com/storytold/craft-libs?rev=46478f4cf2d5879ae7ce0593f3f41eff90d98609#46478f4cf2d5879ae7ce0593f3f41eff90d98609"
dependencies = [
"hayro-jbig2",
"hayro-jpeg2000",
@@ -6683,6 +6696,27 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "vectorcraft-geom"
version = "0.18.0"
source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e"
dependencies = [
"kurbo",
"serde",
"thiserror 2.0.21",
]
[[package]]
name = "vectorcraft-pathops"
version = "0.18.0"
source = "git+https://github.com/storytold/vectorcraft.git?rev=6b3a6b8788ebcb420d69449199cbdf323888d27e#6b3a6b8788ebcb420d69449199cbdf323888d27e"
dependencies = [
"kurbo",
"linesweeper",
"thiserror 2.0.21",
"vectorcraft-geom",
]
[[package]]
name = "vello_common"
version = "0.2.0"
+21 -21
View File
@@ -11,22 +11,22 @@ rust-version = "1.95"
repository = "https://github.com/storytold/effectcraft"
[workspace.dependencies]
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.1.0", default-features = false, features = ["read"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["stl", "obj", "gltf", "fbx"] }
craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9" }
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", version = "=0.1.0", default-features = false, features = ["read"] }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-quit = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-ecproj-format = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-eps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-webp = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-lottie = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
craft-mesh = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", default-features = false, features = ["stl", "obj", "gltf", "fbx"] }
craft-aep = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609" }
# craft-update: app-specific pretend versions apply to startup and manual checks.
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["egui"] }
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", features = ["egui"] }
# internal
effectcraft-time = { path = "crates/time" }
effectcraft-geom = { path = "crates/geom" }
@@ -90,9 +90,9 @@ same-file = "1.0"
tempfile = "3.27"
# codecs + containers shared by the Craft apps (crates/media, crates/export); keep all three on one rev.
craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["isobmff", "matroska"] }
craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] }
craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] }
craft-media = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", default-features = false, features = ["isobmff", "matroska"] }
craft-audio = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", default-features = false, features = ["aac-decode", "aac-encode", "opus-decode"] }
craft-video = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", features = ["h264-encode", "prores", "hevc-encode", "vp9-encode", "av1", "threads"] }
# footage decoding: FilmCraft's pure-Rust crates, pinned to a revision (plan/adr/0001).
# Only `crates/media`, `crates/export` and `crates/interchange` may depend on these.
@@ -122,7 +122,7 @@ half = "2.7"
# ui
# Shared frontend components; keep this dependency above the engine boundary.
# Shared UI and the complete egui family select reviewed immutable commits below.
craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", features = ["serde"] }
craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", features = ["serde"] }
# `default_fonts` and `monochrome_emoji_fonts` are explicit: the app's `FontDefinitions::default()`
# and its `✔`/`▣` chrome glyphs need both, and kittest's own dev-dependencies do not propagate.
egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] }
@@ -231,8 +231,8 @@ lto = "thin"
codegen-units = 1
[patch.crates-io]
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.7.2" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "47107f660191de2f0b425569506f4daa4faadac9", version = "=0.3.0" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", version = "=0.7.2" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "46478f4cf2d5879ae7ce0593f3f41eff90d98609", version = "=0.3.0" }
ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+5 -52
View File
@@ -1,4 +1,4 @@
use super::{HashMap, Rc, is_white};
use super::{HashMap, Rc};
/// The PostScript section of an EPS file (DOS EPS binary header handled) and its bounding box
/// (`%%HiResBoundingBox` preferred), read with `craft-eps`: the header comments, and the trailer
@@ -12,62 +12,15 @@ pub(super) fn find_from(hay: &[u8], needle: &[u8], from: usize) -> Option<usize>
hay.get(from..)?.windows(needle.len()).position(|w| w == needle).map(|p| p + from)
}
/// Every position of `needle` in `hay`, in order (one pass over the file).
fn positions(hay: &[u8], needle: &[u8]) -> Vec<usize> {
let mut out = vec![];
let mut from = 0;
while let Some(p) = find_from(hay, needle, from) {
out.push(p);
from = p + needle.len();
}
out
}
/// The name after `key` (`/FontName /Name`).
fn name_after(b: &[u8], key: &[u8]) -> Option<String> {
let p = find_from(b, key, 0)? + key.len();
let rest = &b[p..];
let s = rest.iter().position(|c| *c == b'/')? + 1;
let e = rest[s..].iter().position(|c| is_white(*c) || matches!(c, b'/' | b'[' | b'(' | b'{')).map_or(rest.len(), |q| s + q);
(e > s).then(|| String::from_utf8_lossy(&rest[s..e]).into_owned())
}
/// Embedded font programs of an EPS file: Type 1 fonts (`… /FontName /X … currentfile eexec
/// … cleartomark`, hexadecimal or binary) and CFF font sets (`… <length> StartData <bytes>`).
pub(super) fn embedded_fonts(ps: &[u8]) -> HashMap<String, (Rc<Vec<u8>>, bool)> {
let mut out = HashMap::new();
// The headers are found once, in one pass each; every `eexec` then takes the last header
// before it that no earlier `eexec` has used, so no prefix of the file is searched again.
let mut heads = positions(ps, b"%!PS-AdobeFont");
heads.extend(positions(ps, b"%!FontType1"));
heads.sort_unstable();
let names = positions(ps, b"/FontName");
let mut from = 0;
let mut used = 0;
while let Some(ee) = find_from(ps, b"eexec", from) {
from = ee + 5;
let last_before = |v: &[usize]| v[..v.partition_point(|&p| p < ee)].last().copied().filter(|&p| p >= used);
// The fallback look-back stops at the previous font's end, so it cannot pick up its header.
let start = last_before(&heads).or_else(|| last_before(&names).map(|p| p.saturating_sub(512).max(used)));
let Some(start) = start else { continue };
let end = find_from(ps, b"cleartomark", ee).map_or(ps.len(), |p| p + 11);
if let Some(name) = name_after(&ps[start..ee], b"/FontName") {
out.insert(name, (Rc::new(ps[start..end].to_vec()), false));
for font in craft_eps::embedded_font_programs(ps) {
let name = if font.cff { crate::cff::font_name(&font.program) } else { font.name };
if let Some(name) = name {
out.insert(name, (Rc::new(font.program), font.cff));
}
from = end;
used = end;
}
let mut from = 0;
while let Some(sd) = find_from(ps, b"StartData", from) {
from = sd + 9;
let head = String::from_utf8_lossy(&ps[sd.saturating_sub(64)..sd]).into_owned();
let Some(len) = head.split_whitespace().last().and_then(|t| t.parse::<usize>().ok()) else { continue };
let s = sd + 10;
let Some(data) = ps.get(s..s.saturating_add(len)) else { continue };
if let Some(name) = crate::cff::font_name(data) {
out.insert(name, (Rc::new(data.to_vec()), true));
}
from = s + len;
}
out
}
+1 -1
View File
@@ -5,7 +5,7 @@ use std::process::Command;
use serde_json::Value;
const REV: &str = "47107f660191de2f0b425569506f4daa4faadac9";
const REV: &str = "46478f4cf2d5879ae7ce0593f3f41eff90d98609";
const PACKAGES: &[(&str, &str)] = &[("craft-pdf", "0.1.0"), ("hayro-syntax", "0.7.2"), ("hayro-jbig2", "0.3.0")];
pub fn run(root: &Path) -> Result<(), String> {