diff --git a/.github/workflows/ohos.yml b/.github/workflows/ohos.yml new file mode 100644 index 00000000..0841b85c --- /dev/null +++ b/.github/workflows/ohos.yml @@ -0,0 +1,104 @@ +name: OpenHarmony hap + +# Tier 3 (platform/README.md): a community port built by a manually dispatched +# workflow, never on pull requests. The HarmonyOS SDK and hvigor are not +# anonymously downloadable, so the build job targets a self-hosted runner with +# the toolchain described in platform/ohos/README.md. +# +# Pull request checks build unsigned: this workflow only runs on dispatch, and +# signing material exists exclusively as repository secrets. + +on: + workflow_dispatch: + inputs: + app: + description: Application to package + type: choice + options: + - mail + - demo + default: mail + profile: + description: Cargo profile + type: choice + options: + - release + - debug + default: release + sign: + description: Sign with the AGC material stored in the repository secrets + type: boolean + default: false + run_quality: + description: Run the shared quality suite first + type: boolean + default: true + +permissions: + contents: read + +concurrency: + group: ohos-${{ github.ref }} + cancel-in-progress: false + +jobs: + quality: + if: inputs.run_quality + name: Shared quality suite + uses: ./.github/workflows/quality.yml + + hap: + name: ${{ inputs.app }} hap (${{ inputs.profile }}) + needs: quality + if: always() && (needs.quality.result == 'success' || needs.quality.result == 'skipped') + runs-on: [self-hosted, linux, ohos] + timeout-minutes: 180 + steps: + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 + + - name: Check the OHOS workspace formatting + run: cargo fmt --manifest-path platform/ohos/Cargo.toml --all -- --check + + - name: Materialize signing material + if: inputs.sign + env: + KEYSTORE_BASE64: ${{ secrets.FLECTAR_OHOS_KEYSTORE_BASE64 }} + CERTIFICATE_BASE64: ${{ secrets.FLECTAR_OHOS_CERTIFICATE_BASE64 }} + PROFILE_BASE64: ${{ secrets.FLECTAR_OHOS_PROFILE_BASE64 }} + run: | + test -n "$KEYSTORE_BASE64" + test -n "$CERTIFICATE_BASE64" + test -n "$PROFILE_BASE64" + material="$RUNNER_TEMP/ohos-signing" + umask 077 + mkdir -p "$material" + printf '%s' "$KEYSTORE_BASE64" | base64 --decode > "$material/keystore.p12" + printf '%s' "$CERTIFICATE_BASE64" | base64 --decode > "$material/certificate.cer" + printf '%s' "$PROFILE_BASE64" | base64 --decode > "$material/profile.p7b" + { + echo "RELEASE_SIGN=1" + echo "RELEASE_P12=$material/keystore.p12" + echo "RELEASE_CERT=$material/certificate.cer" + echo "RELEASE_PROFILE=$material/profile.p7b" + echo "RELEASE_KEY_ALIAS=${{ secrets.FLECTAR_OHOS_KEY_ALIAS }}" + echo "RELEASE_KEY_PWD=${{ secrets.FLECTAR_OHOS_KEY_PASSWORD }}" + echo "RELEASE_STORE_PWD=${{ secrets.FLECTAR_OHOS_STORE_PASSWORD }}" + } >> "$GITHUB_ENV" + + - name: Build the hap + env: + APP: ${{ inputs.app }} + PROFILE: ${{ inputs.profile }} + CARGO_BUILD_JOBS: "4" + SKIP_SIGN: ${{ inputs.sign && '0' || '1' }} + run: sh platform/ohos/scripts/build-hap.sh + + - name: Remove the signing material + if: always() && inputs.sign + run: rm -rf "$RUNNER_TEMP/ohos-signing" + + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: flectar-ohos-${{ inputs.app }}-${{ inputs.profile }} + path: platform/ohos/build/*.hap + if-no-files-found: error diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 7611ff78..8edca635 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -84,6 +84,8 @@ jobs: run: python3 scripts/check-platform-gates.py - name: Verify the Blitz patch queue run: bash scripts/blitz-patches.sh verify + - name: Verify the Fontique patch queue + run: bash scripts/fontique-patches.sh verify - name: Verify and test the Parley backport run: | python3 scripts/verify-parley.py diff --git a/Cargo.toml b/Cargo.toml index 75595273..e449c1e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = ["crates/flectar-mail-core", "crates/renderer-probe"] -exclude = ["crates/candle-core", "crates/blitz-dom", "crates/blitz-paint", "crates/i-slint-backend-winit", "crates/parley", "crates/parley_emoji"] +exclude = ["crates/candle-core", "crates/blitz-dom", "crates/blitz-paint", "crates/fontique", "crates/i-slint-backend-winit", "crates/parley", "crates/parley_emoji"] resolver = "3" [workspace.dependencies] @@ -174,7 +174,7 @@ objc2-foundation = { version = "0.3", default-features = false, features = ["std objc2-service-management = { version = "0.3", default-features = false, features = ["std", "objc2", "objc2-foundation", "SMAppService"] } # This is `desktop`; keep it in step with the `mobile` alias in build.rs. -[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] +[target.'cfg(not(any(target_os = "android", target_os = "ios", target_env = "ohos")))'.dependencies] arboard = { version = "3.6", default-features = false, features = ["wayland-data-control"] } rfd = { version = "0.16", default-features = false, features = ["tokio", "xdg-portal"] } diff --git a/build.rs b/build.rs index 703679a8..d8d39677 100644 --- a/build.rs +++ b/build.rs @@ -5,7 +5,7 @@ fn main() { // operating system. A new platform joins these groups here (and in the // core's build.rs) instead of editing call sites. See platform/README.md. cfg_aliases! { - mobile: { any(target_os = "android", target_os = "ios") }, + mobile: { any(target_os = "android", target_os = "ios", target_env = "ohos") }, desktop: { not(mobile) }, // OpenHarmony reports target_os = "linux" without a desktop session, // portals, X11 or a Secret Service. diff --git a/crates/flectar-mail-core/Cargo.toml b/crates/flectar-mail-core/Cargo.toml index 935b8d64..eed653b9 100644 --- a/crates/flectar-mail-core/Cargo.toml +++ b/crates/flectar-mail-core/Cargo.toml @@ -104,6 +104,6 @@ rustix = { version = "1", features = ["fs"] } # This is `desktop`. Mobile hosts inject their storage paths and a # platform-owned credential store instead. -[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] +[target.'cfg(not(any(target_os = "android", target_os = "ios", target_env = "ohos")))'.dependencies] dirs = "6" keyring = { version = "3", features = ["sync-secret-service", "apple-native", "windows-native"] } diff --git a/crates/flectar-mail-core/build.rs b/crates/flectar-mail-core/build.rs index 65fe4c03..657193cc 100644 --- a/crates/flectar-mail-core/build.rs +++ b/crates/flectar-mail-core/build.rs @@ -12,7 +12,7 @@ fn main() { // Keep `mobile` identical to the application's build.rs; see // platform/README.md. cfg_aliases! { - mobile: { any(target_os = "android", target_os = "ios") }, + mobile: { any(target_os = "android", target_os = "ios", target_env = "ohos") }, desktop: { not(mobile) }, // rustix exposes renameat2/renameatx_np with RENAME_NOREPLACE here. rename_noreplace: { any(target_os = "linux", target_os = "android", target_os = "macos", target_os = "ios") }, diff --git a/crates/fontique/.cargo_vcs_info.json b/crates/fontique/.cargo_vcs_info.json new file mode 100644 index 00000000..df2a1335 --- /dev/null +++ b/crates/fontique/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "eea3503dd6cf17130cbb07348e0ff2c918300e94" + }, + "path_in_vcs": "fontique" +} \ No newline at end of file diff --git a/crates/fontique/Cargo.lock b/crates/fontique/Cargo.lock new file mode 100644 index 00000000..9bf1228c --- /dev/null +++ b/crates/fontique/Cargo.lock @@ -0,0 +1,388 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "bitflags" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bf886368962a7d8456f136073ed33ed1b0770c690d2063731bb6a776e99f33" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontique" +version = "0.11.1" +dependencies = [ + "hashbrown", + "linebender_resource_handle", + "memmap2", + "objc2", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation", + "parlance", + "read-fonts", + "roxmltree", + "smallvec", + "windows", + "windows-core", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash", +] + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "memchr" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags", + "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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "objc2", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "parlance" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6937eda350acc1a5d05872c3cbf99fe78619c269096e2be3d4a350058639d5" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "core_maths", + "font-types", + "once_cell", +] + +[[package]] +name = "roxmltree" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +dependencies = [ + "memchr", +] + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "syn" +version = "2.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] diff --git a/crates/fontique/Cargo.toml b/crates/fontique/Cargo.toml new file mode 100644 index 00000000..39c9c500 --- /dev/null +++ b/crates/fontique/Cargo.toml @@ -0,0 +1,193 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2021" +rust-version = "1.88" +name = "fontique" +version = "0.11.1" +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Font enumeration and fallback." +readme = "README.md" +keywords = [ + "font", + "text", +] +categories = [ + "gui", + "os", +] +license = "Apache-2.0 OR MIT" +repository = "https://github.com/linebender/parley" + +[package.metadata.docs.rs] +all-features = true + +[features] +bytemuck = ["parlance/bytemuck"] +default = ["system"] +fontconfig-dlopen = ["yeslogic-fontconfig-sys?/dlopen"] +libm = ["read-fonts/libm"] +std = [ + "read-fonts/std", + "dep:memmap2", + "parlance/std", +] +system = [ + "std", + "dep:windows", + "dep:windows-core", + "dep:objc2", + "dep:objc2-core-foundation", + "dep:objc2-core-text", + "dep:objc2-foundation", + "dep:yeslogic-fontconfig-sys", + "dep:roxmltree", +] + +[lib] +name = "fontique" +path = "src/lib.rs" + +[[example]] +name = "generic_families" +path = "examples/generic_families.rs" + +[dependencies.hashbrown] +version = "0.17.0" +features = [ + "default-hasher", + "raw-entry", +] +default-features = false + +[dependencies.linebender_resource_handle] +version = "0.1.1" +default-features = false + +[dependencies.memmap2] +version = "0.9.10" +optional = true + +[dependencies.parlance] +version = "0.1.0" +default-features = false + +[dependencies.read-fonts] +version = "0.41.0" +default-features = false + +[dependencies.smallvec] +version = "1.15.1" + +[target.'cfg(all(any(target_os = "linux", target_os="freebsd"), not(target_env = "ohos")))'.dependencies.yeslogic-fontconfig-sys] +version = "6.0.0" +optional = true + +[target.'cfg(target_os = "android")'.dependencies.roxmltree] +version = "0.21.1" +optional = true + +[target.'cfg(target_os = "windows")'.dependencies.windows] +version = "0.62.2" +features = ["Win32_Graphics_DirectWrite"] +optional = true + +[target.'cfg(target_os = "windows")'.dependencies.windows-core] +version = "0.62.2" +optional = true + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2] +version = "0.6.4" +features = [ + "std", + "relax-sign-encoding", +] +optional = true + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-core-foundation] +version = "0.3.2" +features = [ + "CFBase", + "CFURL", +] +optional = true +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-core-text] +version = "0.3.2" +features = [ + "CTFont", + "CTFontDescriptor", + "CTFontCollection", +] +optional = true +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-foundation] +version = "0.3.2" +features = [ + "alloc", + "NSArray", + "NSEnumerator", + "NSPathUtilities", + "NSString", +] +optional = true +default-features = false + +[lints.clippy] +allow_attributes_without_reason = "warn" +cargo_common_metadata = "warn" +cast_possible_truncation = "warn" +collection_is_never_read = "warn" +dbg_macro = "warn" +debug_assert_with_mut_call = "warn" +default_trait_access = "warn" +doc_markdown = "warn" +fn_to_numeric_cast_any = "warn" +infinite_loop = "warn" +large_stack_arrays = "warn" +mismatching_type_param_order = "warn" +missing_assert_message = "warn" +missing_fields_in_debug = "warn" +negative_feature_names = "warn" +redundant_feature_names = "warn" +same_functions_in_if_condition = "warn" +semicolon_if_nothing_returned = "warn" +should_panic_without_expect = "warn" +todo = "warn" +too_many_arguments = "allow" +unseparated_literal_suffix = "warn" +use_self = "warn" +wildcard_dependencies = "warn" + +[lints.rust] +elided_lifetimes_in_paths = "warn" +keyword_idents_2024 = "forbid" +missing_debug_implementations = "warn" +missing_docs = "warn" +non_ascii_idents = "forbid" +non_local_definitions = "forbid" +trivial_numeric_casts = "warn" +unnameable_types = "warn" +unreachable_pub = "warn" +unsafe_code = "deny" +unsafe_op_in_unsafe_fn = "forbid" +unused_import_braces = "warn" +unused_lifetimes = "warn" +unused_macro_rules = "warn" +unused_qualifications = "warn" diff --git a/crates/fontique/Cargo.toml.orig b/crates/fontique/Cargo.toml.orig new file mode 100644 index 00000000..91c4d818 --- /dev/null +++ b/crates/fontique/Cargo.toml.orig @@ -0,0 +1,79 @@ +[package] +name = "fontique" +version.workspace = true +description = "Font enumeration and fallback." +keywords = ["font", "text"] +categories = ["gui", "os"] +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true + +[package.metadata.docs.rs] +all-features = true + +[lints] +workspace = true + +[features] +default = ["system"] +std = ["read-fonts/std", "dep:memmap2", "parlance/std"] +libm = ["read-fonts/libm"] +bytemuck = ["parlance/bytemuck"] +# Enables support for system font backends +system = [ + "std", + "dep:windows", + "dep:windows-core", + "dep:objc2", + "dep:objc2-core-foundation", + "dep:objc2-core-text", + "dep:objc2-foundation", + "dep:yeslogic-fontconfig-sys", + "dep:roxmltree", +] + +# Use dlopen to load the fontconfig library. This allows Fontique to compile even if the +# system does not have fontconfig installed, although the font fallback to system fonts +# will not work properly in this case (no such fallback will occur) +fontconfig-dlopen = ["yeslogic-fontconfig-sys?/dlopen"] + +[dependencies] +read-fonts = { workspace = true } +linebender_resource_handle = { workspace = true } +smallvec = "1.15.1" +memmap2 = { version = "0.9.10", optional = true } +hashbrown = { workspace = true } +parlance = { workspace = true } + +[target.'cfg(target_os = "windows")'.dependencies] +windows = { version = "0.62.2", features = ["Win32_Graphics_DirectWrite"], optional = true } +windows-core = { version = "0.62.2", optional = true } + +[target.'cfg(target_vendor = "apple")'.dependencies] +# FIX: Enable relax-sign-encoding to prevent the bug described in this issue: https://github.com/madsmtm/objc2/issues/566 +objc2 = { version = "0.6.4", optional = true, features = ["std", "relax-sign-encoding"] } +# NOTE: When updating objc2-foundation, objc2-core-foundation, or objc2-core-text make sure to use the version of objc2 +# that they reference to prevent crate duplication. +objc2-foundation = { version = "0.3.2", optional = true, default-features = false, features = [ + "alloc", + "NSArray", + "NSEnumerator", + "NSPathUtilities", + "NSString", +] } +objc2-core-foundation = { version = "0.3.2", optional = true, default-features = false, features = [ + "CFBase", + "CFURL", +] } +objc2-core-text = { version = "0.3.2", optional = true, default-features = false, features = [ + "CTFont", + "CTFontDescriptor", + "CTFontCollection", +] } + +[target.'cfg(any(target_os = "linux", target_os="freebsd"))'.dependencies] +yeslogic-fontconfig-sys = { version = "6.0.0", optional = true } + +[target.'cfg(target_os = "android")'.dependencies] +roxmltree = { version = "0.21.1", optional = true } diff --git a/crates/fontique/LICENSE-APACHE b/crates/fontique/LICENSE-APACHE new file mode 100644 index 00000000..16fe87b0 --- /dev/null +++ b/crates/fontique/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/crates/fontique/LICENSE-MIT b/crates/fontique/LICENSE-MIT new file mode 100644 index 00000000..6601faa0 --- /dev/null +++ b/crates/fontique/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright 2024 the Parley Authors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/crates/fontique/README.md b/crates/fontique/README.md new file mode 100644 index 00000000..6c66e142 --- /dev/null +++ b/crates/fontique/README.md @@ -0,0 +1,54 @@ +