]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
Use gf-metadata for proto handling, store everything as .proto text strings
authorSimon Cozens <simon@simon-cozens.org>
Mon, 2 Feb 2026 14:17:46 +0000 (14:17 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Mon, 2 Feb 2026 14:17:46 +0000 (14:17 +0000)
Cargo.lock
Cargo.toml
build.rs
src/lib.rs

index 38348a21dbab15ffdba28fd917a275f3471ba1a8..9a08a9d9e2ad264ce1667b1cb77e1080ccbb6087 100644 (file)
@@ -4,9 +4,9 @@ version = 4
 
 [[package]]
 name = "aho-corasick"
-version = "1.1.3"
+version = "1.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
 dependencies = [
  "memchr",
 ]
@@ -29,32 +29,26 @@ version = "1.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
 
-[[package]]
-name = "beef"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"
-
 [[package]]
 name = "bitflags"
-version = "2.9.4"
+version = "2.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
+checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
 
 [[package]]
 name = "bytemuck"
-version = "1.23.2"
+version = "1.25.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3995eaeebcdf32f91f980d360f78732ddc061097ab4e39991ae7a6ace9194677"
+checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
 dependencies = [
  "bytemuck_derive",
 ]
 
 [[package]]
 name = "bytemuck_derive"
-version = "1.10.1"
+version = "1.10.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4f154e572231cb6ba2bd1176980827e3d5dc04cc183a75dea38109fbdd672d29"
+checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -63,15 +57,15 @@ dependencies = [
 
 [[package]]
 name = "bytes"
-version = "1.10.1"
+version = "1.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
+checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
 
 [[package]]
 name = "cfg-if"
-version = "1.0.3"
+version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
 
 [[package]]
 name = "diff"
@@ -98,14 +92,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
 dependencies = [
  "libc",
- "windows-sys 0.61.1",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "euclid"
-version = "0.22.11"
+version = "0.22.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad9cdb4b747e485a12abb0e6566612956c7a1bafa3bdb8d682c5b6d403589e48"
+checksum = "df61bf483e837f88d5c2291dcf55c67be7e676b3a51acc48db3a7b163b91ed63"
 dependencies = [
  "num-traits",
 ]
@@ -122,12 +116,6 @@ version = "0.5.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
 
-[[package]]
-name = "fnv"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-
 [[package]]
 name = "font-types"
 version = "0.9.0"
@@ -151,14 +139,26 @@ dependencies = [
 
 [[package]]
 name = "getrandom"
-version = "0.3.3"
+version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
 dependencies = [
  "cfg-if",
  "libc",
  "r-efi",
- "wasi",
+ "wasip2",
+]
+
+[[package]]
+name = "gf-metadata"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6125c1c053786af0c39faebe483b519804f63a5bd4b2b092733686316db7bd0b"
+dependencies = [
+ "google-fonts-languages",
+ "protobuf",
+ "regex",
+ "walkdir",
 ]
 
 [[package]]
@@ -173,18 +173,36 @@ version = "0.4.17"
 dependencies = [
  "bytes",
  "fontations",
+ "gf-metadata",
  "glob",
  "indexmap",
  "itertools 0.13.0",
  "pretty_assertions",
  "prettyplease",
  "proc-macro2",
+ "quote",
+ "serde",
+ "serde_json",
+ "syn",
+]
+
+[[package]]
+name = "google-fonts-languages"
+version = "0.7.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fe180b8735d2804f098df3fb976014f7578a65b72bcdca016273ed3194c7a41"
+dependencies = [
+ "bytes",
+ "glob",
+ "itertools 0.13.0",
+ "prettyplease",
+ "proc-macro2",
  "prost",
  "prost-build",
  "protobuf",
  "protobuf-parse",
  "protobuf-support",
- "protox",
+ "protoc-bin-vendored",
  "quote",
  "serde",
  "serde_json",
@@ -193,9 +211,9 @@ dependencies = [
 
 [[package]]
 name = "hashbrown"
-version = "0.16.0"
+version = "0.16.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
 
 [[package]]
 name = "heck"
@@ -205,18 +223,18 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
 
 [[package]]
 name = "home"
-version = "0.5.11"
+version = "0.5.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
 dependencies = [
- "windows-sys 0.59.0",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
 name = "indexmap"
-version = "2.11.4"
+version = "2.13.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
+checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
 dependencies = [
  "equivalent",
  "hashbrown",
@@ -242,9 +260,9 @@ dependencies = [
 
 [[package]]
 name = "itoa"
-version = "1.0.15"
+version = "1.0.17"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
 
 [[package]]
 name = "kurbo"
@@ -257,17 +275,11 @@ dependencies = [
  "smallvec",
 ]
 
-[[package]]
-name = "lazy_static"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
-
 [[package]]
 name = "libc"
-version = "0.2.176"
+version = "0.2.180"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174"
+checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
 
 [[package]]
 name = "linux-raw-sys"
@@ -283,43 +295,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
 
 [[package]]
 name = "log"
-version = "0.4.28"
+version = "0.4.29"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
-
-[[package]]
-name = "logos"
-version = "0.15.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154"
-dependencies = [
- "logos-derive",
-]
-
-[[package]]
-name = "logos-codegen"
-version = "0.15.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c"
-dependencies = [
- "beef",
- "fnv",
- "lazy_static",
- "proc-macro2",
- "quote",
- "regex-syntax",
- "rustc_version",
- "syn",
-]
-
-[[package]]
-name = "logos-derive"
-version = "0.15.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470"
-dependencies = [
- "logos-codegen",
-]
+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
 
 [[package]]
 name = "memchr"
@@ -327,28 +305,6 @@ version = "2.7.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
 
-[[package]]
-name = "miette"
-version = "7.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7"
-dependencies = [
- "cfg-if",
- "miette-derive",
- "unicode-width",
-]
-
-[[package]]
-name = "miette-derive"
-version = "7.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
 [[package]]
 name = "multimap"
 version = "0.10.1"
@@ -402,9 +358,9 @@ dependencies = [
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.101"
+version = "1.0.106"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
 dependencies = [
  "unicode-ident",
 ]
@@ -452,18 +408,6 @@ dependencies = [
  "syn",
 ]
 
-[[package]]
-name = "prost-reflect"
-version = "0.15.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37587d5a8a1b3dc9863403d084fc2254b91ab75a702207098837950767e2260b"
-dependencies = [
- "logos",
- "miette",
- "prost",
- "prost-types",
-]
-
 [[package]]
 name = "prost-types"
 version = "0.13.5"
@@ -481,7 +425,7 @@ checksum = "d65a1d4ddae7d8b5de68153b48f6aa3bba8cb002b243dbdbc55a5afbc98f99f4"
 dependencies = [
  "once_cell",
  "protobuf-support",
- "thiserror 1.0.69",
+ "thiserror",
 ]
 
 [[package]]
@@ -496,7 +440,7 @@ dependencies = [
  "protobuf",
  "protobuf-support",
  "tempfile",
- "thiserror 1.0.69",
+ "thiserror",
  "which",
 ]
 
@@ -506,41 +450,78 @@ version = "3.7.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3e36c2f31e0a47f9280fb347ef5e461ffcd2c52dd520d8e216b52f93b0b0d7d6"
 dependencies = [
- "thiserror 1.0.69",
+ "thiserror",
 ]
 
 [[package]]
-name = "protox"
-version = "0.8.0"
+name = "protoc-bin-vendored"
+version = "3.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "424c2bd294b69c49b949f3619362bc3c5d28298cd1163b6d1a62df37c16461aa"
+checksum = "d1c381df33c98266b5f08186583660090a4ffa0889e76c7e9a5e175f645a67fa"
 dependencies = [
- "bytes",
- "miette",
- "prost",
- "prost-reflect",
- "prost-types",
- "protox-parse",
- "thiserror 2.0.17",
+ "protoc-bin-vendored-linux-aarch_64",
+ "protoc-bin-vendored-linux-ppcle_64",
+ "protoc-bin-vendored-linux-s390_64",
+ "protoc-bin-vendored-linux-x86_32",
+ "protoc-bin-vendored-linux-x86_64",
+ "protoc-bin-vendored-macos-aarch_64",
+ "protoc-bin-vendored-macos-x86_64",
+ "protoc-bin-vendored-win32",
 ]
 
 [[package]]
-name = "protox-parse"
-version = "0.8.0"
+name = "protoc-bin-vendored-linux-aarch_64"
+version = "3.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57927f9dbeeffcce7192404deee6157a640cbb3fe8ac11eabbe571565949ab75"
-dependencies = [
- "logos",
- "miette",
- "prost-types",
- "thiserror 2.0.17",
-]
+checksum = "c350df4d49b5b9e3ca79f7e646fde2377b199e13cfa87320308397e1f37e1a4c"
+
+[[package]]
+name = "protoc-bin-vendored-linux-ppcle_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a55a63e6c7244f19b5c6393f025017eb5d793fd5467823a099740a7a4222440c"
+
+[[package]]
+name = "protoc-bin-vendored-linux-s390_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1dba5565db4288e935d5330a07c264a4ee8e4a5b4a4e6f4e83fad824cc32f3b0"
+
+[[package]]
+name = "protoc-bin-vendored-linux-x86_32"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8854774b24ee28b7868cd71dccaae8e02a2365e67a4a87a6cd11ee6cdbdf9cf5"
+
+[[package]]
+name = "protoc-bin-vendored-linux-x86_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b38b07546580df720fa464ce124c4b03630a6fb83e05c336fea2a241df7e5d78"
+
+[[package]]
+name = "protoc-bin-vendored-macos-aarch_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89278a9926ce312e51f1d999fee8825d324d603213344a9a706daa009f1d8092"
+
+[[package]]
+name = "protoc-bin-vendored-macos-x86_64"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81745feda7ccfb9471d7a4de888f0652e806d5795b61480605d4943176299756"
+
+[[package]]
+name = "protoc-bin-vendored-win32"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95067976aca6421a523e491fce939a3e65249bac4b977adee0ee9771568e8aa3"
 
 [[package]]
 name = "quote"
-version = "1.0.41"
+version = "1.0.44"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
+checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
 dependencies = [
  "proc-macro2",
 ]
@@ -563,9 +544,9 @@ dependencies = [
 
 [[package]]
 name = "regex"
-version = "1.11.3"
+version = "1.12.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c"
+checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -575,9 +556,9 @@ dependencies = [
 
 [[package]]
 name = "regex-automata"
-version = "0.4.11"
+version = "0.4.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad"
+checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
 dependencies = [
  "aho-corasick",
  "memchr",
@@ -586,18 +567,9 @@ dependencies = [
 
 [[package]]
 name = "regex-syntax"
-version = "0.8.6"
+version = "0.8.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
-
-[[package]]
-name = "rustc_version"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
-dependencies = [
- "semver",
-]
+checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
 
 [[package]]
 name = "rustix"
@@ -614,28 +586,25 @@ dependencies = [
 
 [[package]]
 name = "rustix"
-version = "1.1.2"
+version = "1.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
+checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
 dependencies = [
  "bitflags",
  "errno",
  "libc",
  "linux-raw-sys 0.11.0",
- "windows-sys 0.61.1",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
-name = "ryu"
-version = "1.0.20"
+name = "same-file"
+version = "1.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
-
-[[package]]
-name = "semver"
-version = "1.0.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
 
 [[package]]
 name = "serde"
@@ -669,15 +638,15 @@ dependencies = [
 
 [[package]]
 name = "serde_json"
-version = "1.0.145"
+version = "1.0.149"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
+checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
 dependencies = [
  "itoa",
  "memchr",
- "ryu",
  "serde",
  "serde_core",
+ "zmij",
 ]
 
 [[package]]
@@ -698,9 +667,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
 
 [[package]]
 name = "syn"
-version = "2.0.106"
+version = "2.0.114"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
+checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -709,15 +678,15 @@ dependencies = [
 
 [[package]]
 name = "tempfile"
-version = "3.23.0"
+version = "3.24.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"
+checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c"
 dependencies = [
  "fastrand",
  "getrandom",
  "once_cell",
- "rustix 1.1.2",
- "windows-sys 0.61.1",
+ "rustix 1.1.3",
+ "windows-sys 0.61.2",
 ]
 
 [[package]]
@@ -726,16 +695,7 @@ version = "1.0.69"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
 dependencies = [
- "thiserror-impl 1.0.69",
-]
-
-[[package]]
-name = "thiserror"
-version = "2.0.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
-dependencies = [
- "thiserror-impl 2.0.17",
+ "thiserror-impl",
 ]
 
 [[package]]
@@ -749,43 +709,27 @@ dependencies = [
  "syn",
 ]
 
-[[package]]
-name = "thiserror-impl"
-version = "2.0.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
 [[package]]
 name = "unicode-ident"
-version = "1.0.19"
+version = "1.0.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
+checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
 
 [[package]]
-name = "unicode-width"
-version = "0.1.14"
+name = "walkdir"
+version = "2.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
-
-[[package]]
-name = "wasi"
-version = "0.14.7+wasi-0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
 dependencies = [
- "wasip2",
+ "same-file",
+ "winapi-util",
 ]
 
 [[package]]
 name = "wasip2"
-version = "1.0.1+wasi-0.2.4"
+version = "1.0.2+wasi-0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
+checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
 dependencies = [
  "wit-bindgen",
 ]
@@ -802,11 +746,20 @@ dependencies = [
  "rustix 0.38.44",
 ]
 
+[[package]]
+name = "winapi-util"
+version = "0.1.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
 [[package]]
 name = "windows-link"
-version = "0.2.0"
+version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
 
 [[package]]
 name = "windows-sys"
@@ -819,9 +772,9 @@ dependencies = [
 
 [[package]]
 name = "windows-sys"
-version = "0.61.1"
+version = "0.61.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
 dependencies = [
  "windows-link",
 ]
@@ -892,9 +845,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
 
 [[package]]
 name = "wit-bindgen"
-version = "0.46.0"
+version = "0.51.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
 
 [[package]]
 name = "write-fonts"
@@ -914,3 +867,9 @@ name = "yansi"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
+
+[[package]]
+name = "zmij"
+version = "1.0.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"
index d32dff4f8ebf9ceb8eb9682adb7f1fe1f3150315..3eb0696c2c8d04470927b54132f89fd05e9aac6b 100644 (file)
@@ -11,7 +11,7 @@ default = ["fontations"]
 
 [dependencies]
 bytes = "1.7.1"
-prost = "0.13"
+gf-metadata = "0.2.4"
 serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 fontations = { version = "0.3.0", optional = true }
@@ -21,15 +21,10 @@ indexmap = "2.7.0"
 pretty_assertions = "1.4.1"
 
 [build-dependencies]
-prost-build = "0.13"
-protobuf-support = "3.7.1"
-protobuf = "3.7.1"
-protobuf-parse = "3.7.1"
-protox = "0.8"
 glob = "0"
 prettyplease = "0.2"
 quote = "1.0"
 proc-macro2 = "1.0"
 syn = "2.0"
 itertools = "0.13"
-serde_json = "1.0"
+gf-metadata = "0.2.4"
index 6fe5a7e8d4a42f75012491b29d8354de7815224d..d173b10d157aa0bfd25be48ce9b4f37b8a658401 100644 (file)
--- a/build.rs
+++ b/build.rs
@@ -1,59 +1,24 @@
+use gf_metadata::AxisProto;
 use proc_macro2::TokenStream;
-use protobuf::reflect::{FieldDescriptor, ReflectValueRef};
 use quote::quote;
-use serde_json::Map;
-use std::io::{BufWriter, Write};
-use std::{env, fs::File, path::Path};
+use std::{
+    env,
+    fs::File,
+    io::{BufWriter, Write},
+    path::Path,
+};
 
 fn main() {
-    // First we load up the descriptor using the protobuf crate
-    // so that we can do reflection on it.
-    let descriptors = protobuf_parse::Parser::new()
-        .pure()
-        .include(".")
-        .input("Lib/axisregistry/axes.proto")
-        .file_descriptor_set()
-        .expect("Could not parse axes.proto");
-    let protofile = descriptors.file.first().expect("No file in descriptor");
-    let descriptor = protobuf::reflect::FileDescriptor::new_dynamic(protofile.clone(), &[])
-        .expect("Could not create descriptor");
-
-    // Now we use protox + prost-build for pure Rust compilation (no protoc needed)
-    let file_descriptors = protox::compile(
-        ["Lib/axisregistry/axes.proto"],
-        ["Lib/axisregistry"]
-    ).expect("Could not compile axes.proto with protox");
-
-    let mut config = prost_build::Config::new();
-    // config.boxed(".google.axes.LanguageProto.sample_text");
-    // config.boxed(".google.axes.LanguageProto.exemplar_chars");
-
-    // The reflection can tell us what messages we have, so we can configure
-    // them to be deserializable with serde
-    for message in descriptor.messages() {
-        config.type_attribute(
-            message.full_name(),
-            "#[derive(serde::Serialize, serde::Deserialize)]",
-        );
-    }
-    // Let's make our structs; this produces google.axes.rs
-    config
-        .compile_fds(file_descriptors)
-        .expect("Could not compile proto file_descriptors");
-
     let path = Path::new(&env::var("OUT_DIR").unwrap()).join("data.rs");
     let mut file = BufWriter::new(File::create(path).unwrap());
     let mut output = quote! { use std::collections::BTreeMap; use std::sync::LazyLock; };
 
     output.extend(serialize_a_structure(
-        ".AxisProto",
         "Lib/axisregistry/data/*.textproto",
         "AXES",
-        &descriptor,
     ));
 
-    // file.write_all(output.to_string().as_bytes())
-    //     .expect("Could not write to file");
+    // let formatted = output.to_string();
 
     let abstract_file: syn::File = syn::parse2(output).expect("Could not parse output");
     let formatted = prettyplease::unparse(&abstract_file);
@@ -61,99 +26,47 @@ fn main() {
         .expect("Could not write to file");
 }
 
-fn serialize_a_structure(
-    proto_name: &str,
-    pathglob: &str,
-    output_variable: &str,
-    descriptor: &protobuf::reflect::FileDescriptor,
-) -> TokenStream {
-    let proto = descriptor
-        .message_by_full_name(proto_name)
-        .unwrap_or_else(|| panic!("No {} message", proto_name));
+fn serialize_a_structure(pathglob: &str, output_variable: &str) -> TokenStream {
     let files: Vec<std::path::PathBuf> = glob::glob(pathglob)
         .expect("Failed to read glob pattern")
         .flatten()
         .collect();
-    let name: TokenStream = proto.name().parse().unwrap();
     let variable: TokenStream = output_variable.parse().unwrap();
-    let mut map = Map::new();
+    let mut gobbets = vec![];
+    let mut names = vec![];
+    let mut tags = vec![];
     for file in files.into_iter() {
-        serialize_file(file, &proto, &mut map);
+        let (gobbet, name, tag) = serialize_file(file);
+        gobbets.push(gobbet);
+        names.push(name);
+        tags.push(tag);
     }
-    let json_var: TokenStream = format!("__{}", output_variable).parse().unwrap();
-    let docmsg = format!("A map of all the {} objects", name);
-    let json_dump = serde_json::to_string(&map).expect("Could not serialize");
     quote! {
-        static #json_var: &str = #json_dump;
-
-        #[doc = #docmsg]
-        pub static #variable: LazyLock<BTreeMap<String, Box<#name>>> = LazyLock::new(|| {
-            serde_json::from_str(#json_var).expect("Could not deserialize")
+        #(#gobbets)*
+        #[doc = "A map of all the Axis objects"]
+        pub static #variable: LazyLock<BTreeMap<String, Box<AxisProto>>> = LazyLock::new(|| {
+            let mut m = BTreeMap::new();
+            #(
+                let proto: AxisProto = AxisProto::parse_from_str(#names).expect("Could not parse JSON");
+                m.insert(#tags.to_string(), Box::new(proto));
+            )*
+            m
         });
     }
 }
-fn serialize_file(
-    path: std::path::PathBuf,
-    descriptor: &protobuf::reflect::MessageDescriptor,
-    value: &mut Map<String, serde_json::Value>,
-) {
-    let mut message = descriptor.new_instance();
-    let message_mut = message.as_mut();
-    let input = std::fs::read_to_string(&path).expect("Could not read file");
-    protobuf::text_format::merge_from_str(message_mut, &input)
-        .unwrap_or_else(|e| panic!("Could not parse file {:?}: {:?}", path, e));
-    let message = serialize_message(message_mut);
-    value.insert(
-        message.get("tag").unwrap().as_str().unwrap().to_string(),
-        message,
-    );
-}
-
-fn serialize_message(message: &dyn protobuf::MessageDyn) -> serde_json::Value {
-    let descriptor = message.descriptor_dyn();
-    // let descriptor_name: TokenStream = descriptor.name().parse().unwrap();
-    let mut output = Map::new();
-    for field in descriptor.fields() {
-        let field_name: TokenStream = field.name().parse().unwrap();
-        let field_contents = serialize_field(&field, message);
-        output.insert(field_name.to_string(), field_contents);
-    }
-    output.into()
-}
-
-fn serialize_field(
-    field: &FieldDescriptor,
-    message: &dyn protobuf::MessageDyn,
-) -> serde_json::Value {
-    if field.is_repeated() {
-        let v: Vec<serde_json::Value> = field
-            .get_repeated(message)
-            .into_iter()
-            .map(|value| serialize_field_value(field, value))
-            .collect();
-        v.into()
-    } else if field.is_required() {
-        serialize_field_value(field, field.get_singular(message).unwrap())
-    } else if field.has_field(message) {
-        let value = serialize_field_value(field, field.get_singular(message).unwrap());
-        value.into()
-    } else {
-        serde_json::Value::Null
-    }
-}
-
-fn serialize_field_value(_field: &FieldDescriptor, value: ReflectValueRef) -> serde_json::Value {
-    match value {
-        ReflectValueRef::Bool(value) => value.into(),
-        ReflectValueRef::I32(value) => value.into(),
-        ReflectValueRef::I64(value) => value.into(),
-        ReflectValueRef::U32(value) => value.into(),
-        ReflectValueRef::U64(value) => value.into(),
-        ReflectValueRef::F32(value) => value.into(),
-        ReflectValueRef::F64(value) => value.into(),
-        ReflectValueRef::String(value) => value.into(),
-        ReflectValueRef::Bytes(value) => value.into(),
-        ReflectValueRef::Enum(_value, _ix) => unimplemented!(),
-        ReflectValueRef::Message(value) => serialize_message(&*value),
-    }
+fn serialize_file(path: std::path::PathBuf) -> (TokenStream, TokenStream, String) {
+    let contents = std::fs::read_to_string(&path).expect("Could not read file");
+    let proto: AxisProto = AxisProto::parse_from_str(&contents)
+        .unwrap_or_else(|_| panic!("Could not parse proto {}", path.display()));
+    let name: TokenStream = format!("AXIS_{}", proto.tag().to_ascii_uppercase())
+        .parse()
+        .unwrap();
+    // Resolve absolute path here
+    let path = std::fs::canonicalize(path).unwrap();
+    let path_as_string = path.to_str().unwrap();
+    let tag: String = proto.tag().to_string().parse().unwrap();
+    let include_gobbet = quote! {
+        const #name: &str = include_str!(#path_as_string);
+    };
+    (include_gobbet, name, tag)
 }
index bd3e3b9e4da3f114a014b55d6b276d1e54425f07..01fc5dade006c27de8bb9e3f75459361cc1defa3 100644 (file)
@@ -1,3 +1,4 @@
+use gf_metadata::{AxisProto, FallbackProto};
 use std::{collections::HashSet, ops::Index};
 
 #[cfg(feature = "fontations")]
@@ -10,7 +11,6 @@ use fontations::{
 };
 use indexmap::IndexMap;
 
-include!(concat!(env!("OUT_DIR"), "/_.rs"));
 include!(concat!(env!("OUT_DIR"), "/data.rs"));
 
 const LINKED_VALUES: [(&str, (f32, f32)); 2] = [("wght", (400.0, 700.0)), ("ital", (0.0, 1.0))];