cairo: enable font backends and fractional glyph positioning in 1.18.4.bcr.1 (#10389)

PangoCairo cannot link against the existing Cairo BCR module because its
build omits the FreeType/fontconfig backend. The existing configuration
also selects a rendering path that rounds fractional glyph positions to
whole pixels. This PR fixes both issues while keeping the same upstream
Cairo 1.18.4 source release.

BCR's [add-only
policy](https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/README.md#add-only)
requires build fixes to be published as a new revision. The existing
`modules/cairo/1.18.4/` build files are therefore copied into
`modules/cairo/1.18.4.bcr.1/` and modified there. This explains why
GitHub shows mostly added files: much of the diff is the existing
overlay copied into the new version directory.

The revision makes four changes:

1. **Enable the font backend Pango needs.** In
`overlay/src/BUILD.bazel`, compile the existing upstream sources
`cairo-ft-font.c`, `cairo-colr-glyph-render.c`, and
`cairo-svg-glyph-render.c`. Add the existing BCR FreeType and fontconfig
dependencies, enable `CAIRO_HAS_FT_FONT` and `CAIRO_HAS_FC_FONT`, and
declare the supported FreeType feature macros. This exposes the font
APIs required by PangoCairo. Cairo continues to depend on the original
FreeType 2.14.1 module, independently of the separate PNG-support
revision.

2. **Preserve fractional glyph positions.** Set `HAS_PIXMAN_GLYPHS=1`,
matching upstream Cairo's configuration for the required Pixman version.
Without this setting, Cairo selects a legacy compositor that rounds
glyph positions to integers; a glyph intended at 10.25 pixels is snapped
to a whole-pixel position. The change enables upstream's existing Pixman
glyph cache.

3. **Add two portable regression tests.** `ft_smoke` renders an embedded
bitmap glyph through both the FreeType-face and fontconfig-pattern APIs.
`glyph_positioning` compares a synthetic square glyph with equivalent
vector geometry at all 16 quarter-pixel phase combinations; it fails
when the glyph cache is disabled. Both tests run without installed
fonts, alongside the existing Cairo test.

4. **Correct existing build and test configuration.** Declare
`HAVE_ZLIB` for the already-present zlib dependency so the script
interpreter compiles; correct `PACKAGE_VERSION` from 1.18.5 to the
actual 1.18.4 release; and fix the existing Bazel test-path patch's
pointer handling so it compiles with GCC 14.

Validation: all Cairo targets and three tests pass independently on
Ubuntu x86_64 with Bazel 7.7.1, 8.4.2, and 9.2.0, using the original
FreeType module. The integrated tests also pass on Debian 13/GCC 14 with
all three Bazel versions, and with optimized Clang 18 on Bazel 9.2.0.
The existing CI matrix is retained. Local BCR content validation passed
using checksum-verified cached release archives after download-host
timeouts; the remaining platforms and original download URLs were not
verified locally.
15 files changed
tree: 036d8a855fdf74ad42b2ef4422a64791b165c9a7
  1. .agent/
  2. .bazelci/
  3. .gemini/
  4. .github/
  5. docs/
  6. modules/
  7. tools/
  8. .bazelignore
  9. .bazelversion
  10. .editorconfig
  11. .git-blame-ignore-revs
  12. .gitattributes
  13. .gitignore
  14. .pre-commit-config.yaml
  15. .ruff.toml
  16. AUTHORS
  17. bazel_registry.json
  18. BUILD
  19. CODEOWNERS
  20. GEMINI.md
  21. incompatible_flags.yml
  22. LICENSE
  23. metadata.schema.json
  24. MODULE.bazel
  25. README.md
  26. WORKSPACE
README.md

Bazel Central Registry

Overview

The Bazel Central Registry (BCR) is the default registry for Bazel's external dependency system (“Bzlmod”). This is the GitHub repository backing the contents of the BCR, hosted at https://bcr.bazel.build/. For the website that allows you to search modules and see their versions conveniently, visit https://registry.bazel.build/.

Besides hosting metadata about Bazel-specific libraries (commonly known as “rulesets”), the BCR is also a central host for projects that don't have upstream support for Bazel (most commonly, C/C++ projects).

The BCR is just like a regular Bazel registry, with some extra metadata fields and policy restrictions. You can contribute to the BCR by sending pull requests; see BCR policies and contribution guidelines for more information.

Disclaimer

The core infrastructure of the Bazel Central Registry depends on GitHub and Google Cloud. Bazel users who enable Bzlmod (the default since Bazel 8) depend on the BCR by default. While we try to keep the BCR infrastructure simple and reliable, we assume no liability for any damages caused by build failures due to potential BCR infrastructure failures.

If you consider it necessary, you can do the following to avoid depending on the BCR infrastructure while still making use of the information checked into the BCR.

  • Clone the BCR repository or mirror the content to your own infrastructure and use the --registry option to change the default Bazel registry to your own.
    • --registry is a flag that can be specified multiple times.
    • If no --registry flag is specified, the BCR is the only registry Bazel consults.
    • If any --registry flag is specified, Bazel will consult the specified registries in order, but will not consult the BCR unless the BCR is explicitly specified as a registry. In other words, to use your own registry layered on top of the BCR, use --registry=https://my.own.registry.com/ --registry=https://bcr.bazel.build/.
  • Host your own mirror for all source archive URLs and add the mirror URL in ./bazel_registry.json. You can run bazel run //tools:print_all_src_urls to get the list of source URLs to mirror for all Bazel modules checked into the BCR. For example, https://foo.com/bar.zip should be mirrored to https://<your mirror>/foo.com/bar.zip.