diff --git a/Cargo.lock b/Cargo.lock index d4b7fc28a2..aaeb107261 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "adler" @@ -8,6 +8,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "adler32" version = "1.0.4" @@ -74,9 +80,9 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "ascii-canvas" @@ -189,9 +195,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" dependencies = [ "serde", ] @@ -233,9 +239,23 @@ checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" [[package]] name = "bytemuck" -version = "1.2.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" +checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecc273b49b3205b83d648f0690daa588925572cc5063745bfe547fe7ec8e1a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.25", +] [[package]] name = "byteorder" @@ -409,6 +429,15 @@ dependencies = [ "objc", ] +[[package]] +name = "color" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ae467d04a8a8aea5d9a49018a6ade2e4221d92968e8ce55a48c0b1164e5f698" +dependencies = [ + "bytemuck", +] + [[package]] name = "compositor" version = "0.1.0" @@ -736,6 +765,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.25", +] + [[package]] name = "dlib" version = "0.5.0" @@ -789,6 +829,12 @@ dependencies = [ "log", ] +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + [[package]] name = "etagere" version = "0.2.13" @@ -820,6 +866,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + [[package]] name = "firefox-on-glean" version = "0.1.0" @@ -839,7 +894,7 @@ dependencies = [ "cfg-if 1.0.0", "crc32fast", "libc", - "miniz_oxide", + "miniz_oxide 0.5.1", ] [[package]] @@ -848,6 +903,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "font-loader" version = "0.11.0" @@ -861,6 +922,48 @@ dependencies = [ "winapi", ] +[[package]] +name = "font-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02a596f5713680923a2080d86de50fe472fb290693cf0f701187a1c8b36996b7" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontconfig-cache-parser" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7f8afb20c8069fd676d27b214559a337cc619a605d25a87baa90b49a06f3b18" +dependencies = [ + "bytemuck", + "thiserror", +] + +[[package]] +name = "fontique" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39f97079e1293b8c1e9fb03a2875d328bd2ee8f3b95ce62959c0acc04049c708" +dependencies = [ + "bytemuck", + "fontconfig-cache-parser", + "hashbrown 0.15.3", + "icu_locid", + "memmap2 0.9.5", + "objc2", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation", + "peniko", + "read-fonts", + "roxmltree", + "smallvec", + "windows", + "windows-core", +] + [[package]] name = "foreign-types" version = "0.3.2" @@ -1219,6 +1322,17 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + [[package]] name = "heck" version = "0.5.0" @@ -1234,6 +1348,18 @@ dependencies = [ "libc", ] +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", +] + [[package]] name = "id-arena" version = "2.2.1" @@ -1268,7 +1394,7 @@ dependencies = [ "num-iter", "num-rational", "num-traits", - "png", + "png 0.16.2", ] [[package]] @@ -1358,6 +1484,16 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +[[package]] +name = "kurbo" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1077d333efea6170d9ccb96d3c3026f300ca0773da4938cc4c811daa6df68b0c" +dependencies = [ + "arrayvec", + "smallvec", +] + [[package]] name = "lalrpop" version = "0.19.8" @@ -1497,9 +1633,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.139" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libloading" @@ -1523,6 +1659,12 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + [[package]] name = "lmdb-rkv" version = "0.14.0" @@ -1609,6 +1751,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memmap2" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.6.5" @@ -1655,6 +1806,16 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "mio" version = "0.8.2" @@ -1874,6 +2035,50 @@ dependencies = [ "malloc_buf", ] +[[package]] +name = "objc2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88c6597e14493ab2e44ce58f2fdecf095a51f12ca57bec060a11c57332520551" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" +dependencies = [ + "bitflags 2.9.1", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ba833d4a1cb1aac330f8c973fd92b6ff1858e4aef5cdd00a255eefb28022fb5" +dependencies = [ + "bitflags 2.9.1", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c" +dependencies = [ + "bitflags 2.9.1", + "objc2", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -1993,6 +2198,18 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "peniko" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f9529efd019889b2a205193c14ffb6e2839b54ed9d2720674f10f4b04d87ac9" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "smallvec", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -2069,6 +2286,19 @@ dependencies = [ "inflate", ] +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.8", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2216,6 +2446,16 @@ dependencies = [ "rand_core 0.3.1", ] +[[package]] +name = "read-fonts" +version = "0.29.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f96bfbb7df43d34a2b7b8582fcbcb676ba02a763265cb90bc8aabfd62b57d64" +dependencies = [ + "bytemuck", + "font-types", +] + [[package]] name = "redox_syscall" version = "0.2.13" @@ -2261,7 +2501,7 @@ checksum = "2c6d906922d99c677624d2042a93f89b2b7df0f6411032237d5d99a602c2487c" dependencies = [ "arrayref", "bincode", - "bitflags 2.4.2", + "bitflags 2.9.1", "byteorder", "id-arena", "lazy_static", @@ -2300,6 +2540,12 @@ dependencies = [ "text-size", ] +[[package]] +name = "roxmltree" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -2439,17 +2685,33 @@ dependencies = [ "libc", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "siphasher" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +[[package]] +name = "skrifa" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbeb4ca4399663735553a09dd17ce7e49a0a0203f03b706b39628c4d913a8607" +dependencies = [ + "bytemuck", + "read-fonts", +] + [[package]] name = "smallvec" -version = "1.10.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" dependencies = [ "serde", ] @@ -2471,7 +2733,7 @@ dependencies = [ "dlib", "lazy_static", "log", - "memmap2", + "memmap2 0.3.1", "nix", "pkg-config", "wayland-client", @@ -2674,6 +2936,15 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", +] + [[package]] name = "tinyvec" version = "1.5.1" @@ -2896,6 +3167,28 @@ dependencies = [ "getrandom", ] +[[package]] +name = "vello_common" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b5e49f2836e87b6bd3d8f70324696f22b5f7dfdc836caeab463fff05957c1b1" +dependencies = [ + "bytemuck", + "peniko", + "png 0.17.16", + "skrifa", + "smallvec", +] + +[[package]] +name = "vello_cpu" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a45e0a6b777abb4354e15146ecf95bac03aada7a85024fd47762f56095b32896" +dependencies = [ + "vello_common", +] + [[package]] name = "version_check" version = "0.9.1" @@ -3078,7 +3371,7 @@ version = "0.62.0" dependencies = [ "allocator-api2", "bincode", - "bitflags 2.4.2", + "bitflags 2.9.1", "build-parallel", "byteorder", "derive_more", @@ -3096,7 +3389,7 @@ dependencies = [ "num-traits", "peek-poke", "plane-split", - "png", + "png 0.16.2", "rand 0.4.6", "rayon", "ron", @@ -3133,7 +3426,7 @@ name = "webrender_api" version = "0.62.0" dependencies = [ "app_units", - "bitflags 2.4.2", + "bitflags 2.9.1", "byteorder", "crossbeam-channel", "euclid", @@ -3150,7 +3443,7 @@ dependencies = [ name = "webrender_build" version = "0.0.2" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.9.1", "lazy_static", "serde", ] @@ -3206,13 +3499,77 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.25", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.25", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", ] [[package]] @@ -3221,13 +3578,29 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -3236,42 +3609,90 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winit" version = "0.26.1" @@ -3325,6 +3746,7 @@ dependencies = [ "env_logger", "euclid", "firefox-on-glean", + "fontique", "freetype", "fxhash", "gleam", @@ -3334,11 +3756,14 @@ dependencies = [ "libc", "log", "malloc_size_of_derive", + "memmap2 0.9.5", "objc", "rayon", "serde", + "skrifa", "smallvec", "tracy-rs", + "vello_cpu", "webrender_api", "winit", "wr_malloc_size_of", @@ -3386,6 +3811,12 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.2.0" diff --git a/webrender/Cargo.toml b/webrender/Cargo.toml index 010779603f..12724fe008 100644 --- a/webrender/Cargo.toml +++ b/webrender/Cargo.toml @@ -9,7 +9,7 @@ build = "build.rs" edition = "2018" [features] -default = ["static_freetype"] +default = ["fontations", "static_freetype"] profiler = ["tracy-rs/enable_profiler"] capture = ["api/serialize", "ron", "serde", "smallvec/serde", "etagere/serialization", "glyph_rasterizer/capture"] replay = ["api/deserialize", "ron", "serde", "smallvec/serde", "etagere/serialization", "glyph_rasterizer/replay"] @@ -17,6 +17,7 @@ display_list_stats = ["api/display_list_stats"] serialize_program = ["serde", "webrender_build/serialize_program"] dynamic_freetype = ["glyph_rasterizer/dynamic_freetype"] static_freetype = ["glyph_rasterizer/static_freetype"] +fontations = ["glyph_rasterizer/fontations"] leak_checks = [] gecko = ["firefox-on-glean", "glean", "glyph_rasterizer/gecko"] sw_compositor = ["swgl"] diff --git a/webrender_api/Cargo.toml b/webrender_api/Cargo.toml index a679fe1e5b..5a254b81a3 100644 --- a/webrender_api/Cargo.toml +++ b/webrender_api/Cargo.toml @@ -12,6 +12,7 @@ nightly = ["euclid/unstable", "serde/unstable"] serialize = [] deserialize = [] display_list_stats = [] +fontations = [] [dependencies] app_units = "0.7.3" diff --git a/webrender_api/src/font.rs b/webrender_api/src/font.rs index 46bc632266..726d0283ed 100644 --- a/webrender_api/src/font.rs +++ b/webrender_api/src/font.rs @@ -5,8 +5,6 @@ use peek_poke::PeekPoke; use std::cmp::Ordering; use std::hash::{Hash, Hasher}; -#[cfg(not(any(target_os = "macos", target_os = "ios")))] -use std::path::PathBuf; use std::sync::Arc; // local imports use crate::IdNamespace; @@ -55,7 +53,7 @@ impl FontSize { #[cfg(not(any(target_os = "macos", target_os = "ios")))] #[derive(Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize)] pub struct NativeFontHandle { - pub path: PathBuf, + pub path: std::path::PathBuf, pub index: u32, } diff --git a/wr_glyph_rasterizer/Cargo.toml b/wr_glyph_rasterizer/Cargo.toml index 23bdba5f84..9dac4d97fc 100644 --- a/wr_glyph_rasterizer/Cargo.toml +++ b/wr_glyph_rasterizer/Cargo.toml @@ -10,6 +10,7 @@ edition = "2018" default = ["static_freetype"] dynamic_freetype = [] static_freetype = ["freetype/freetype-sys"] +fontations = ["vello_cpu", "fontique", "skrifa", "memmap2", "api/fontations"] capture = ["api/serialize", "serde", "smallvec/serde"] replay = ["api/deserialize", "serde", "smallvec/serde"] gecko = ["firefox-on-glean", "glean"] @@ -28,6 +29,10 @@ fxhash = "0.2.1" glean = { workspace = true, optional = true } firefox-on-glean = { version = "0.1.0", optional = true } serde = { optional = true, version = "1.0", features = ["serde_derive"] } +vello_cpu = { version = "0.0.1", optional = true } +fontique = { version = "0.5.0", optional = true } +skrifa = { version = "0.31", optional = true } +memmap2 = { version = "0.9", optional = true } [dev-dependencies] env_logger = { version = "0.10", default-features = false } diff --git a/wr_glyph_rasterizer/src/lib.rs b/wr_glyph_rasterizer/src/lib.rs index 3cf95d7c31..bdbf984f18 100644 --- a/wr_glyph_rasterizer/src/lib.rs +++ b/wr_glyph_rasterizer/src/lib.rs @@ -26,6 +26,7 @@ extern crate malloc_size_of_derive; extern crate tracy_rs; #[macro_use] extern crate log; +#[allow(unused_imports)] #[macro_use] extern crate lazy_static; #[macro_use] @@ -38,18 +39,26 @@ extern crate serde; extern crate malloc_size_of; pub mod platform { - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(all(any(target_os = "ios", target_os = "macos"), not(feature = "fontations")))] pub use crate::platform::macos::font; #[cfg(any(target_os = "android", all(unix, not(any(target_os = "ios", target_os = "macos")))))] pub use crate::platform::unix::font; #[cfg(target_os = "windows")] pub use crate::platform::windows::font; - #[cfg(any(target_os = "ios", target_os = "macos"))] + #[cfg(feature = "fontations")] + pub use crate::platform::fontations::font; + + #[cfg(feature = "fontations")] + pub mod fontations { + pub mod font; + } + + #[cfg(all(any(target_os = "ios", target_os = "macos"), not(feature = "fontations")))] pub mod macos { pub mod font; } - #[cfg(any(target_os = "android", all(unix, not(any(target_os = "macos", target_os = "ios")))))] + #[cfg(any(target_os = "android", all(unix, not(any(target_os = "macos", target_os = "ios", feature = "fontations")))))] pub mod unix { pub mod font; } diff --git a/wr_glyph_rasterizer/src/platform/fontations/font.rs b/wr_glyph_rasterizer/src/platform/fontations/font.rs new file mode 100644 index 0000000000..52a8a435fa --- /dev/null +++ b/wr_glyph_rasterizer/src/platform/fontations/font.rs @@ -0,0 +1,248 @@ +use std::{path::PathBuf, sync::Arc}; +use std::collections::HashMap; +use api::{FontKey, GlyphDimensions, NativeFontHandle}; +use memmap2::Mmap; +use skrifa::charmap::Charmap; +use skrifa::instance::Location; +use skrifa::metrics::GlyphMetrics; +use skrifa::prelude::{LocationRef, Size}; +use skrifa::raw::{FileRef}; +use skrifa::GlyphId; + +use crate::{FontInstance, GlyphKey, GlyphRasterResult, RasterizedGlyph}; + +struct CachedFont { + pub data: Arc + Send + Sync>, + pub index: u32, + pub settings: FontRenderSettings, +} + +#[derive(Default)] +struct FontRenderSettings { + pub font_size: f32, +} + +#[cfg(any(target_os = "macos", target_os = "ios"))] +struct SimpleFontHandle { + pub path: PathBuf, + pub index: u32, + pub data: Mmap, +} + +impl SimpleFontHandle { + pub(crate) fn new(path: PathBuf, index: u32) -> Self { + let file = std::fs::File::open(&path).unwrap(); + let mapped = unsafe { Mmap::map(&file) }.unwrap(); + Self { + path, + index, + data: mapped, + } + } +} + +impl From for SimpleFontHandle { + #[cfg(not(any(target_os = "macos", target_os = "ios")))] + fn from(native: NativeFontHandle) -> Self { + let file = std::fs::File::open(&native.path).unwrap(); + let mapped = unsafe { Mmap::map(&file) }.unwrap(); + + SimpleFontHandle { + path: native.path, + index: native.index, + data: mapped, + } + } + + #[cfg(any(target_os = "macos", target_os = "ios"))] + fn from(native: NativeFontHandle) -> Self { + let file = std::fs::File::open(&native.path).unwrap(); + let mapped = unsafe { Mmap::map(&file) }.unwrap(); + let font_file = FileRef::new(&mapped).unwrap(); + let index = ttc_index_from_postscript_name(font_file, &native.name); + + SimpleFontHandle { + path: PathBuf::from(native.path), + index, + data: mapped, + } + } +} + +trait RasterContext { + // Static fns + fn distribute_across_threads() -> bool; + fn new() -> Self; + fn begin_rasterize(font: &FontInstance); + fn end_rasterize(font: &FontInstance); + fn prepare_font(font: &mut FontInstance); + + // Font registration + fn add_raw_font(&mut self, font_key: &FontKey, bytes: Arc>, index: u32); + fn add_native_font(&mut self, font_key: &FontKey, native_font_handle: NativeFontHandle); + fn delete_font(&mut self, font_key: &FontKey); + fn delete_font_instance(&mut self, instance: &FontInstance); + + // Methods + fn get_glyph_index(&mut self, font_key: FontKey, ch: char) -> Option; + fn get_glyph_dimensions( + &mut self, + font: &FontInstance, + key: &GlyphKey, + ) -> Option; + fn rasterize_glyph(&mut self, font: &FontInstance, key: &GlyphKey) -> GlyphRasterResult; +} + +pub struct FontContext { + font_cache: HashMap, +} + +impl FontContext { + // Static fns + pub fn distribute_across_threads() -> bool { + true + } + pub fn new() -> FontContext { + FontContext { + font_cache: HashMap::new(), + } + } + pub fn begin_rasterize(font: &FontInstance) { + // TODO: apply instance properties + } + pub fn end_rasterize(font: &FontInstance) { + // TODO: clear instance properties + } + + pub fn prepare_font(font: &mut FontInstance) { + // Perhaps not needed for fontations? + } + pub fn delete_font_instance(&mut self, _instance: &FontInstance) { + // Do these pair? + } + + pub fn add_raw_font(&mut self, font_key: &FontKey, bytes: Arc>, index: u32) { + let font = CachedFont { + data: bytes, + index: index, + settings: FontRenderSettings::default(), + }; + self.font_cache.insert(*font_key, font); + } + pub fn add_native_font(&mut self, font_key: &FontKey, native_font_handle: NativeFontHandle) { + let handle = SimpleFontHandle::from(native_font_handle); + let font = CachedFont { + data: Arc::new(handle.data), + index: handle.index, + settings: FontRenderSettings::default(), + }; + self.font_cache.insert(*font_key, font); + } + pub fn delete_font(&mut self, font_key: &FontKey) { + self.font_cache.remove(font_key); + } + + // Methods + pub fn get_glyph_index(&mut self, font_key: FontKey, ch: char) -> Option { + let font = self.font_cache.get(&font_key)?; + let data: &[u8] = font.data.as_ref().as_ref(); + let font_ref = skrifa::FontRef::from_index(data, font.index).ok()?; + + let char_map = Charmap::new(&font_ref); + let glyph_id = char_map.map(ch)?; + + Some(glyph_id.to_u32()) + } + + pub fn get_glyph_dimensions( + &mut self, + font: &FontInstance, + key: &GlyphKey, + ) -> Option { + let font = self.font_cache.get(&font.font_key)?; + let data: &[u8] = font.data.as_ref().as_ref(); + let font_ref = skrifa::FontRef::from_index(data, font.index).ok()?; + + // TODO: set variation axis + // + // let location = font_ref.axes().location( + // variations + // .iter() + // .map(|v| (Tag::new(&v.tag.to_le_bytes()), v.value)), + // ); + // let location_ref = LocationRef::from(&location); + let location = Location::new(0); + let location_ref = LocationRef::from(&location); + + let font_size = font.settings.font_size; + let glyph_metrics = GlyphMetrics::new(&font_ref, Size::new(font_size), location_ref); + let advance = glyph_metrics.advance_width(GlyphId::new(key.index()))?; + let bounds = glyph_metrics.bounds(GlyphId::new(key.index()))?; + + Some(GlyphDimensions { + advance, + + // TODO: investigate why Skrifa provides f32 but WebRender expects i32 + // TODO: use hinted metrics + left: bounds.x_min as i32, + top: bounds.y_min as i32, + width: (bounds.x_max - bounds.x_min) as i32, + height: (bounds.y_max - bounds.y_min) as i32, + }) + } + pub fn rasterize_glyph(&mut self, font: &FontInstance, key: &GlyphKey) -> GlyphRasterResult { + // todo!() + + Ok(RasterizedGlyph { + top: (), + left: (), + width: (), + height: (), + scale: (), + format: (), + bytes: (), + }) + } +} + +/// CoreText font enumaration gives us a postscript name rather than an index. +/// This functions maps from postscript name to index +#[cfg(any(target_os = "macos", target_os = "ios"))] +fn ttc_index_from_postscript_name(font_file: FileRef<'_>, postscript_name: &str) -> u32 { + use skrifa::raw::{FileRef, TableProvider as _}; + use skrifa::raw::types::NameId; + + let mut name_buf = String::with_capacity(100); + let index = match font_file { + FileRef::Font(_) => 0, + FileRef::Collection(collection) => 'idx: { + for i in 0..collection.len() { + let font = collection.get(i).unwrap(); + let name_table = font.name().unwrap(); + if name_table + .name_record() + .iter() + .filter(|record| record.name_id() == NameId::POSTSCRIPT_NAME) + .any(|record| { + name_buf.clear(); + record + .string(name_table.string_data()) + .unwrap() + .chars() + .for_each(|c| name_buf.push(c)); + &name_buf == &postscript_name + }) + { + break 'idx i; + } + } + + panic!( + "Font with postscript_name {} not found in collection", + postscript_name + ); + } + }; + + index +}