119 Commits

Author SHA1 Message Date
Anthony Eid 6f844cf1a1 Fix get_descriptors memory leak (#746)
This function incorrectly assumed that
`CTFontCollectionCreateMatchingFontDescriptors` doesn't follow the
*Create* rule which is false.

From Apple's docs

> A retained reference to an array of normalized font descriptors
  matching the collection definition.

https://leopard-adc.pepas.com/documentation/Carbon/Reference/CTFontCollectionRef/Reference/reference.html#//apple_ref/c/func/CTFontCollectionCreateMatchingFontDescriptors

I also confirmed using instruments that this was causing a memory leak
in Zed.
2026-01-15 21:38:44 +00:00
Josh Matthews 6a8e54e54d Publish core-text 0.21.0. (#738)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-01-15 12:26:19 +00:00
Yash Joshi ab22f7ac45 core-text: Add has_table method wrapping CTFontHasTable (#739)
* core-text:Add has_table method wrapping CTFontHasTable

* Fix Build by make lifetimes explicit

* fix clippy lints in array.rs and propertylist.rs
2025-08-28 05:42:24 +00:00
David Stern 0bcad1e103 Fix unwrap panic in extract_number_for_key in impl TraitAccessorPrivate for CTFontTraits on macOS Ventura. (#735)
* fix ventura crash

* formatting

---------

Co-authored-by: alokedesai <aloke@warp.dev>
2025-07-13 06:28:35 +00:00
Josh Matthews 13cd1142e5 Fix clippy lints. (#736) 2025-07-13 05:38:26 +00:00
Mads Marquart 6541d9a789 Fix invalid msg_send! (#702) 2024-08-13 12:04:01 +00:00
Bruce Mitchener fb71d45b30 Enable clippy, suppress lots, fix a couple. (#703)
This enables clippy in CI and suppresses most of the existing
warnings. We can drill down and fix those later, but this will
help start getting things under control.
2024-08-13 04:25:49 +00:00
Bruce Mitchener 39a39555c0 Use workspace inheritance. (#701)
Consolidate package configuration where possible. This also
removes the `homepage` key as it only points to the repository
so isn't providing anything additional.

Use workspace dependencies for the crates provided by the workspace
and used within the workspace. This centralizes the version number
maintenance a bit.
2024-08-12 07:41:37 +00:00
Bruce Mitchener 9f33b121fb Use core::ffi over std::os::raw and libc::c_* (#692)
`core::ffi` is the preferred way to access these type definitions.
Begin removing uses of the versions from `libc`.

`libc::c_void` is not exactly the same as `core::ffi::c_void` but
some code has tried using them interchangeably (like in io-surface).

`libc::size_t` is `usize` on all current platforms.
2024-08-11 20:24:22 +00:00
Bruce Mitchener 42ec06106d Bump MSRV to 1.65 (#694)
This will allow us to use `dep:` syntax and also move to using types
from `core::ffi` as well as some other more modern constructs.
2024-08-11 16:15:49 +00:00
Bruce Mitchener 31a92cd2fc Fix typos. (#689) 2024-07-20 10:26:35 +00:00
Bruce Mitchener 8d2b732db5 Remove usages of extern crate. (#672) 2024-05-27 06:40:54 +00:00
David Stern 32368020b6 core-text: Implement CTRunGetTypographicBounds. (#675) 2024-05-23 02:05:58 +00:00
David Stern e5162be4fa core-text: Implement CTFontGetMatrix. (#674) 2024-04-30 00:42:50 +00:00
Dirkjan Ochtman 199badc40f Fix support for macOS 14 (#668)
* core-text: define version variable and dbg!() it

Note that this test already has a number of dbg!() calls, presumably
to aid debugging when it fails in the future (for example due to
OS changes).

* core-text: extract helper function in test

* core-text: improve assertion to make failure easier to diagnose

* core-text: allow variations test to pass on 14.x.y

* CI: test on macOS 14

* CI: only test old Rust on one version
2024-04-16 09:47:06 +00:00
Alex Touchet f9440bcddb Update/remove obsolete badges and update link (#663) 2024-04-08 10:27:33 +00:00
Dirkjan Ochtman 9721646053 foundation: remove optional chrono dependency (#666)
* foundation: remove optional chrono dependency

* Bump version numbers for semver-incompatible changes
2024-04-08 10:20:45 +00:00
Bruce Mitchener 58972aef0a Update to 2018 edition. (#642)
This is the minimum fix required. It updates to use crate-relative
imports.
2023-10-24 00:30:22 +00:00
Leo Kettmeir c4f4ad20b6 feat: add link feature (#608)
adjust docs

Update cocoa/Cargo.toml

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>

fmt
2023-10-10 14:46:20 +00:00
jfkthame 5be8e2cd8f Bump core-text version (#638)
Just exposing a couple of additional APIs.

(Motivation: to enable us to try using the `_and_options` API when instantiating fonts in webrender, for https://bugzilla.mozilla.org/show_bug.cgi?id=1803406.)
2023-09-22 14:00:13 +00:00
jfkthame 099bd27d93 rustfmt fixes (#637) 2023-09-19 20:33:28 +00:00
jfkthame 91fb8c385a Expose the CTFont-creation functions with options parameter (#636) 2023-09-19 19:41:56 +00:00
Bruce Mitchener e589abe82e Make license files consistent. (#625)
Each crate now has a symlink to the root level license files.
Previously, some did, some had copies, and some had nothing.

Fixes #503.
2023-08-13 12:20:16 +00:00
Bruce Mitchener b6d2529ca9 More clippy fixes. (#629) 2023-08-07 17:42:26 +00:00
Bruce Mitchener 855319c0e2 Apple renamed CTFontOrientation values. (#630)
* `kCTFontDefaultOrientation` -> `kCTFontOrientationDefault`
* `kCTFontOrientationHorizontal` -> `kCTFontOrientationHorizontal`
* `kCTFontOrientationVertical` -> `kCTFontOrientationVertical`

The old names were deprecated in macOS 10.11, iOS 9. The new names
were introduced in macOS 10.8, iOS 6.

Fixes #438.
2023-08-07 17:41:35 +00:00
Bruce Mitchener 18df9aafe7 Some clippy fixes. (#624) 2023-08-03 14:20:26 +00:00
Bruce Mitchener 062041a921 docs.rs: Document with all-features enabled. (#626)
This will help people find the functionality that is feature-gated.

Fixes #540.
2023-08-01 15:29:29 +00:00
micolous b009c87f2d Auto-format code with "cargo fmt" and check in CI (#615)
* add rustfmt check to CI

* Run "cargo fmt" (rustfmt) over core-foundation-rs
2023-07-25 02:22:25 +00:00
Jeff Muizelaar d10ad8dead Get tests passing on macOS 13
macOS 13 uses NSTaggedPointerString for short CFStrings
which means the retain counts aren't meaningful. Increasing the length
of the strings avoids this.

Empty arrays also seem to refer to a shared constant object that
doesn't have meaningful retain counts either.

Fixes #597
2023-06-20 09:49:19 -04:00
michaelwright235 4938a33fdb sys: Move UniChar type back to string module
Fixes a semver breakage
2023-06-20 13:23:36 +03:00
Nicolas Silva ffa2318497 Update core-text/Cargo.toml
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2023-06-19 18:43:40 +02:00
Nicolas Silva 589c97086e Bump core-text, core-graphics and cocoa 2023-06-19 17:07:44 +02:00
michaelwright235 b742606a5c sys: string: Remove repeating type
Removes `UniChar` type because it's already defined in base.rs.
2023-06-01 15:50:12 +03:00
George Burton 6ddf5cadcc Update foreign-types crate to v0.5 2023-04-25 22:15:52 +01:00
Alex Touchet 1632edee66 Use SPDX license format 2023-04-02 22:43:22 -07:00
ssssota b0e0dd8bf4 Add get name function 2022-02-16 12:09:01 +09:00
Jeff Muizelaar aee417874f Expose bindings to CTFontCreateUIFontForLanguage 2021-12-13 12:42:52 -05:00
Jeff Muizelaar 5dff9e13fd Add some more tests around system fonts and variations 2021-12-08 20:23:44 -05:00
Jeff Muizelaar 77ffcfe731 core-text: out_of_range_variations: Add support for macOS 12 2021-12-08 19:02:22 -05:00
Jeff Muizelaar 3d6c103a14 core-text: Add a test for out of range variations. 2021-12-08 14:53:53 -05:00
Jeff Muizelaar 1ad12536ec Test that we can create a new CTFont from the descriptor attributes. 2021-11-22 19:22:41 -05:00
Jeff Muizelaar 7ed2cce432 Bump core-text version. 2021-02-14 12:05:14 -05:00
Jeff Muizelaar 39956a4d8e Add some documentation about using an autorelease pool 2020-12-22 21:13:41 -05:00
bors-servo 7a2ec12906 Auto merge of #421 - jrmuizel:copy-system, r=jdm
Test that copying system fonts doesn't change the url
2020-11-19 10:42:26 -05:00
Jeff Muizelaar 11247e3e8d Test that copying system fonts doesn't change the url 2020-11-04 09:11:49 -05:00
Jeff Muizelaar 0f3eaa7416 Add create_font_descriptor_with_data
This allows create a font from a CFData instead of slice.
More importantly this allows using a CFData that was created
with a custom allocator.
2020-11-03 10:58:40 -05:00
Jeff Muizelaar 597a12983a Make CTFontDescriptor Send and Sync and expose attributes() 2020-10-28 12:13:03 -04:00
Jeff Muizelaar 5a9ab37c01 Make sure we can round trip data fonts through descriptors. 2020-10-26 14:46:13 -04:00
Jeff Muizelaar f8b2abf407 Expose CTFontDescriptorCreateCopyWithAttributes 2020-10-21 11:34:27 -04:00
Josh Matthews d3336c3a21 Version bumps for cocoa, core-foundation-sys, core-foundation, core-text, core-graphics-types, core-graphics. 2020-09-15 12:19:56 -04:00